summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-09-20 16:07:56 +0000
committerglx <glx@openttd.org>2008-09-20 16:07:56 +0000
commit8b0d8589e38a49254c5e129f814f65d6650f563d (patch)
treedaf35c3653de1e28fef96b472ab7ab546fd5d948 /src/video
parent6782d81142929f96eb3ea871d1f8ef3eef69f65e (diff)
downloadopenttd-8b0d8589e38a49254c5e129f814f65d6650f563d.tar.xz
(svn r14363) -Fix [FS#2206]: some keypress combinations could be handled twice
Diffstat (limited to 'src/video')
-rw-r--r--src/video/win32_v.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 6eb9a0fc6..2bbb96c63 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -464,8 +464,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
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 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
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;