From 170a75b5209a60dd0e4e30515c7a30053e58005c Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 7 Jan 2001 19:15:59 +0000 Subject: [PATCH] Fix for spurious Space getting sent when alt_space and alt_only are both set and you bring up the Sysmenu with an alt_space and dispatch it with an alt_only. (The SYSKEYDOWN for alt_only is never received, but we get the SYSKEYUP which PostMessages the space since it expects to be triggering the _creation_ of a sysmenu. Solution: set alt_state to 0 when an alt_space triggers a sysmenu, so that the final SYSKEYUP will be seen as spurious, which it is. Perhaps we could do this better.) [originally from svn r848] --- window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/window.c b/window.c index b2bd490a..99b374d4 100644 --- a/window.c +++ b/window.c @@ -1889,6 +1889,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, int scan, left_alt = 0, key_down, shift_state; int r, i, code; unsigned char * p = output; + static int alt_state = 0; HKL kbd_layout = GetKeyboardLayout(0); @@ -2085,6 +2086,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, return -1; } if (left_alt && wParam == VK_SPACE && cfg.alt_space) { + alt_state = 0; PostMessage(hwnd, WM_CHAR, ' ', 0); SendMessage (hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0); return -1; @@ -2361,7 +2363,6 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, /* ALT alone may or may not want to bring up the System menu */ if (wParam == VK_MENU) { if (cfg.alt_only) { - static int alt_state = 0; if (message == WM_SYSKEYDOWN) alt_state = 1; else if (message == WM_SYSKEYUP && alt_state)