Qt: Implement GBA host and widget

This commit is contained in:
Bonta
2021-07-04 13:23:30 +02:00
parent 9b80fb7deb
commit d6f86e1754
8 changed files with 635 additions and 1 deletions

View File

@ -24,6 +24,9 @@
#include "Core/PowerPC/PowerPC.h"
#include "Core/State.h"
#ifdef HAS_LIBMGBA
#include "DolphinQt/GBAWidget.h"
#endif
#include "DolphinQt/QtUtils/QueueOnObject.h"
#include "DolphinQt/Settings.h"
@ -115,6 +118,15 @@ void Host::SetRenderFullFocus(bool focus)
m_render_full_focus = focus;
}
bool Host::GetGBAFocus()
{
#ifdef HAS_LIBMGBA
return qobject_cast<GBAWidget*>(QApplication::activeWindow()) != nullptr;
#else
return false;
#endif
}
bool Host::GetRenderFullscreen()
{
return m_render_fullscreen;
@ -167,7 +179,7 @@ void Host_UpdateTitle(const std::string& title)
bool Host_RendererHasFocus()
{
return Host::GetInstance()->GetRenderFocus();
return Host::GetInstance()->GetRenderFocus() || Host::GetInstance()->GetGBAFocus();
}
bool Host_RendererHasFullFocus()
@ -230,7 +242,9 @@ void Host_TitleChanged()
#endif
}
#ifndef HAS_LIBMGBA
std::unique_ptr<GBAHostInterface> Host_CreateGBAHost(std::weak_ptr<HW::GBA::Core> core)
{
return nullptr;
}
#endif