]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: cancel popup grab on mouse-press outside client itself
authorJohan Malm <jgm323@gmail.com>
Wed, 9 Aug 2023 15:58:18 +0000 (16:58 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 10 Aug 2023 14:33:56 +0000 (15:33 +0100)
...for example on any part of the server side decoration

Supercedes #826 for xdg-shell popups

Helped-by: @Consolatis
src/cursor.c

index cfcce67819a0b5c808a4ecc95c4f7fafa2daf4ee..fedf5ad4625ed9dec9084eb970acb5b3982e5fdc 100644 (file)
@@ -923,8 +923,15 @@ cursor_button_press(struct seat *seat, struct wlr_pointer_button_event *event)
                }
        }
 
-       if (ctx.type == LAB_SSD_ROOT && wlr_seat_pointer_has_grab(seat->seat)) {
-               /* Let a click on the desktop cancel an active popup grab */
+       if (ctx.type != LAB_SSD_CLIENT && wlr_seat_pointer_has_grab(seat->seat)) {
+               /*
+                * If we have an active popup grab (an open popup) we want to
+                * cancel that grab whenever the user presses on anything that
+                * is not the client itself, for example the desktop or any
+                * part of the server side decoration.
+                *
+                * Note: This does not work for XWayland clients
+                */
                wlr_seat_pointer_end_grab(seat->seat);
                return;
        }