aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-23 13:50:08 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-03-23 18:22:40 -0600
commit3e79a9a5d7a7d66effaca573798f4c5b77e99773 (patch)
tree1ef6aaf0c80c4fde5c0362eb3e882dac46a8bc86
parentc2899bc00b03c8a4a6d11c2b9a00a4114949f427 (diff)
fix drag icon's surface returned by xytonode
-rw-r--r--dwl.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/dwl.c b/dwl.c
index 9f72768..3f3f447 100644
--- a/dwl.c
+++ b/dwl.c
@@ -68,7 +68,7 @@
/* enums */
enum { CurNormal, CurMove, CurResize }; /* cursor */
enum { XDGShell, LayerShell, X11Managed, X11Unmanaged }; /* client types */
-enum { LyrBg, LyrBottom, LyrTop, LyrOverlay, LyrTile, LyrFloat, NUM_LAYERS }; /* scene layers */
+enum { LyrBg, LyrBottom, LyrTop, LyrOverlay, LyrTile, LyrFloat, LyrNoFocus, NUM_LAYERS }; /* scene layers */
#ifdef XWAYLAND
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
@@ -1784,6 +1784,7 @@ setup(void)
layers[LyrFloat] = &wlr_scene_tree_create(&scene->node)->node;
layers[LyrTop] = &wlr_scene_tree_create(&scene->node)->node;
layers[LyrOverlay] = &wlr_scene_tree_create(&scene->node)->node;
+ layers[LyrNoFocus] = &wlr_scene_tree_create(&scene->node)->node;
/* Create a renderer with the default implementation */
if (!(drw = wlr_renderer_autocreate(backend)))
@@ -1953,7 +1954,7 @@ startdrag(struct wl_listener *listener, void *data)
if (!drag->icon)
return;
- drag->icon->data = wlr_scene_subsurface_tree_create(layers[LyrTop], drag->icon->surface);
+ drag->icon->data = wlr_scene_subsurface_tree_create(layers[LyrNoFocus], drag->icon->surface);
motionnotify(0);
wl_signal_add(&drag->icon->events.destroy, &drag_icon_destroy);
}
@@ -2183,17 +2184,23 @@ xytonode(double x, double y, struct wlr_surface **psurface,
struct wlr_surface *surface = NULL;
Client *c = NULL;
LayerSurface *l = NULL;
-
- if ((node = wlr_scene_node_at(&scene->node, x, y, nx, ny))) {
- if (node->type == WLR_SCENE_NODE_SURFACE)
- surface = wlr_scene_surface_from_node(node)->surface;
- /* Walk the tree to find a node that knows the client */
- for (pnode = node; pnode && !c; pnode = pnode->parent)
- c = pnode->data;
- if (c && c->type == LayerShell) {
- c = NULL;
- l = pnode->data;
+ int i;
+ int focus_order[] = { LyrOverlay, LyrTop, LyrFloat, LyrTile, LyrBottom, LyrBg };
+
+ for (i = 0; i < LENGTH(focus_order); i++) {
+ if ((node = wlr_scene_node_at(layers[focus_order[i]], x, y, nx, ny))) {
+ if (node->type == WLR_SCENE_NODE_SURFACE)
+ surface = wlr_scene_surface_from_node(node)->surface;
+ /* Walk the tree to find a node that knows the client */
+ for (pnode = node; pnode && !c; pnode = pnode->parent)
+ c = pnode->data;
+ if (c && c->type == LayerShell) {
+ c = NULL;
+ l = pnode->data;
+ }
}
+ if (surface)
+ break;
}
if (psurface) *psurface = surface;