From 0c990583a3a9d99917d66cee3658d6434bab2554 Mon Sep 17 00:00:00 2001 From: "Stefanos A." Date: Sat, 21 Dec 2013 00:50:25 +0100 Subject: [PATCH] Implemented KeyDown and KeyUp messages --- Source/OpenTK/Platform/Windows/WinGLNative.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 6125ffd3..48f7c4b1 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -98,6 +98,8 @@ namespace OpenTK.Platform.Windows public static readonly uint AltLeftScanCode = Functions.MapVirtualKey(VirtualKeys.LMENU, 0); public static readonly uint AltRightScanCode = Functions.MapVirtualKey(VirtualKeys.RMENU, 0); + KeyboardKeyEventArgs key_down = new KeyboardKeyEventArgs(); + KeyboardKeyEventArgs key_up = new KeyboardKeyEventArgs(); KeyPressEventArgs key_press = new KeyPressEventArgs((char)0); int cursor_visible_count = 0; @@ -485,6 +487,18 @@ namespace OpenTK.Platform.Windows if (is_valid) { keyboard.SetKey(key, (byte)scancode, pressed); + + if (pressed) + { + key_down.Key = key; + KeyDown(this, key_down); + } + else + { + key_up.Key = key; + KeyUp(this, key_up); + } + } return IntPtr.Zero; -- 2.34.1