]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: Make update_pressed_surface() no-op except during grabs
authorJohn Lindgren <john@jlindgren.net>
Tue, 15 Nov 2022 19:20:05 +0000 (14:20 -0500)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 15 Nov 2022 20:56:48 +0000 (21:56 +0100)
This matches Weston behavior more closely and fixes Firefox context
menus.

src/cursor.c

index 87d53abd61fe96ffc283cfe65a5a354512e96a6c..fe4aae509232c686f106577a9e2f8071c289f40e 100644 (file)
@@ -257,11 +257,19 @@ update_pressed_surface(struct seat *seat, struct cursor_context *ctx)
 {
        /*
         * In most cases, we don't want to leave one surface and enter
-        * another while a button is pressed.  However, GTK/Wayland
-        * menus (implemented as XDG popups) do need the leave/enter
-        * events to work properly.  To cover this case, we allow
-        * leave/enter events between XDG popups and their toplevel.
+        * another while a button is pressed.  We only do so when
+        * (1) there is a pointer grab active (e.g. XDG popup grab) and
+        * (2) both surfaces belong to the same XDG toplevel.
+        *
+         * GTK/Wayland menus are known to use an XDG popup grab and to
+        * rely on the leave/enter events to work properly.  Firefox
+        * context menus (in contrast) do not use an XDG popup grab and
+        * do not work properly if we send leave/enter events.
         */
+       if (seat->seat->pointer_state.grab ==
+                       seat->seat->pointer_state.default_grab) {
+               return false;
+       }
        if (seat->pressed.surface && ctx->surface != seat->pressed.surface) {
                struct wlr_surface *toplevel = get_toplevel(ctx->surface);
                if (toplevel && toplevel == seat->pressed.toplevel) {