UI tweak from Malcolm Rowe: set IDM_VIEWKEYS as the default menu item and use
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sat, 20 Nov 2004 18:29:58 +0000 (18:29 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sat, 20 Nov 2004 18:29:58 +0000 (18:29 +0000)
that mechanism to invoke it on double-click; this emboldens it in the right-
click menu.

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

windows/winpgnt.c

index 1c34d71..209c7c6 100644 (file)
@@ -1737,8 +1737,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
            GetCursorPos(&cursorpos);
            PostMessage(hwnd, WM_SYSTRAY2, cursorpos.x, cursorpos.y);
        } else if (lParam == WM_LBUTTONDBLCLK) {
-           /* Equivalent to IDM_VIEWKEYS. */
-           PostMessage(hwnd, WM_COMMAND, IDM_VIEWKEYS, 0);
+           /* Run the default menu item. */
+           UINT menuitem = GetMenuDefaultItem(systray_menu, FALSE, 0);
+           if (menuitem != -1)
+               PostMessage(hwnd, WM_COMMAND, menuitem, 0);
        }
        break;
       case WM_SYSTRAY2:
@@ -2116,6 +2118,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
         AppendMenu(systray_menu, MF_ENABLED, IDM_CLOSE, "E&xit");
        initial_menuitems_count = GetMenuItemCount(session_menu);
 
+       /* Set the default menu item. */
+       SetMenuDefaultItem(systray_menu, IDM_VIEWKEYS, FALSE);
+
        ShowWindow(main_hwnd, SW_HIDE);
 
        /*