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, void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
LayerSurface **pl, MangoCustomDecorate **pd, double *nx, LayerSurface **pl, MangoCustomDecorate **pd, double *nx,
double *ny) { double *ny) {
struct wlr_scene_node *node, *pnode; struct wlr_scene_node *node = NULL, *pnode = NULL;
struct wlr_surface *surface = NULL; struct wlr_surface *surface = NULL;
Client *c = NULL; Client *c = NULL;
LayerSurface *l = NULL; LayerSurface *l = NULL;
@ -110,15 +110,21 @@ void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc,
int32_t layer; int32_t layer;
Client *ovc = NULL; 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) if (layer == LyrFadeOut)
continue; continue;
if (!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny))) node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny);
continue; if (!node)
if (!node->enabled)
continue; continue;
if (node->type == WLR_SCENE_NODE_BUFFER) { 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) { if (layer == LyrIMPopup) {
c = NULL; c = NULL;
l = NULL; l = NULL;
} else { } else {
for (pnode = node; pnode && !c; pnode = &pnode->parent->node) void *data = NULL;
c = pnode->data; for (pnode = node; pnode; pnode = &pnode->parent->node) {
if (c && c->type == LayerShell) { if (pnode->data) {
l = (LayerSurface *)c; data = pnode->data;
c = NULL; break;
} else if (c && c->type == CustomDecorate) { }
mangocustomdecorate = (MangoCustomDecorate *)c; }
c = NULL;
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) { if (c) {
surface = client_surface(c); surface = client_surface(c);
} }
break;
} }
break;
} }
if (psurface) 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 (ovc && (!l || layer_ignores_focus(l) || is_below)) {
if (pc) if (pc)
*pc = ovc; *pc = ovc;
if (psurface) if (psurface)
*psurface = ovc ? client_surface(ovc) : NULL; *psurface = ovc ? client_surface(ovc) : NULL;
if (pl)
if (pl && ovc)
*pl = NULL; *pl = NULL;
if (pd)
*pd = NULL;
} }
} }
} }