mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-03 00:20:59 +00:00
Fixed erroneous KeyUp events when the window loses the focus.
This commit is contained in:
parent
03269ead9c
commit
102fe0039c
|
@ -50,16 +50,12 @@ namespace OpenTK.Input
|
||||||
keys[(int)key] = value;
|
keys[(int)key] = value;
|
||||||
|
|
||||||
if (value && KeyDown != null)
|
if (value && KeyDown != null)
|
||||||
{
|
|
||||||
KeyDown(this, key);
|
KeyDown(this, key);
|
||||||
}
|
|
||||||
else if (!value && KeyUp != null)
|
else if (!value && KeyUp != null)
|
||||||
{
|
|
||||||
KeyUp(this, key);
|
KeyUp(this, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an integer representing the number of keys on this KeyboardDevice.
|
/// Gets an integer representing the number of keys on this KeyboardDevice.
|
||||||
|
@ -188,6 +184,7 @@ namespace OpenTK.Input
|
||||||
internal void ClearKeys()
|
internal void ClearKeys()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)Key.MaxKeys; i++)
|
for (int i = 0; i < (int)Key.MaxKeys; i++)
|
||||||
|
if (this[(Key)i]) // Make sure KeyUp events are *not* raised for keys that are up, even if key repeat is on.
|
||||||
this[(Key)i] = false;
|
this[(Key)i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue