(svn r14363) -Fix [FS#2206]: some keypress combinations could be handled twice
authorglx
Sat, 20 Sep 2008 16:07:56 +0000
changeset 10171 0ca7a9147b95
parent 10170 65c0029018d0
child 10172 dba313cad70f
(svn r14363) -Fix [FS#2206]: some keypress combinations could be handled twice
src/video/win32_v.cpp
--- a/src/video/win32_v.cpp	Sat Sep 20 10:53:08 2008 +0000
+++ b/src/video/win32_v.cpp	Sat Sep 20 16:07:56 2008 +0000
@@ -464,8 +464,6 @@
 			return 0;
 
 		case WM_CHAR: {
-			/* Silently drop all non-text messages as those were handled by WM_KEYDOWN */
-			if (wParam < VK_SPACE) return 0;
 			uint scancode = GB(lParam, 16, 8);
 			uint charcode = wParam;
 
@@ -491,12 +489,13 @@
 		case WM_KEYDOWN: {
 			keycode = MapWindowsKey(wParam);
 
-			/* Silently drop all text messages as those will be handled by WM_CHAR
-			 * WM_KEYDOWN only handles CTRL+ commands and special keys like VK_LEFT, etc. */
-			if (keycode == 0 || (keycode > WKC_PAUSE && GB(keycode, 13, 4) == 0)) return 0;
-
-			/* Keys handled in WM_CHAR */
-			if ((uint)(GB(keycode, 0, 12) - WKC_NUM_DIV) <= WKC_MINUS - WKC_NUM_DIV) return 0;
+			/* Silently drop all messages handled by WM_CHAR. */
+			MSG msg;
+			if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
+				if (msg.message == WM_CHAR && GB(lParam, 16, 8) == GB(msg.lParam, 16, 8)) {
+					return 0;
+				}
+			}
 
 			HandleKeypress(0 | (keycode << 16));
 			return 0;