1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-12 18:13:50 -05:00

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]
This commit is contained in:
Simon Tatham 2001-01-07 19:15:59 +00:00
parent 0026e5ada7
commit 170a75b520

View File

@ -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)