Skip to content

wayland/popup: Only close popups if press count drops from 1 to 0

Jonas Dreßler requested to merge verdre/mutter:fix-popup-grabs-long-press into main

We close wayland popups when a button or touch release happens outside of the grab, except we don't want to close them when that button release is actually the release of the press that was opening the grab in the first place.

We never see the press event that opened the grab, so the first event we see is actually always a release. Make sure to not close the popup on that event, and instead only close the popup if we see the press count drop from 1 to 0.

This fixes a bug where popup would close right after they open. To reproduce, click to open a popup, hold pressed and move the cursor over shell chrome, then release. Or alternatively test with a popup that gets opened with a long-press gesture (eg. long touch long press on libadwaita tabs), just doing the touch long-press and then release.

Merge request reports