use pointer math in xytonode()

This commit is contained in:
Leonardo Hernández Hernández 2022-04-15 17:40:02 -05:00
parent b86fcf6504
commit a48ce99e6a
No known key found for this signature in database
GPG key ID: E538897EE11B9624

6
dwl.c
View file

@ -2344,11 +2344,11 @@ xytonode(double x, double y, struct wlr_surface **psurface,
struct wlr_surface *surface = NULL; struct wlr_surface *surface = NULL;
Client *c = NULL; Client *c = NULL;
LayerSurface *l = NULL; LayerSurface *l = NULL;
int i; const int *layer;
int focus_order[] = { LyrOverlay, LyrTop, LyrFloat, LyrTile, LyrBottom, LyrBg }; int focus_order[] = { LyrOverlay, LyrTop, LyrFloat, LyrTile, LyrBottom, LyrBg };
for (i = 0; i < LENGTH(focus_order); i++) { for (layer = focus_order; layer < END(focus_order); layer++) {
if ((node = wlr_scene_node_at(layers[focus_order[i]], x, y, nx, ny))) { if ((node = wlr_scene_node_at(layers[*layer], x, y, nx, ny))) {
if (node->type == WLR_SCENE_NODE_SURFACE) if (node->type == WLR_SCENE_NODE_SURFACE)
surface = wlr_scene_surface_from_node(node)->surface; surface = wlr_scene_surface_from_node(node)->surface;
/* Walk the tree to find a node that knows the client */ /* Walk the tree to find a node that knows the client */