From 69cfe6b56a5ffcf52b5ead0ae9dd971426729f29 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 26 Sep 2009 21:56:42 +0000 Subject: [PATCH] Raise KeyPress events (handle WindowsMessage.CHAR message). --- Source/OpenTK/Platform/Windows/WinGLNative.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 6f33039d..56a74d4e 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -80,6 +80,8 @@ namespace OpenTK.Platform.Windows const long ExtendedBit = 1 << 24; // Used to distinguish left and right control, alt and enter keys. static readonly uint ShiftRightScanCode = Functions.MapVirtualKey(VirtualKeys.RSHIFT, 0); // Used to distinguish left and right shift keys. + KeyPressEventArgs key_press = new KeyPressEventArgs((char)0); + #endregion #region Contructors @@ -217,6 +219,16 @@ namespace OpenTK.Platform.Windows #region Input events + case WindowMessage.CHAR: + if (IntPtr.Size == 4) + key_press.KeyChar = (char)wParam.ToInt32(); + else + key_press.KeyChar = (char)wParam.ToInt64(); + + if (KeyPress != null) + KeyPress(this, key_press); + break; + //case WindowMessage.MOUSELEAVE: // Cursor.Current = Cursors.Default; // break;