Skip to content

Commit

Permalink
[X11] Implemented modifier keys
Browse files Browse the repository at this point in the history
  • Loading branch information
thefiddler committed Feb 25, 2014
1 parent 9ba21d6 commit ee1fb2a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Source/OpenTK/Platform/X11/X11GLNative.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -849,24 +849,26 @@ public void ProcessEvents()
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
{ {
// 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
Expand Down

0 comments on commit ee1fb2a

Please sign in to comment.