Commit b200793d authored by Rob Farnum's avatar Rob Farnum Committed by Alexandre Julliard

Post a WM_CANCELMODE message to wake up the internal menu handling

code. This fixes the problem of a menu being orphaned when the parent window disappears, or if the parent loses focus.
parent 410617fe
......@@ -2725,6 +2725,19 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
if (!MSG_InternalGetMessage( QMSG_WIN32A, &msg, msg.hwnd, mt.hOwnerWnd,
MSGF_MENU, PM_NOREMOVE, !enterIdleSent, &enterIdleSent )) break;
/* check if EndMenu() tried to cancel us, by posting this message */
if(msg.message == WM_CANCELMODE)
{
/* we are now out of the loop */
fEndMenu = TRUE;
/* remove the message from the queue */
PeekMessageA( &msg, 0, msg.message, msg.message, PM_REMOVE );
/* break out of internal loop, ala ESCAPE */
break;
}
TranslateMessage( &msg );
mt.pt = msg.pt;
......@@ -4157,11 +4170,18 @@ BOOL WINAPI DrawMenuBar( HWND hWnd )
*/
void WINAPI EndMenu(void)
{
/*
* FIXME: NOT ENOUGH! This has to cancel menu tracking right away.
*/
fEndMenu = TRUE;
/* if we are in the menu code, and it is active */
if (fEndMenu == FALSE && MENU_IsMenuActive())
{
/* terminate the menu handling code */
fEndMenu = TRUE;
/* needs to be posted to wakeup the internal menu handler */
/* which will now terminate the menu, in the event that */
/* the main window was minimized, or lost focus, so we */
/* don't end up with an orphaned menu */
PostMessageA( pTopPopupWnd->hwndSelf, WM_CANCELMODE, 0, 0);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment