Skip to content

Commit

Permalink
Core/Host: Allow frontends to block inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
spycrab committed Mar 21, 2019
1 parent 0a3279a commit 61350b3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Source/Android/jni/MainAndroid.cpp
Expand Up @@ -94,6 +94,10 @@ void Host_NotifyMapLoaded()
void Host_RefreshDSPDebuggerWindow()
{
}
bool Host_UIBlocksControllerState()
{
return false;
}

void Host_Message(HostMessageID id)
{
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Host.h
Expand Up @@ -33,6 +33,7 @@ enum class HostMessageID
};

bool Host_UINeedsControllerState();
bool Host_UIBlocksControllerState();
bool Host_RendererHasFocus();
bool Host_RendererIsFullscreen();
void Host_Message(HostMessageID id);
Expand Down
5 changes: 5 additions & 0 deletions Source/Core/DolphinNoGUI/MainNoGUI.cpp
Expand Up @@ -52,6 +52,11 @@ void Host_RefreshDSPDebuggerWindow()
{
}

bool Host_UIBlocksControllerState()
{
return false;
}

static Common::Event s_update_main_frame_event;
void Host_Message(HostMessageID id)
{
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/DolphinQt/Host.cpp
Expand Up @@ -151,6 +151,12 @@ bool Host_UINeedsControllerState()
{
return Settings::Instance().IsControllerStateNeeded();
}

bool Host_UIBlocksControllerState()
{
return ImGui::GetCurrentContext() && ImGui::GetIO().WantCaptureKeyboard;
}

void Host_RefreshDSPDebuggerWindow()
{
}
5 changes: 3 additions & 2 deletions Source/Core/InputCommon/ControlReference/ControlReference.cpp
Expand Up @@ -14,8 +14,9 @@ using namespace ciface::ExpressionParser;

bool ControlReference::InputGateOn()
{
return SConfig::GetInstance().m_BackgroundInput || Host_RendererHasFocus() ||
Host_UINeedsControllerState();
return (SConfig::GetInstance().m_BackgroundInput || Host_RendererHasFocus() ||
Host_UINeedsControllerState()) &&
!Host_UIBlocksControllerState();
}

//
Expand Down
4 changes: 4 additions & 0 deletions Source/UnitTests/StubHost.cpp
Expand Up @@ -35,6 +35,10 @@ bool Host_UINeedsControllerState()
{
return false;
}
bool Host_UIBlocksControllerState()
{
return false;
}
bool Host_RendererHasFocus()
{
return false;
Expand Down

0 comments on commit 61350b3

Please sign in to comment.