https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6417b2323d7ef74dc4c7b8...
commit 6417b2323d7ef74dc4c7b8319d48e8932c50d588 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Sun Oct 24 05:29:39 2021 +0900 Commit: GitHub noreply@github.com CommitDate: Sat Oct 23 22:29:39 2021 +0200
[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 58b0558f94abee52ce1c261063d4f4b884e96310 And fixes CORE-15760 which got unhidden by SVN r74972 == git 19dd22d42218da03ab748879aa3c3e288f41697e
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. --- win32ss/user/ntuser/menu.c | 2 +- win32ss/user/user32/windows/defwnd.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c index 71a52b94b40..3c006fcd5a6 100644 --- a/win32ss/user/ntuser/menu.c +++ b/win32ss/user/ntuser/menu.c @@ -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. diff --git a/win32ss/user/user32/windows/defwnd.c b/win32ss/user/user32/windows/defwnd.c index 9a2272d3c89..b7a624061e3 100644 --- a/win32ss/user/user32/windows/defwnd.c +++ b/win32ss/user/user32/windows/defwnd.c @@ -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; }