[vim/vim] GTK4: mouse move starts Visual selection after a dialog (PR #21022)

1 view
Skip to first unread message

h_east

unread,
Aug 11, 2026, 9:28:44 PM (2 days ago) Aug 11
to vim/vim, Subscribed
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.

related: #20907


The GTK4 half of #21014, which fixes the same bug for GTK2/GTK3.

mouse_pressed_button is only cleared in button_release_event(). When a modal
dialog takes the release, the latch stays set and every later pointer motion is
reported as MOUSE_DRAG, which Vim turns into K_LEFTDRAG.

The fix differs from #21014 on purpose. GTK3 has gtk_grab_add() and
GtkWidget::grab-notify, so there the latch is cleared when another widget
shadows the text area with a grab. GTK4 has neither, and it is not clear that
GtkGestureClick gets a ::cancel when a modal toplevel appears. Here the latch
is 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.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/21022

Commit Summary

  • 83f2d09 GTK4: mouse move starts Visual selection after a dialog

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21022@github.com>

Christian Brabandt

unread,
Aug 12, 2026, 3:11:52 PM (23 hours ago) Aug 12
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21022)

thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21022/c5271559318@github.com>

Reply all
Reply to author
Forward
0 new messages