gtk: Fix releasing grab when closing popup
We may be processing a GDK_BUTTON_RELEASE event without any known pressed keys if releasing after a wl_pointer.enter which unsets all modifiers.
- Tap with two fingers to open a context menu
- Quickly release both fingers, then hold one finger down
- libinput will process this as holding down the right click
- Hover an action that would close the popup
- With the same finger, push down the touchpad to click
- this will trigger a
- release right-click (invokes the action, closes the popup)
- press left-click (takes a grab on the focused widget)
- wl_pointer::leave (leaving the popup surface)
- wl_pointer::enter (entering the main window again, resets modifiers)
- release right-click
- this will trigger a
We need to make sure we process this final GDK_BUTTON_RELEASE event to release the grab we took on the previous GDK_BUTTON_PRESS.
The same is not necessary in x11 because the prior GDK_BUTTON_PRESS was eaten by check_autoclose() instead, so no grab was taken.
Edited by Alessandro Astone