Repository navigation
fix: mouse forwarding doesn't track legacy window reparenting - #55620
Merged
Conversation
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>
5 tasks done
MarshallOfSound
approved these changes
Nov 5, 2026
MarshallOfSound
enabled auto-merge (squash)
November 5, 2026 17:50
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 Notes Persisted
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #55098
See that PR for details.
Notes: Fixed
setIgnoreMouseEvents(true, { forward: true })not tracking legacy windows when they are reparented.