Software invocation of the System menu now pops up the actual menu, rather
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 7 Nov 2000 17:50:59 +0000 (17:50 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 7 Nov 2000 17:50:59 +0000 (17:50 +0000)
than just putting the window into the state where Down will do so

git-svn-id: svn://svn.tartarus.org/sgt/putty@793 cda61777-01e9-0310-a592-d414129be87e

window.c

index e2e7ffb..ea898e9 100644 (file)
--- 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;
     }