forked from Mirror/Ryujinx
Accept gamepad inputs when not focused (#941)
This commit is contained in:
parent
4789f79254
commit
91b37ae36e
1 changed files with 21 additions and 20 deletions
|
@ -323,10 +323,7 @@ namespace Ryujinx.Ui
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFocused)
|
|
||||||
{
|
|
||||||
UpdateFrame();
|
UpdateFrame();
|
||||||
}
|
|
||||||
|
|
||||||
// Polling becomes expensive if it's not slept
|
// Polling becomes expensive if it's not slept
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
|
@ -351,6 +348,14 @@ namespace Ryujinx.Ui
|
||||||
JoystickPosition rightJoystick;
|
JoystickPosition rightJoystick;
|
||||||
HLE.Input.Keyboard? hidKeyboard = null;
|
HLE.Input.Keyboard? hidKeyboard = null;
|
||||||
|
|
||||||
|
int leftJoystickDx = 0;
|
||||||
|
int leftJoystickDy = 0;
|
||||||
|
int rightJoystickDx = 0;
|
||||||
|
int rightJoystickDy = 0;
|
||||||
|
|
||||||
|
// OpenTK always captures keyboard events, even if out of focus, so check if window is focused.
|
||||||
|
if (IsFocused)
|
||||||
|
{
|
||||||
KeyboardState keyboard = OpenTK.Input.Keyboard.GetState();
|
KeyboardState keyboard = OpenTK.Input.Keyboard.GetState();
|
||||||
|
|
||||||
Gtk.Application.Invoke(delegate
|
Gtk.Application.Invoke(delegate
|
||||||
|
@ -358,11 +363,6 @@ namespace Ryujinx.Ui
|
||||||
HandleScreenState(keyboard);
|
HandleScreenState(keyboard);
|
||||||
});
|
});
|
||||||
|
|
||||||
int leftJoystickDx = 0;
|
|
||||||
int leftJoystickDy = 0;
|
|
||||||
int rightJoystickDx = 0;
|
|
||||||
int rightJoystickDy = 0;
|
|
||||||
|
|
||||||
// Normal Input
|
// Normal Input
|
||||||
currentHotkeyButtons = KeyboardControls.GetHotkeyButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
currentHotkeyButtons = KeyboardControls.GetHotkeyButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
||||||
currentButton = KeyboardControls.GetButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
currentButton = KeyboardControls.GetButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
||||||
|
@ -374,6 +374,7 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
(leftJoystickDx, leftJoystickDy) = KeyboardControls.GetLeftStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
(leftJoystickDx, leftJoystickDy) = KeyboardControls.GetLeftStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
||||||
(rightJoystickDx, rightJoystickDy) = KeyboardControls.GetRightStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
(rightJoystickDx, rightJoystickDy) = KeyboardControls.GetRightStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
|
||||||
|
}
|
||||||
|
|
||||||
if (!hidKeyboard.HasValue)
|
if (!hidKeyboard.HasValue)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue