Repository navigation
Conversation
WM_CAPTURECHANGED reaches the window losing the capture after Windows has already given it to the new window, so the ReleaseCapture call in on_capture_changed took the capture away from that new window. Keep the button counter reset and the CursorLeft handling, and drop the release.
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.
This is a small follow-up to #347 (the fix for #302).
When a window loses the mouse capture to another window,
on_capture_changedcallsReleaseCapture. The thing is, Windows only sendsWM_CAPTURECHANGEDto the old window after it has already given the capture to the new one, so that release takes the capture away from the new window instead. I ran into it starting an OLE drag (DoDragDrop) from a button press in a baseview window: OLE takes the capture for the drag,on_capture_changedreleases it, OLE never sees the mouse-up, and the drop never completes (dropping a file onto Explorer just did nothing).The fix just drops the
ReleaseCapturecall. Everything else #347 added stays: the button counter still gets reset, so the stuck capture from #302 is still covered, andCursorLeftis still sent when no button was down. And if the capture was released rather than moved to another window, there's nothing left to release anyway.Tests: I added a Windows test in
src/platform/win/mouse.rsthat does the same thing with two windows instead of OLE. It creates two hidden windows, sendsWM_LBUTTONDOWNto the first so it takes the capture, callsSetCaptureon the second, and checks that the second window still has the capture. It fails on master at the last assert (GetCapture()comes back null) and passes with the fix. It doesn't touch any of the files in #377, so the two don't depend on each other.