Respect background input setting for axis values
- closes #3957. Previously, axis values were always set, even when that setting was offf.
This commit is contained in:
parent
64ef1bfc17
commit
bf82d95e0d
|
@ -133,6 +133,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void HandleAxis(string axis, int newValue)
|
||||
{
|
||||
if (ShouldSwallow(MainFormInputAllowedCallback(false), ClientInputFocus.Pad))
|
||||
return;
|
||||
|
||||
if (_trackDeltas) _axisDeltas[axis] += Math.Abs(newValue - _axisValues[axis]);
|
||||
_axisValues[axis] = newValue;
|
||||
}
|
||||
|
@ -250,9 +253,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
foreach (var ie in _newEvents)
|
||||
{
|
||||
//events are swallowed in some cases:
|
||||
if ((ie.LogicalButton.Modifiers & LogicalButton.MASK_ALT) is not 0U && ShouldSwallow(MainFormInputAllowedCallback(true), ie))
|
||||
if ((ie.LogicalButton.Modifiers & LogicalButton.MASK_ALT) is not 0U && ShouldSwallow(MainFormInputAllowedCallback(true), ie.Source))
|
||||
continue;
|
||||
if (ie.EventType == InputEventType.Press && ShouldSwallow(allowInput, ie))
|
||||
if (ie.EventType == InputEventType.Press && ShouldSwallow(allowInput, ie.Source))
|
||||
continue;
|
||||
|
||||
EnqueueEvent(ie);
|
||||
|
@ -267,9 +270,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private static bool ShouldSwallow(AllowInput allowInput, InputEvent inputEvent)
|
||||
private static bool ShouldSwallow(AllowInput allowInput, ClientInputFocus inputFocus)
|
||||
{
|
||||
return allowInput == AllowInput.None || (allowInput == AllowInput.OnlyController && inputEvent.Source != ClientInputFocus.Pad);
|
||||
return allowInput == AllowInput.None || (allowInput == AllowInput.OnlyController && inputFocus != ClientInputFocus.Pad);
|
||||
}
|
||||
|
||||
public void StartListeningForAxisEvents()
|
||||
|
@ -326,7 +329,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
InputEvent ie = DequeueEvent();
|
||||
|
||||
if (ShouldSwallow(allowInput, ie)) continue;
|
||||
if (ShouldSwallow(allowInput, ie.Source)) continue;
|
||||
|
||||
if (ie.EventType == InputEventType.Press)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue