mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 05:35:38 +00:00
Release both shift keys when one is released. Otherwise, we end up with stuck keys.
This commit is contained in:
parent
666355103b
commit
d65e0aad47
|
@ -361,11 +361,12 @@ namespace OpenTK.Platform.Windows
|
||||||
// The behavior of this key is very strange. Unlike Control and Alt, there is no extended bit
|
// The behavior of this key is very strange. Unlike Control and Alt, there is no extended bit
|
||||||
// to distinguish between left and right keys. Moreover, pressing both keys and releasing one
|
// to distinguish between left and right keys. Moreover, pressing both keys and releasing one
|
||||||
// may result in both keys being held down (but not always).
|
// may result in both keys being held down (but not always).
|
||||||
// The only reliably way to solve this was reported by BlueMonkMN at the forums: we should
|
// The only reliable way to solve this was reported by BlueMonkMN at the forums: we should
|
||||||
// check the scancodes. It looks like GLFW does the same thing, so it should be reliable.
|
// check the scancodes. It looks like GLFW does the same thing, so it should be reliable.
|
||||||
|
|
||||||
// TODO: Not 100% reliable, when both keys are pressed at once.
|
// Note: we release both keys when either shift is released.
|
||||||
if (ShiftRightScanCode != 0)
|
// Otherwise, the state of one key might be stuck to pressed.
|
||||||
|
if (ShiftRightScanCode != 0 && pressed)
|
||||||
{
|
{
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
|
@ -377,8 +378,8 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Should only fall here on Windows 9x and NT4.0-
|
// Windows 9x and NT4.0 or key release event.
|
||||||
keyboard[Input.Key.ShiftLeft] = pressed;
|
keyboard[Input.Key.ShiftLeft] = keyboard[Input.Key.ShiftRight] = pressed;
|
||||||
}
|
}
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue