From 06a3bdadd75554488508c0e145471593e5397973 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 16:34:20 +0900 Subject: [PATCH] fix: non-client windows messages on legacy widget host (again) (#33444) Co-authored-by: clavin --- ...cking_and_message_bubbling_on_windows.patch | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch index e0d1ebaa30427..a0f29c95205f5 100644 --- a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch +++ b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch @@ -13,7 +13,7 @@ messages in the legacy window handle layer. These conditions are regularly hit with WCO-enabled windows on Windows. diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc -index 4a894ef70eeb1d8489049aef552c9bae4f24ae62..f5049d730a850f2947023f976b25fb772e42107a 100644 +index 4a894ef70eeb1d8489049aef552c9bae4f24ae62..df101c53861a83f107d459270c37b3b497a00cb0 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.cc +++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc @@ -288,12 +288,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, @@ -31,19 +31,15 @@ index 4a894ef70eeb1d8489049aef552c9bae4f24ae62..f5049d730a850f2947023f976b25fb77 tme.hwndTrack = hwnd(); tme.dwHoverTime = 0; TrackMouseEvent(&tme); -@@ -319,12 +319,11 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, - message, w_param, l_param, &msg_handled); - handled = msg_handled; - // If the parent did not handle non client mouse messages, we call -- // DefWindowProc on the message with the parent window handle. This -- // ensures that WM_SYSCOMMAND is generated for the parent and we are -- // out of the picture. -+ // DefWindowProc on the message. This ensures that WM_SYSCOMMAND is -+ // generated. +@@ -324,7 +324,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, + // out of the picture. if (!handled && (message >= WM_NCMOUSEMOVE && message <= WM_NCXBUTTONDBLCLK)) { - ret = ::DefWindowProc(GetParent(), message, w_param, l_param); -+ ret = ::DefWindowProc(hwnd(), message, w_param, l_param); ++ // Send WM_NCMOUSEMOVE messages using the LegacyRenderWidgetHostHWND's ++ // handle so mouse tracking on non-client areas doesn't break. ++ HWND target = message == WM_NCMOUSEMOVE ? hwnd() : GetParent(); ++ ret = ::DefWindowProc(target, message, w_param, l_param); handled = TRUE; } }