Permalink
Browse files

[Win] Do not raise KeyPress for control chars

This matches the documented behavior of the GameWindow.KeyPress event.
  • Loading branch information...
1 parent 1c1607d commit 0052ff435e8a3bf48aef0ea04a49ea471c1d0d44 @thefiddler thefiddler committed Feb 13, 2014
Showing with 8 additions and 3 deletions.
  1. +8 −3 Source/OpenTK/Platform/Windows/WinGLNative.cs
@@ -389,12 +389,17 @@ void HandleSize(IntPtr handle, WindowMessage message, IntPtr wParam, IntPtr lPar
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)

0 comments on commit 0052ff4

Please sign in to comment.