[NTUSER][USER32] Workaround tracking menu on CORE-17338 (#4048)

This prevents the tracking menu from erroneously closing itself right after it was opened in some cases.
Fixes CORE-17338 which got unhidden by 0.4.15-dev-1126-g 58b0558f94
And fixes CORE-15760 which got unhidden by SVN r74972 == git 19dd22d422

Since both symptoms look very similar but the unhiding revisions did differ,
that could mean we do have some kind of race condition here.
I guess this fix is more like a workaround. I do intend to port it back nevertheless.
This commit is contained in:
Katayama Hirofumi MZ 2021-10-24 05:29:39 +09:00 committed by GitHub
parent fdb4205061
commit 6417b2323d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -4118,7 +4118,7 @@ static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y,
/* ReactOS Checks */
if (!VerifyWnd(mt.OwnerWnd) ||
!ValidateHwndNoErr(mt.CurrentMenu->hWnd) ||
pti->MessageQueue->QF_flags & QF_ACTIVATIONCHANGE ||
//pti->MessageQueue->QF_flags & QF_ACTIVATIONCHANGE || // See CORE-17338
capture_win != IntGetCapture() ) // Should not happen, but this is ReactOS...
{
ErrorExit = TRUE; // Do not wait on dead windows, now win test_capture_4 works.

View file

@ -338,8 +338,11 @@ User32DefWindowProc(HWND hWnd,
HMENU menu = GetSystemMenu(hWnd, FALSE);
ERR("WM_POPUPSYSTEMMENU\n");
if (menu)
{
SetForegroundWindow(hWnd);
TrackPopupMenu(menu, TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_SYSTEM_MENU,
LOWORD(lParam), HIWORD(lParam), 0, hWnd, NULL);
}
return 0;
}