summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControlReference/ControlReference.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2019-11-06 15:59:36 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2019-11-06 16:31:02 -0600
commit85ceb37ccd24acc5ea026583ce3a0f6a4fb26eaa (patch)
tree1a4d9a86fdcd36a3c1273502af576bcb30449db1 /Source/Core/InputCommon/ControlReference/ControlReference.cpp
parent93d7b3d15962a3393cf2971e14c4acf54d90cecd (diff)
InputCommon: Make the "input gate" not racey.
Diffstat (limited to 'Source/Core/InputCommon/ControlReference/ControlReference.cpp')
-rw-r--r--Source/Core/InputCommon/ControlReference/ControlReference.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.cpp b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
index af7536547c..b1dd5deee3 100644
--- a/Source/Core/InputCommon/ControlReference/ControlReference.cpp
+++ b/Source/Core/InputCommon/ControlReference/ControlReference.cpp
@@ -4,19 +4,18 @@
#include "InputCommon/ControlReference/ControlReference.h"
-// For InputGateOn()
-// This is a bad layering violation, but it's the cleanest
-// place I could find to put it.
-#include "Core/ConfigManager.h"
-#include "Core/Host.h"
-
using namespace ciface::ExpressionParser;
-bool ControlReference::InputGateOn()
+static thread_local bool tls_input_gate = true;
+
+void ControlReference::SetInputGate(bool enable)
+{
+ tls_input_gate = enable;
+}
+
+bool ControlReference::GetInputGate()
{
- return (SConfig::GetInstance().m_BackgroundInput || Host_RendererHasFocus() ||
- Host_UINeedsControllerState()) &&
- !Host_UIBlocksControllerState();
+ return tls_input_gate;
}
//
@@ -90,7 +89,7 @@ bool OutputReference::IsInput() const
//
ControlState InputReference::State(const ControlState ignore)
{
- if (m_parsed_expression && InputGateOn())
+ if (m_parsed_expression && GetInputGate())
return m_parsed_expression->GetValue() * range;
return 0.0;
}