Core/Host: Allow frontends to block inputs

This commit is contained in:
spycrab 2019-03-18 17:30:33 +01:00
parent 0a3279ae6b
commit 61350b3d98
6 changed files with 23 additions and 2 deletions

View File

@ -94,6 +94,10 @@ void Host_NotifyMapLoaded()
void Host_RefreshDSPDebuggerWindow() void Host_RefreshDSPDebuggerWindow()
{ {
} }
bool Host_UIBlocksControllerState()
{
return false;
}
void Host_Message(HostMessageID id) void Host_Message(HostMessageID id)
{ {

View File

@ -33,6 +33,7 @@ enum class HostMessageID
}; };
bool Host_UINeedsControllerState(); bool Host_UINeedsControllerState();
bool Host_UIBlocksControllerState();
bool Host_RendererHasFocus(); bool Host_RendererHasFocus();
bool Host_RendererIsFullscreen(); bool Host_RendererIsFullscreen();
void Host_Message(HostMessageID id); void Host_Message(HostMessageID id);

View File

@ -52,6 +52,11 @@ void Host_RefreshDSPDebuggerWindow()
{ {
} }
bool Host_UIBlocksControllerState()
{
return false;
}
static Common::Event s_update_main_frame_event; static Common::Event s_update_main_frame_event;
void Host_Message(HostMessageID id) void Host_Message(HostMessageID id)
{ {

View File

@ -151,6 +151,12 @@ bool Host_UINeedsControllerState()
{ {
return Settings::Instance().IsControllerStateNeeded(); return Settings::Instance().IsControllerStateNeeded();
} }
bool Host_UIBlocksControllerState()
{
return ImGui::GetCurrentContext() && ImGui::GetIO().WantCaptureKeyboard;
}
void Host_RefreshDSPDebuggerWindow() void Host_RefreshDSPDebuggerWindow()
{ {
} }

View File

@ -14,8 +14,9 @@ using namespace ciface::ExpressionParser;
bool ControlReference::InputGateOn() bool ControlReference::InputGateOn()
{ {
return SConfig::GetInstance().m_BackgroundInput || Host_RendererHasFocus() || return (SConfig::GetInstance().m_BackgroundInput || Host_RendererHasFocus() ||
Host_UINeedsControllerState(); Host_UINeedsControllerState()) &&
!Host_UIBlocksControllerState();
} }
// //

View File

@ -35,6 +35,10 @@ bool Host_UINeedsControllerState()
{ {
return false; return false;
} }
bool Host_UIBlocksControllerState()
{
return false;
}
bool Host_RendererHasFocus() bool Host_RendererHasFocus()
{ {
return false; return false;