summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-04-27 21:27:02 +0000
committerglx <glx@openttd.org>2007-04-27 21:27:02 +0000
commit75ba8f4489bce6ff017fd45bd387c87b37f7e8d4 (patch)
treefad2bec91c31d1456d31c744fc57433cb4ec44fe /src/video
parentb02623901a25c35f65c6976f8c658b30f80106a8 (diff)
downloadopenttd-75ba8f4489bce6ff017fd45bd387c87b37f7e8d4.tar.xz
(svn r9728) -Fix r9086: [win32] For some keyboard layout the 'console' key is a dead-key. It needs to be pressed twice to have an effect but the console is then opened and closed on the 'same' keypress (2 WM_CHAR events). So skip the first WM_CHAR generated to restore the 'console' key functionality.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/win32_v.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 3f5df2147..578f323c9 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -212,6 +212,7 @@ static void CALLBACK TrackMouseTimerProc(HWND hwnd, UINT msg, UINT event, DWORD
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static uint32 keycode = 0;
+ static bool console = false;
switch (msg) {
case WM_CREATE:
@@ -363,12 +364,23 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
#endif /* UNICODE */
+ case WM_DEADCHAR:
+ console = GB(lParam, 16, 8) == 41;
+ 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;
+ /* If the console key is a dead-key, we need to press it twice to get a WM_CHAR message.
+ * But we then get two WM_CHAR messages, so ignore the first one */
+ if (console && scancode == 41) {
+ console = false;
+ return 0;
+ }
+
#if !defined(UNICODE)
wchar_t w;
int len = MultiByteToWideChar(_codepage, 0, (char*)&charcode, 1, &w, 1);