From 43da2829e1505a660479deff9c7e3b0e93ff3a57 Mon Sep 17 00:00:00 2001 From: Palanix Date: Sat, 23 Oct 2021 23:19:50 +0200 Subject: [PATCH] fix mouse input being interpreted as top rel 0,0 if mouse is on border --- dwl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 6303c25..7bb578a 100644 --- a/dwl.c +++ b/dwl.c @@ -2372,9 +2372,16 @@ xytoclient(double x, double y) /* Find the topmost visible client (if any) at point (x, y), including * borders. This relies on stack being ordered from top to bottom. */ Client *c; - wl_list_for_each(c, &stack, slink) - if (VISIBLEON(c, c->mon) && wlr_box_contains_point(&c->geom, x, y)) + wl_list_for_each(c, &stack, slink) { + struct wlr_box p = { + .y = c->geom.y + borderpx, + .x = c->geom.x + borderpx, + .height = c->geom.height - 2*borderpx, + .width = c->geom.width - 2*borderpx, + }; + if (VISIBLEON(c, c->mon) && wlr_box_contains_point(&p, x, y)) return c; + } return NULL; }