mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 17:55:31 +00:00
* Platform/MacOS/CarbonGLNative.cs:
Fixed handling of key repeat. Fixed crash when unknown key is pressed.
This commit is contained in:
parent
455acac6f8
commit
5b3c08f463
|
@ -369,25 +369,37 @@ namespace OpenTK.Platform.MacOS
|
||||||
switch (evt.KeyboardEventKind)
|
switch (evt.KeyboardEventKind)
|
||||||
{
|
{
|
||||||
case KeyboardEventKind.RawKeyRepeat:
|
case KeyboardEventKind.RawKeyRepeat:
|
||||||
InputDriver.Keyboard[0].KeyRepeat = true;
|
if (InputDriver.Keyboard[0].KeyRepeat)
|
||||||
goto case KeyboardEventKind.RawKeyDown;
|
goto case KeyboardEventKind.RawKeyDown;
|
||||||
|
break;
|
||||||
|
|
||||||
case KeyboardEventKind.RawKeyDown:
|
case KeyboardEventKind.RawKeyDown:
|
||||||
OnKeyPress(mKeyPressArgs);
|
{
|
||||||
InputDriver.Keyboard[0][Keymap[code]] = true;
|
OpenTK.Input.Key key;
|
||||||
|
if (Keymap.TryGetValue(code, out key))
|
||||||
|
{
|
||||||
|
InputDriver.Keyboard[0][key] = true;
|
||||||
|
OnKeyPress(mKeyPressArgs);
|
||||||
|
}
|
||||||
return OSStatus.NoError;
|
return OSStatus.NoError;
|
||||||
|
}
|
||||||
|
|
||||||
case KeyboardEventKind.RawKeyUp:
|
case KeyboardEventKind.RawKeyUp:
|
||||||
InputDriver.Keyboard[0][Keymap[code]] = false;
|
{
|
||||||
|
OpenTK.Input.Key key;
|
||||||
|
if (Keymap.TryGetValue(code, out key))
|
||||||
|
{
|
||||||
|
InputDriver.Keyboard[0][key] = false;
|
||||||
|
}
|
||||||
return OSStatus.NoError;
|
return OSStatus.NoError;
|
||||||
|
}
|
||||||
|
|
||||||
case KeyboardEventKind.RawKeyModifiersChanged:
|
case KeyboardEventKind.RawKeyModifiersChanged:
|
||||||
ProcessModifierKey(inEvent);
|
ProcessModifierKey(inEvent);
|
||||||
return OSStatus.NoError;
|
return OSStatus.NoError;
|
||||||
|
|
||||||
default:
|
|
||||||
return OSStatus.EventNotHandled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return OSStatus.EventNotHandled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OSStatus ProcessWindowEvent(IntPtr inCaller, IntPtr inEvent, EventInfo evt, IntPtr userData)
|
private OSStatus ProcessWindowEvent(IntPtr inCaller, IntPtr inEvent, EventInfo evt, IntPtr userData)
|
||||||
|
|
Loading…
Reference in a new issue