QtFRED fix drag selection on Linux - #7662
Draft
MjnMixael wants to merge 1 commit into
Draft
Conversation
…ion box The render surface is a QWindow embedded via createWindowContainer that forwards mouse events to RenderWidget. A native child window only receives pointer events while the cursor is over it, so a fast drag that takes the cursor out of the viewport drops the subsequent move/release events. The button-release then never reaches mouseReleaseEvent, so the rubber-band selection box is never finalized and stays stuck on screen (reported on Linux). Grab the mouse on the render QWindow for the duration of a left-button drag so it keeps receiving events regardless of cursor position, and release the grab at every drag-end path (normal release, Esc-cancel, right-click-cancel, plus a move-handler safety net) so the grab can never dangle. Preserves the existing forwarding and cursor handling; degrades to prior behavior on platforms that refuse the grab.
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.
In QtFRED's viewport, dragging a selection box and whipping the cursor out of the viewport too fast could leave the box stuck on screen because the mouse-release event never made it back to the editor. This fix hopefully keeps the viewport listening to the mouse for the whole drag, even when the cursor leaves it, so the selection always finishes cleanly.
This only seems to affect Linux and I could not repro on Windows. This is the recommended fix I found after some research. Windows still seems to work as expected with this fix in place. This will need to be tested by someone with Linux.