mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-16 03:53:01 -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:
parent
0026e5ada7
commit
170a75b520
3
window.c
3
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 scan, left_alt = 0, key_down, shift_state;
|
||||||
int r, i, code;
|
int r, i, code;
|
||||||
unsigned char * p = output;
|
unsigned char * p = output;
|
||||||
|
static int alt_state = 0;
|
||||||
|
|
||||||
HKL kbd_layout = GetKeyboardLayout(0);
|
HKL kbd_layout = GetKeyboardLayout(0);
|
||||||
|
|
||||||
@ -2085,6 +2086,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (left_alt && wParam == VK_SPACE && cfg.alt_space) {
|
if (left_alt && wParam == VK_SPACE && cfg.alt_space) {
|
||||||
|
alt_state = 0;
|
||||||
PostMessage(hwnd, WM_CHAR, ' ', 0);
|
PostMessage(hwnd, WM_CHAR, ' ', 0);
|
||||||
SendMessage (hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0);
|
SendMessage (hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0);
|
||||||
return -1;
|
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 */
|
/* ALT alone may or may not want to bring up the System menu */
|
||||||
if (wParam == VK_MENU) {
|
if (wParam == VK_MENU) {
|
||||||
if (cfg.alt_only) {
|
if (cfg.alt_only) {
|
||||||
static int alt_state = 0;
|
|
||||||
if (message == WM_SYSKEYDOWN)
|
if (message == WM_SYSKEYDOWN)
|
||||||
alt_state = 1;
|
alt_state = 1;
|
||||||
else if (message == WM_SYSKEYUP && alt_state)
|
else if (message == WM_SYSKEYUP && alt_state)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user