GTK4: mouse move starts Visual selection after a dialog - #21022
Open
h-east wants to merge 1 commit into
Open
Conversation
Problem: In GTK4, when a dialog pops up while a mouse button is pressed,
moving the mouse afterwards starts a Visual selection without
any button being held down.
Solution: Forget about the pressed mouse button when a mouse move reports
that no button is down, since the button release event may have
gone to another widget.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
related: #20907
The GTK4 half of #21014, which fixes the same bug for GTK2/GTK3.
mouse_pressed_buttonis only cleared inbutton_release_event(). When a modaldialog takes the release, the latch stays set and every later pointer motion is
reported as
MOUSE_DRAG, which Vim turns intoK_LEFTDRAG.The fix differs from #21014 on purpose. GTK3 has
gtk_grab_add()andGtkWidget::grab-notify, so there the latch is cleared when another widgetshadows the text area with a grab. GTK4 has neither, and it is not clear that
GtkGestureClickgets a ::cancel when a modal toplevel appears. Here the latchis dropped when a motion event reports that no button is down, which does not
depend on why the release was lost.
The comment claiming that the modifier state may not carry button masks on
Wayland is removed with it: dragging to extend a Visual selection was checked on
a Wayland session and works.