Repository navigation
fix: WCO window hover on window controls on Windows - #32672
Conversation
|
I'm working on upstreaming this, either as-is or as a small refactor. Either way and whether it gets accepted there or not, I think it would be a good idea to land this as a patch for now rather than when it finds its way in through the roll! |
|
Is it possible to signal the handling of this mouse event at |
|
Good catch! I know the Also I just realized when I cleaned up the patch I broke the condition 😅 (should be |
|
@deepak1556 That works! It took me a minute to figure out, but as long as we do it after |
aee4040 to
6e9a0b0
Compare
Co-authored-by: Robo <[email protected]>
|
Release Notes Persisted
|
|
I have automatically backported this PR to "14-x-y", please check out #32716 |
|
I have automatically backported this PR to "15-x-y", please check out #32717 |
|
I have automatically backported this PR to "17-x-y", please check out #32719 |
|
I have automatically backported this PR to "16-x-y", please check out #32720 |
|
/trop run backport-to 18-x-y |
|
The backport process for this PR has been manually initiated - sending your PR to |
|
I have automatically backported this PR to "18-x-y", please check out #32723 |
Description of Change
This adds a patch to Chromium that marks non-client mouse hover events as handled so they don't get redispatched to the default OS event handler (which is currently immediately "stealing" the mouse every time it moves).
Currently, on Windows with WCO-enabled windows, Win API mouse messages first find their way to
LegacyRenderWidgetHostHWND::OnMouseRangewhich, for non-client mouse moved events, will both handle the event normally (throughHWNDMessageHandler::HandleMouseMessagewhich eventually bubbles down toWidget::OnMouseEvent) as well as redispatch the original message back to the OS default window procedure (via the Win APIDefWndProc) on the real window handle, depending on some conditions.Calling
DefWndProcafter we process a non-client area mouse move message seems to cause issues where the system will immediately send a non-client mouse exit message to the real window (HWNDMessageHandlerdirectly this time, which again flows down toWidget::OnMouseEvent) which makes it think the mouse is no longer hovering over the non-client area.To avoid this, an event should be marked as handled meaning
LegacyRenderWidgetHostHWNDwill no longer forward the message toDefWndProc. Note that this is how many other mouse events behave in that method, but not hovers currently.The only open question I haven't figured out is why
DefWndProcis taking aWM_NCMOUSEMOVEmessage fromLegacyRenderHostHWNDcalled onHWNDMessageHandler's window handle and then sending aWM_NCMOUSELEAVEmessage (take note: move changed to leave) when it invokesHWNDMessageHandler'sWndProc. My current thought is that we tell the system that the client area covers the full window (i.e. the window has no frame) but also indicate that the mouse is sometimes in non-client area via hit testing (which we have to do to get Snap Assist) and this sort of inconsistency might trickDefWndProcinto the behavior we're seeing. Not really sure if it's worth confirming though so it might just stay a hypothesis.In theory this shouldn't affect anything but WCO windows as usually the
LegacyRenderWidgetHostHWNDdoesn't cover any non-client area, so I deduce that all other kinds of windows will never send theLegacyRenderWidgetHostHWNDa non-client mouse message in practice.Fixes #32360.
Checklist
npm testpassesRelease Notes
Notes: Fix effect when hovering over window controls on Windows in a WCO-enabled window.