mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-09-19 13:52:48 +00:00
implement xytonode() with toplevel_from_wlr_surface()
xytonode() does not return the layer surface under the cursor because pnode->data is always NULL. It was not noticed because it is not passed the LayerSurface argument anywhere. But it is noticeable after implementing layer shell on-demand keyboard interactivity because layer shell surfaces are never focused by sloppyfocus. Rather than figuring out how to fix it, just replace its implementation with toplevel_from_wlr_surface() which works and also reduces the SLOC.
This commit is contained in:
@@ -3049,10 +3049,8 @@ void
|
|||||||
xytonode(double x, double y, struct wlr_surface **psurface,
|
xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
Client **pc, LayerSurface **pl, double *nx, double *ny)
|
Client **pc, LayerSurface **pl, double *nx, double *ny)
|
||||||
{
|
{
|
||||||
struct wlr_scene_node *node, *pnode;
|
struct wlr_scene_node *node;
|
||||||
struct wlr_surface *surface = NULL;
|
struct wlr_surface *surface = NULL;
|
||||||
Client *c = NULL;
|
|
||||||
LayerSurface *l = NULL;
|
|
||||||
int layer;
|
int layer;
|
||||||
|
|
||||||
for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) {
|
for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) {
|
||||||
@@ -3063,18 +3061,10 @@ xytonode(double x, double y, struct wlr_surface **psurface,
|
|||||||
if (node->type == WLR_SCENE_NODE_BUFFER)
|
if (node->type == WLR_SCENE_NODE_BUFFER)
|
||||||
surface = wlr_scene_surface_try_from_buffer(
|
surface = wlr_scene_surface_try_from_buffer(
|
||||||
wlr_scene_buffer_from_node(node))->surface;
|
wlr_scene_buffer_from_node(node))->surface;
|
||||||
/* Walk the tree to find a node that knows the client */
|
|
||||||
for (pnode = node; pnode && !c; pnode = &pnode->parent->node)
|
|
||||||
c = pnode->data;
|
|
||||||
if (c && c->type == LayerShell) {
|
|
||||||
c = NULL;
|
|
||||||
l = pnode->data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psurface) *psurface = surface;
|
if (psurface) *psurface = surface;
|
||||||
if (pc) *pc = c;
|
toplevel_from_wlr_surface(surface, pc, pl);
|
||||||
if (pl) *pl = l;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user