Repository navigation
wayland/popup: Don't take the opening press's release as a click on the menu - #906
Open
SyberHexen wants to merge 1 commit into
Open
SyberHexen wants to merge 1 commit into
SyberHexen wants to merge 1 commit into
Conversation
…he menu Clients anchor a context menu at the pointer, so its popup can map under the pointer while the button that opened it is still held (GNOME System Monitor's anchor is a couple of pixels off). The repick then gives the popup pointer focus, the client sees the button's release over the menu, and GTK closes it again: right-click menus vanish as soon as the button is let go, now and then. While the press that started a popup grab is held, a popup surface under the pointer doesn't get pointer focus; the focus stays where the press was, which gets the release. Releasing the button ends this, and so does holding it for 300 ms and dragging more than a few pixels from the press, so dragging onto an item and releasing still picks it, while the hand's usual wobble during a click doesn't count (GTK 3 menus tell a click from a press-drag-release by time the same way). Co-Authored-By: Claude Opus 5.5 <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.
Bug: clients anchor a context menu at the pointer, so its xdg_popup can map under the pointer while the button that opened it is still held. The repick then gives the popup pointer focus, the client gets the button release over the menu, and GTK closes it: right-click menus of Wayland apps vanish as soon as the button is let go, now and then.
Reproduce: Cinnamon Wayland session, GNOME System Monitor (GTK 4), right-click processes. With the default Adwaita theme the menu opens 0.1–1 px below the pointer, so moving the pointer down by a pixel while the button is still held (easy with a high-resolution mouse) puts it on the menu, and the release closes the menu. With some themes the app's anchor lands a couple of pixels above the pointer (measured: anchor 55,163 for a pointer at 57.4,165.2), so the menu maps under a pointer that doesn't move and every few right-clicks close it.
WAYLAND_DEBUG=clientthen showswl_pointer.enteron the popup surface right after it maps, the release, and the client destroying the popup (nopopup_donefrom the compositor).Fix: while the press that started a popup grab is held, a popup surface under the pointer doesn't get pointer focus; focus stays where the press was, which gets the release. Releasing the button ends this, and so does holding it for 300 ms and dragging more than 4 px, so press-drag-release onto an item still picks it (GTK 3 menus tell a click from a drag by time the same way).
Tested: GNOME System Monitor with the theme where the anchor is off: from about 1 in 5 right-clicks closing to none; press-drag-release onto an item still activates it; menus opened from the keyboard are unaffected. With Adwaita, measured over 15 right-clicks: the menu's top edge is 0.1–1.0 px below the pointer, i.e. one pixel of downward movement during the click reaches it.