summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2019-03-18 17:30:33 +0100
committerspycrab <spycrab@users.noreply.github.com>2019-03-21 13:16:21 +0100
commit61350b3d989d07c77f9b9e58d47c4263294158ee (patch)
treef48705631152d35881741785dd6cc4ae86df2938 /Source/Core
parent0a3279ae6b8589ef9800ff361bc46e509fee99cf (diff)
Core/Host: Allow frontends to block inputs
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Host.h1
-rw-r--r--Source/Core/DolphinNoGUI/MainNoGUI.cpp5
-rw-r--r--Source/Core/DolphinQt/Host.cpp6
-rw-r--r--Source/Core/InputCommon/ControlReference/ControlReference.cpp5
4 files changed, 15 insertions, 2 deletions
diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h
index 3777d375f5..0bea7769d5 100644
--- a/Source/Core/Core/Host.h
+++ b/Source/Core/Core/Host.h
@@ -33,6 +33,7 @@ enum class HostMessageID
};
bool Host_UINeedsControllerState();
+bool Host_UIBlocksControllerState();
bool Host_RendererHasFocus();
bool Host_RendererIsFullscreen();
void Host_Message(HostMessageID id);
diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp
index c5ec03430f..e4096d8501 100644
--- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp
+++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp
@@ -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)
{
diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp
index c4d3711eda..63f03e3074 100644
--- a/Source/Core/DolphinQt/Host.cpp
+++ b/Source/Core/DolphinQt/Host.cpp
@@ -151,6 +151,12 @@ bool Host_UINeedsControllerState()
{
return Settings::Instance().IsControllerStateNeeded();
}
+
+bool Host_UIBlocksControllerState()
+{
+ return ImGui::GetCurrentContext() && ImGui::GetIO().WantCaptureKeyboard;
+}
+
void Host_RefreshDSPDebuggerWindow()
{
}
diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.cpp b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
index 1f392c4e3a..cfc6fa658e 100644
--- a/Source/Core/InputCommon/ControlReference/ControlReference.cpp
+++ b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
@@ -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();
}
//