InputCommon: Only update setting expressions when the input gate is enabled.
This commit is contained in:
parent
e00459f68f
commit
53f2e275af
|
@ -158,10 +158,13 @@ class SettingValue
|
||||||
public:
|
public:
|
||||||
ValueType GetValue() const
|
ValueType GetValue() const
|
||||||
{
|
{
|
||||||
if (IsSimpleValue())
|
// Only update dynamic values when the input gate is enabled.
|
||||||
return m_value;
|
// Otherwise settings will all change to 0 when window focus is lost.
|
||||||
else
|
// This is very undesirable for things like battery level or attached extension.
|
||||||
return m_input.GetState<ValueType>();
|
if (!IsSimpleValue() && ControlReference::GetInputGate())
|
||||||
|
m_value = m_input.GetState<ValueType>();
|
||||||
|
|
||||||
|
return m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSimpleValue() const { return m_input.GetExpression().empty(); }
|
bool IsSimpleValue() const { return m_input.GetExpression().empty(); }
|
||||||
|
@ -176,7 +179,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Values are R/W by both UI and CPU threads.
|
// Values are R/W by both UI and CPU threads.
|
||||||
std::atomic<ValueType> m_value = {};
|
mutable std::atomic<ValueType> m_value = {};
|
||||||
|
|
||||||
// Unfortunately InputReference's state grabbing is non-const requiring mutable here.
|
// Unfortunately InputReference's state grabbing is non-const requiring mutable here.
|
||||||
mutable InputReference m_input;
|
mutable InputReference m_input;
|
||||||
|
|
Loading…
Reference in New Issue