[X11] Implemented modifier keys

This commit is contained in:
thefiddler 2014-02-17 23:21:25 +01:00
parent 9ba21d6017
commit ee1fb2a917

View file

@ -849,11 +849,15 @@ namespace OpenTK.Platform.X11
Key key;
if (driver.TranslateKey(ref e.KeyEvent, out key))
{
// Update legacy GameWindow.Keyboard API:
keyboard.SetKey(key, (uint)e.KeyEvent.keycode, pressed);
if (pressed)
{
// Raise KeyDown event
KeyDownEventArgs.Key = key;
KeyDownEventArgs.ScanCode = (uint)e.KeyEvent.keycode;
KeyDownEventArgs.Modifiers = keyboard.GetModifiers();
KeyDown(this, KeyDownEventArgs);
}
else
@ -861,12 +865,10 @@ namespace OpenTK.Platform.X11
// Raise KeyUp event
KeyUpEventArgs.Key = key;
KeyUpEventArgs.ScanCode = (uint)e.KeyEvent.keycode;
KeyUpEventArgs.Modifiers = keyboard.GetModifiers();
KeyUp(this, KeyDownEventArgs);
}
// Update legacy GameWindow.Keyboard API:
keyboard.SetKey(key, (uint)e.KeyEvent.keycode, pressed);
if (pressed)
{
// Translate XKeyPress to characters and