From 728a94dead7e12e35a0cfe47f63e14c763df0a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 19 Apr 2023 12:08:53 +0200 Subject: [PATCH] popupMenu: Only activate items that still have the pointer After the introduction of implicit grabs in Clutter, a release event will now always be delivered to the actor that received the corresponding press event. This results in surprising behavior when moving the pointer while pressed, as a button release will always activate the original item, even when the pointer moved to a different item or outside the menu altogether. Address this by checking the hover state (that is, whether the item contains the pointer actor) before activating it. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6606 Part-of: --- js/ui/popupMenu.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 2f57c5831..c5fecc0ae 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -138,6 +138,11 @@ var PopupBaseMenuItem = GObject.registerClass({ return Clutter.EVENT_PROPAGATE; this.remove_style_pseudo_class('active'); + + // Pointer left the item during the grab + if (!this.hover) + return Clutter.EVENT_PROPAGATE; + this.activate(Clutter.get_current_event()); return Clutter.EVENT_STOP; }