From afd7135fa609b4a373b557a47deb28219cf55c7c Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Mon, 22 Jun 2026 11:43:03 +0800 Subject: [PATCH] fix: fix xytonode not exclue snapbuffer for client --- src/fetch/common.h | 55 ++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/src/fetch/common.h b/src/fetch/common.h index 1627ea6a..fdd85be5 100644 --- a/src/fetch/common.h +++ b/src/fetch/common.h @@ -102,7 +102,7 @@ static bool layer_ignores_focus(LayerSurface *l) { void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, LayerSurface **pl, MangoCustomDecorate **pd, double *nx, double *ny) { - struct wlr_scene_node *node, *pnode; + struct wlr_scene_node *node = NULL, *pnode = NULL; struct wlr_surface *surface = NULL; Client *c = NULL; LayerSurface *l = NULL; @@ -110,15 +110,21 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, int32_t layer; Client *ovc = NULL; - for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) { + if (psurface) + *psurface = NULL; + if (pc) + *pc = NULL; + if (pl) + *pl = NULL; + if (pd) + *pd = NULL; + for (layer = NUM_LAYERS - 1; layer >= 0; layer--) { if (layer == LyrFadeOut) continue; - if (!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny))) - continue; - - if (!node->enabled) + node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny); + if (!node) continue; if (node->type == WLR_SCENE_NODE_BUFFER) { @@ -130,21 +136,27 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, } } - /* start from the topmost layer, - find a sureface that can be focused by pointer, - impopup neither a client nor a layer surface.*/ if (layer == LyrIMPopup) { c = NULL; l = NULL; } else { - for (pnode = node; pnode && !c; pnode = &pnode->parent->node) - c = pnode->data; - if (c && c->type == LayerShell) { - l = (LayerSurface *)c; - c = NULL; - } else if (c && c->type == CustomDecorate) { - mangocustomdecorate = (MangoCustomDecorate *)c; - c = NULL; + void *data = NULL; + for (pnode = node; pnode; pnode = &pnode->parent->node) { + if (pnode->data) { + data = pnode->data; + break; + } + } + + if (data) { + Client *temp_c = (Client *)data; + if (temp_c->type == LayerShell) { + l = (LayerSurface *)temp_c; + } else if (temp_c->type == CustomDecorate) { + mangocustomdecorate = (MangoCustomDecorate *)temp_c; + } else if (temp_c->type == XDGShell || temp_c->type == X11) { + c = temp_c; + } } } @@ -152,8 +164,9 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, if (c) { surface = client_surface(c); } - break; } + + break; } if (psurface) @@ -179,12 +192,12 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, if (ovc && (!l || layer_ignores_focus(l) || is_below)) { if (pc) *pc = ovc; - if (psurface) *psurface = ovc ? client_surface(ovc) : NULL; - - if (pl && ovc) + if (pl) *pl = NULL; + if (pd) + *pd = NULL; } } } \ No newline at end of file