A couple of menu fixes
Dmitry Timoshkov
dmitry at baikal.ru
Mon Sep 20 05:03:47 CDT 2004
Hello,
this patch fixes 2 problems with menu tracking:
1. menu navigation keys do not work when there is no focus window,
i.e. menu code does not handle WM_SYSKEY*/WM_SYSCHAR messages.
2. when a window owning a menu is being destroyed its menu loop
never unblocks. Pietrek's book mentions that it's the responsibility
of DestroyWindow to call EndMenu() in that case.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
- Make menu code cope with WM_SYSKEY*/WM_SYSCHAR messages.
- Unblock menu loop if a window being destroyed owns a tracked menu.
diff -u cvs/hq/wine/dlls/user/controls.h wine/dlls/user/controls.h
--- cvs/hq/wine/dlls/user/controls.h 2004-09-02 17:23:55.000000000 +0900
+++ wine/dlls/user/controls.h 2004-09-20 17:08:40.000000000 +0900
@@ -54,7 +54,7 @@ extern HWND ICONTITLE_Create( HWND hwnd
/* menu controls */
extern BOOL MENU_Init(void);
-extern BOOL MENU_IsMenuActive(void);
+extern HWND MENU_IsMenuActive(void);
extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
INT orgX, INT orgY );
diff -u cvs/hq/wine/dlls/user/menu.c wine/dlls/user/menu.c
--- cvs/hq/wine/dlls/user/menu.c 2004-09-20 14:26:51.000000000 +0900
+++ wine/dlls/user/menu.c 2004-09-20 17:08:40.000000000 +0900
@@ -2010,9 +2010,9 @@ static HMENU MENU_ShowSubPopup( HWND hwn
/**********************************************************************
* MENU_IsMenuActive
*/
-BOOL MENU_IsMenuActive(void)
+HWND MENU_IsMenuActive(void)
{
- return (top_popup != 0);
+ return top_popup;
}
/***********************************************************************
@@ -2690,8 +2690,13 @@ static BOOL MENU_TrackMenu( HMENU hmenu,
switch(msg.message)
{
case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
switch(msg.wParam)
{
+ case VK_MENU:
+ fEndMenu = TRUE;
+ break;
+
case VK_HOME:
case VK_END:
MENU_SelectItem( mt.hOwnerWnd, mt.hCurrentMenu,
@@ -2744,17 +2749,8 @@ static BOOL MENU_TrackMenu( HMENU hmenu,
}
break; /* WM_KEYDOWN */
- case WM_SYSKEYDOWN:
- switch(msg.wParam)
- {
- case VK_MENU:
- fEndMenu = TRUE;
- break;
-
- }
- break; /* WM_SYSKEYDOWN */
-
case WM_CHAR:
+ case WM_SYSCHAR:
{
UINT pos;
diff -u cvs/hq/wine/windows/win.c wine/windows/win.c
--- cvs/hq/wine/windows/win.c 2004-09-16 13:00:10.000000000 +0900
+++ wine/windows/win.c 2004-09-20 17:09:15.000000000 +0900
@@ -1439,6 +1439,9 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
if (HOOK_CallHooks( WH_CBT, HCBT_DESTROYWND, (WPARAM)hwnd, 0, TRUE )) return FALSE;
+ if (MENU_IsMenuActive() == hwnd)
+ EndMenu();
+
is_child = (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD) != 0;
if (is_child)
More information about the wine-patches
mailing list