https://git.reactos.org/?p=reactos.git;a=commitdiff;h=037c744eb15e464c0d92e3...
commit 037c744eb15e464c0d92e352e00260100c785979 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Tue Oct 19 07:17:01 2021 +0900 Commit: GitHub noreply@github.com CommitDate: Tue Oct 19 07:17:01 2021 +0900
[EXPLORER] Send WM_POPUPSYSTEMMENU asynchronously (#4047)
- Delete useless SendMessageTimeout:WM_NULL call. - Add useful SendMessageCallbackW:WM_POPUPSYSTEMMENU call. - In the callback function of SendMessageCallbackW, do PostMessageW:WM_NULL to properly handle the popup menu. CORE-16353 --- base/shell/explorer/taskswnd.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/base/shell/explorer/taskswnd.cpp b/base/shell/explorer/taskswnd.cpp index 5d90d36ebc3..d6e6d2a97ac 100644 --- a/base/shell/explorer/taskswnd.cpp +++ b/base/shell/explorer/taskswnd.cpp @@ -1630,6 +1630,11 @@ public: return FALSE; }
+ static VOID CALLBACK + SendAsyncProc(HWND hwnd, UINT uMsg, DWORD_PTR dwData, LRESULT lResult) + { + ::PostMessageW(hwnd, WM_NULL, 0, 0); + }
VOID HandleTaskItemRightClick(IN OUT PTASK_ITEM TaskItem) { @@ -1640,14 +1645,11 @@ public:
ActivateTask(TaskItem->hWnd);
- /* Wait up to 2 seconds for the window to process the foreground notification. */ - DWORD_PTR resultDummy; - if (!SendMessageTimeout(TaskItem->hWnd, WM_NULL, 0, 0, 0, 2000, &resultDummy)) - ERR("HandleTaskItemRightClick detected the window was unresponsive for 2 seconds, or was destroyed\n"); if (GetForegroundWindow() != TaskItem->hWnd) ERR("HandleTaskItemRightClick detected the window did not become foreground\n");
- ::SendMessageW(TaskItem->hWnd, WM_POPUPSYSTEMMENU, 0, MAKELPARAM(pt.x, pt.y)); + ::SendMessageCallbackW(TaskItem->hWnd, WM_POPUPSYSTEMMENU, 0, MAKELPARAM(pt.x, pt.y), + SendAsyncProc, (ULONG_PTR)TaskItem); }
VOID HandleTaskGroupRightClick(IN OUT PTASK_GROUP TaskGroup)