From 0052ff435e8a3bf48aef0ea04a49ea471c1d0d44 Mon Sep 17 00:00:00 2001 From: "Stefanos A." Date: Thu, 13 Feb 2014 14:01:35 +0100 Subject: [PATCH] [Win] Do not raise KeyPress for control chars This matches the documented behavior of the GameWindow.KeyPress event. --- Source/OpenTK/Platform/Windows/WinGLNative.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 79b37605..53d498bb 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -389,12 +389,17 @@ namespace OpenTK.Platform.Windows void HandleChar(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam) { + char c; if (IntPtr.Size == 4) - key_press.KeyChar = (char)wParam.ToInt32(); + c = (char)wParam.ToInt32(); else - key_press.KeyChar = (char)wParam.ToInt64(); + c = (char)wParam.ToInt64(); - KeyPress(this, key_press); + if (!Char.IsControl(c)) + { + key_press.KeyChar = c; + KeyPress(this, key_press); + } } void HandleMouseMove(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lParam)