]> git.mdlowis.com Git - proto/labwc.git/commitdiff
desktop: let get_cursor_context() return layer-popup subsurface
authortokyo4j <hrak1529@gmail.com>
Mon, 8 Sep 2025 17:53:31 +0000 (02:53 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Tue, 9 Sep 2025 09:50:20 +0000 (18:50 +0900)
With this change, when a layer-popup has a subsurface and cursor is on
it, wl_pointer.enter/motion events are sent to the subsurface rather
than its parent layer-popup surface. I think this follows wayland spec
more closely.

Tested with my demo: https://github.com/tokyo4j/wayland-demo/tree/layer-popup

src/desktop.c

index eb712562b4e2be54317b466770287c9b57305887..3ed19082f4711f23e28f25598cedb54cff0e59f4 100644 (file)
@@ -242,23 +242,6 @@ desktop_update_top_layer_visibility(struct server *server)
        }
 }
 
-static struct wlr_surface *
-get_surface_from_layer_node(struct wlr_scene_node *node)
-{
-       assert(node->data);
-       struct node_descriptor *desc = (struct node_descriptor *)node->data;
-       if (desc->type == LAB_NODE_LAYER_SURFACE) {
-               struct lab_layer_surface *surface;
-               surface = node_layer_surface_from_node(node);
-               return surface->scene_layer_surface->layer_surface->surface;
-       } else if (desc->type == LAB_NODE_LAYER_POPUP) {
-               struct lab_layer_popup *popup;
-               popup = node_layer_popup_from_node(node);
-               return popup->wlr_popup->base->surface;
-       }
-       return NULL;
-}
-
 /* TODO: make this less big and scary */
 struct cursor_context
 get_cursor_context(struct server *server)
@@ -315,11 +298,7 @@ get_cursor_context(struct server *server)
                                ret.surface = lab_wlr_surface_from_node(ret.node);
                                return ret;
                        case LAB_NODE_LAYER_POPUP:
-                               ret.node = node;
-                               ret.type = LAB_NODE_CLIENT;
-                               ret.surface = get_surface_from_layer_node(node);
-                               return ret;
-                       case LAB_NODE_SESSION_LOCK_SURFACE: /* fallthrough */
+                       case LAB_NODE_SESSION_LOCK_SURFACE:
                        case LAB_NODE_IME_POPUP:
                                ret.type = LAB_NODE_CLIENT;
                                ret.surface = lab_wlr_surface_from_node(ret.node);