mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:42:57 +00:00
[NTUSER] Fix double click on title bar icon not closing window (#6697)
Patch by @I_Kill_Bugs
* [NTUSER] Fix double click on title bar icon not closing window
Improve MENU_TrackMenu handling.
Guilty commit:0.4.15-dev-7750-gc17a654 c17a6542ac
CORE-19492
This commit is contained in:
parent
0c0062ac9a
commit
cf9f7548d5
1 changed files with 29 additions and 9 deletions
|
@ -4052,6 +4052,8 @@ static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y,
|
||||||
HWND capture_win;
|
HWND capture_win;
|
||||||
PMENU pmMouse;
|
PMENU pmMouse;
|
||||||
BOOL enterIdleSent = FALSE;
|
BOOL enterIdleSent = FALSE;
|
||||||
|
BOOL firstClick = TRUE;
|
||||||
|
PWND pWnd;
|
||||||
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if (pti != pwnd->head.pti)
|
if (pti != pwnd->head.pti)
|
||||||
|
@ -4177,13 +4179,21 @@ static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y,
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
|
{
|
||||||
/* If the message belongs to the menu, removes it from the queue */
|
/* If the message belongs to the menu, removes it from the queue */
|
||||||
/* Else, end menu tracking */
|
/* Else, end menu tracking */
|
||||||
fRemove = MENU_ButtonDown(&mt, pmMouse, wFlags);
|
pWnd = ValidateHwndNoErr(mt.TopMenu->hWnd);
|
||||||
|
/* Don't remove WM_LBUTTONDBLCLK to allow the closing of a window or program */
|
||||||
|
if (msg.message == WM_LBUTTONDBLCLK && GetNCHitEx(pWnd, mt.Pt) == HTSYSMENU)
|
||||||
|
fRemove = FALSE;
|
||||||
|
else
|
||||||
|
fRemove = MENU_ButtonDown(&mt, pmMouse, wFlags);
|
||||||
|
|
||||||
fInsideMenuLoop = fRemove;
|
fInsideMenuLoop = fRemove;
|
||||||
if ( msg.message == WM_LBUTTONDBLCLK ||
|
if (msg.message == WM_RBUTTONDBLCLK)
|
||||||
msg.message == WM_RBUTTONDBLCLK ) fInsideMenuLoop = FALSE; // Must exit or loop forever!
|
fInsideMenuLoop = FALSE; // Must exit or loop forever
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
if (!(wFlags & TPM_RIGHTBUTTON)) break;
|
if (!(wFlags & TPM_RIGHTBUTTON)) break;
|
||||||
|
@ -4192,12 +4202,22 @@ static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y,
|
||||||
/* Check if a menu was selected by the mouse */
|
/* Check if a menu was selected by the mouse */
|
||||||
if (pmMouse)
|
if (pmMouse)
|
||||||
{
|
{
|
||||||
executedMenuId = MENU_ButtonUp( &mt, pmMouse, wFlags);
|
pWnd = ValidateHwndNoErr(mt.TopMenu->hWnd);
|
||||||
|
/* Exit system menu if system icon is clicked a second time */
|
||||||
/* End the loop if executedMenuId is an item ID */
|
if (!firstClick && GetNCHitEx(pWnd, mt.Pt) == HTSYSMENU)
|
||||||
/* or if the job was done (executedMenuId = 0). */
|
{
|
||||||
fRemove = (executedMenuId != -1);
|
fRemove = TRUE;
|
||||||
fInsideMenuLoop = !fRemove;
|
fInsideMenuLoop = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* End the loop if executedMenuId is an item ID */
|
||||||
|
/* or if the job was done (executedMenuId = 0). */
|
||||||
|
executedMenuId = MENU_ButtonUp( &mt, pmMouse, wFlags);
|
||||||
|
fRemove = (executedMenuId != -1);
|
||||||
|
fInsideMenuLoop = !fRemove;
|
||||||
|
firstClick = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* No menu was selected by the mouse */
|
/* No menu was selected by the mouse */
|
||||||
/* if the function was called by TrackPopupMenu, continue
|
/* if the function was called by TrackPopupMenu, continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue