Skip to content

Commit

Permalink
fix: non-client windows messages on legacy widget host (again) (#33444)
Browse files Browse the repository at this point in the history
Co-authored-by: clavin <clavin@electronjs.org>
  • Loading branch information
trop[bot] and clavin committed Mar 28, 2022
1 parent 8873984 commit 06a3bda
Showing 1 changed file with 7 additions and 11 deletions.
Expand Up @@ -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,
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 06a3bda

Please sign in to comment.