Skip to content

fix: mouse forwarding doesn't track legacy window reparenting - #55620

Merged
MarshallOfSound merged 3 commits into
45-x-yfrom
trop/45-x-y-bp-fix-mouse-forwarding-doesn-t-track-legacy-window-reparenting-1793890668874
Nov 5, 2026
Merged

MarshallOfSound merged 3 commits into
45-x-yfrom
trop/45-x-y-bp-fix-mouse-forwarding-doesn-t-track-legacy-window-reparenting-1793890668874

Conversation

@trop

@trop trop Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Backport of #55098

See that PR for details.

Notes: Fixed setIgnoreMouseEvents(true, { forward: true }) not tracking legacy windows when they are reparented.

trop Bot and others added 3 commits November 5, 2026 14:59
Co-authored-by: LuoRain <luotianyi@luotianyi.me>
HWNDMessageHandler routes WM_MOUSELEAVE and WM_NCMOUSELEAVE to
OnMouseRange, so a leave the OS delivers to this window already reaches
ElectronDesktopWindowTreeHostWin::HandleMouseEvent, where kMouseExited
is filtered. Keeping the PreHandleMSG case as well skipped the
active_mouse_tracking_flags_ = 0 reset in
HandleMouseEventInternal, which left the cached flags set with the OS
tracking off; after that TrackMouseEvents() no longer arms anything for
the same flags.

With a single filter both paths behave the same, and the comments at the
filter and above RearmMouseLeaveTracking() describe what happens now.

Co-authored-by: Charles Kerr <charles@charleskerr.com>

Co-authored-by: LuoRain <luotianyi@luotianyi.me>
Chromium moves a live Chrome_RenderWidgetHostHWND with ::SetParent when
its WebContentsView changes window, which sends no WM_PARENTNOTIFY, so a
window that gains a view never hears about the HWND it now hosts, and
cannot filter the mouse leave that HWND reports once forwarding starts.

Load a view in one window, move it, still loaded, into a second window,
let real input hover an element while that window is still solid, then
enable forwarding over it. Check that moves keep being forwarded, hover
is never interrupted, and exactly one leave fires on exit.

Without the fix the first forwarded move is preceded by a spurious leave
and the element stops being hovered; with it the counts are 0 and 1.

Requested in review by @jkleinsc.

Co-authored-by: LuoRain <luotianyi@luotianyi.me>
@trop trop Bot added 45-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Nov 5, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) November 5, 2026 17:50
@MarshallOfSound
MarshallOfSound merged commit 476dc5d into 45-x-y Nov 5, 2026
91 checks passed
@MarshallOfSound
MarshallOfSound deleted the trop/45-x-y-bp-fix-mouse-forwarding-doesn-t-track-legacy-window-reparenting-1793890668874 branch November 5, 2026 17:50
@release-clerk

release-clerk Bot commented Nov 5, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed setIgnoreMouseEvents(true, { forward: true }) not tracking legacy windows when they are reparented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant