From 8c0c31a0e918d427ceba46b6f82055d1a6727921 Mon Sep 17 00:00:00 2001 From: Simon Tatham <anakin@pobox.com> Date: Tue, 7 Nov 2000 17:50:59 +0000 Subject: [PATCH] Software invocation of the System menu now pops up the actual menu, rather than just putting the window into the state where Down will do so [originally from svn r793] --- window.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/window.c b/window.c index e2e7ffb4..ea898e92 100644 --- a/window.c +++ b/window.c @@ -2029,7 +2029,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, return -1; } if (left_alt && wParam == VK_SPACE && cfg.alt_space) { - + PostMessage(hwnd, WM_CHAR, ' ', 0); SendMessage (hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0); return -1; } @@ -2302,9 +2302,17 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, } } - /* This stops ALT press-release doing a 'COMMAND MENU' function */ - if (!cfg.alt_only) { - if (message == WM_SYSKEYUP && wParam == VK_MENU) + /* 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) + PostMessage(hwnd, WM_CHAR, ' ', 0); + if (message == WM_SYSKEYUP) + alt_state = 0; + } else return 0; }