]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland: prevent shaded views from getting mouse events
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 4 May 2024 21:10:45 +0000 (23:10 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 5 May 2024 20:04:55 +0000 (21:04 +0100)
Fixes: #1753
include/view.h
src/view.c
src/xwayland.c

index b688f1041dd74b7e2663b9e4a510ccb0bd08a060..5ab5d0027cd6fa35eda6f510515b5851cd7ba06d 100644 (file)
@@ -127,6 +127,7 @@ struct view_impl {
        void (*minimize)(struct view *view, bool minimize);
        void (*move_to_front)(struct view *view);
        void (*move_to_back)(struct view *view);
+       void (*shade)(struct view *view, bool shaded);
        struct view *(*get_root)(struct view *self);
        void (*append_children)(struct view *self, struct wl_array *children);
        struct view_size_hints (*get_size_hints)(struct view *self);
index 19b5a33a19298526cf943b7a523be680db557378..140523545b0b02928b3e032cdc6cffc0ad421567 100644 (file)
@@ -2207,6 +2207,10 @@ view_set_shade(struct view *view, bool shaded)
        view->shaded = shaded;
        ssd_enable_shade(view->ssd, view->shaded);
        wlr_scene_node_set_enabled(view->scene_node, !view->shaded);
+
+       if (view->impl->shade) {
+               view->impl->shade(view, shaded);
+       }
 }
 
 void
index 3a936456fc2355cc7512f6d33094b48ef3813c5c..d59e0fb767e615f307319d4eb6b3330bca06ed8a 100644 (file)
@@ -744,6 +744,15 @@ static void
 xwayland_view_move_to_front(struct view *view)
 {
        view_impl_move_to_front(view);
+
+       if (view->shaded) {
+               /*
+                * Ensure that we don't raise a shaded window
+                * to the front which then steals mouse events.
+                */
+               return;
+       }
+
        /*
         * Update XWayland stacking order.
         *
@@ -754,6 +763,7 @@ xwayland_view_move_to_front(struct view *view)
         */
        wlr_xwayland_surface_restack(xwayland_surface_from_view(view),
                NULL, XCB_STACK_MODE_ABOVE);
+
        /* Restack unmanaged surfaces on top */
        struct wl_list *list = &view->server->unmanaged_surfaces;
        struct xwayland_unmanaged *u;
@@ -851,6 +861,20 @@ xwayland_view_get_pid(struct view *view)
        return xwayland_surface->pid;
 }
 
+static void
+xwayland_view_shade(struct view *view, bool shaded)
+{
+       assert(view);
+
+       /* Ensure that clicks on some xwayland surface don't end up on the shaded one */
+       if (shaded) {
+               wlr_xwayland_surface_restack(xwayland_surface_from_view(view),
+                       NULL, XCB_STACK_MODE_BELOW);
+       } else {
+               xwayland_adjust_stacking_order(view->server);
+       }
+}
+
 static const struct view_impl xwayland_view_impl = {
        .configure = xwayland_view_configure,
        .close = xwayland_view_close,
@@ -863,6 +887,7 @@ static const struct view_impl xwayland_view_impl = {
        .minimize = xwayland_view_minimize,
        .move_to_front = xwayland_view_move_to_front,
        .move_to_back = xwayland_view_move_to_back,
+       .shade = xwayland_view_shade,
        .get_root = xwayland_view_get_root,
        .append_children = xwayland_view_append_children,
        .get_size_hints = xwayland_view_get_size_hints,