fix: fix xytonode not exclue snapbuffer for client

This commit is contained in:
DreamMaoMao 2026-06-22 11:43:03 +08:00
parent 69e994c37a
commit afd7135fa6

View file

@ -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;
}
}
}