summaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-04-15 17:40:02 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-04-15 17:40:02 -0500
commita48ce99e6a3c0dda331781942995a85ba8e438a0 (patch)
tree59e672ee7ed8515bdf05f41ca2f9f874add35122 /dwl.c
parentb86fcf6504e7b6aafcace2e099d2de822c25fbf3 (diff)
use pointer math in xytonode()
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dwl.c b/dwl.c
index b09fc6f..88043d8 100644
--- a/dwl.c
+++ b/dwl.c
@@ -2344,11 +2344,11 @@ xytonode(double x, double y, struct wlr_surface **psurface,
struct wlr_surface *surface = NULL;
Client *c = NULL;
LayerSurface *l = NULL;
- int i;
+ const int *layer;
int focus_order[] = { LyrOverlay, LyrTop, LyrFloat, LyrTile, LyrBottom, LyrBg };
- for (i = 0; i < LENGTH(focus_order); i++) {
- if ((node = wlr_scene_node_at(layers[focus_order[i]], x, y, nx, ny))) {
+ for (layer = focus_order; layer < END(focus_order); layer++) {
+ if ((node = wlr_scene_node_at(layers[*layer], x, y, nx, ny))) {
if (node->type == WLR_SCENE_NODE_SURFACE)
surface = wlr_scene_surface_from_node(node)->surface;
/* Walk the tree to find a node that knows the client */