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