summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-21 19:17:44 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-21 19:17:44 -0500
commitcdeff2475d7a4f27187cced8b5a92beafd8c9197 (patch)
tree24fdbc35737b7d9c0c2727d4f18d3774eb77d6f6
parent0e9bceb8b6a8ad86cedab2b9b0fd371ee73cde2c (diff)
inline xytosurface in xytoclient
It was a simpler function than it looked
-rw-r--r--dwl.c51
1 files changed, 17 insertions, 34 deletions
diff --git a/dwl.c b/dwl.c
index 3d250da..2d0dced 100644
--- a/dwl.c
+++ b/dwl.c
@@ -122,8 +122,6 @@ static void spawn(const Arg *arg);
static void unmapnotify(struct wl_listener *listener, void *data);
static Client * xytoclient(double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy);
-static bool xytosurface(Client *c, double lx, double ly,
- struct wlr_surface **surface, double *sx, double *sy);
/* variables */
static struct wl_display *wl_display;
@@ -953,44 +951,29 @@ xytoclient(double lx, double ly,
* cursor. This relies on clients being ordered from top-to-bottom. */
Client *c;
wl_list_for_each(c, &clients, link) {
- if (xytosurface(c, lx, ly, surface, sx, sy)) {
+ /*
+ * XDG toplevels may have nested surfaces, such as popup windows
+ * for context menus or tooltips. This function tests if any of
+ * those are underneath the coordinates lx and ly (in output
+ * Layout Coordinates). If so, it sets the surface pointer to
+ * that wlr_surface and the sx and sy coordinates to the
+ * coordinates relative to that surface's top-left corner.
+ */
+ double _sx, _sy;
+ struct wlr_surface *_surface = NULL;
+ _surface = wlr_xdg_surface_surface_at(c->xdg_surface,
+ lx - c->x, ly - c->y, &_sx, &_sy);
+
+ if (_surface != NULL) {
+ *sx = _sx;
+ *sy = _sy;
+ *surface = _surface;
return c;
}
}
return NULL;
}
-bool
-xytosurface(Client *c, double lx, double ly,
- struct wlr_surface **surface, double *sx, double *sy)
-{
- /*
- * XDG toplevels may have nested surfaces, such as popup windows for context
- * menus or tooltips. This function tests if any of those are underneath the
- * coordinates lx and ly (in output Layout Coordinates). If so, it sets the
- * surface pointer to that wlr_surface and the sx and sy coordinates to the
- * coordinates relative to that surface's top-left corner.
- */
- double client_sx = lx - c->x;
- double client_sy = ly - c->y;
-
- struct wlr_surface_state *state = &c->xdg_surface->surface->current;
-
- double _sx, _sy;
- struct wlr_surface *_surface = NULL;
- _surface = wlr_xdg_surface_surface_at(
- c->xdg_surface, client_sx, client_sy, &_sx, &_sy);
-
- if (_surface != NULL) {
- *sx = _sx;
- *sy = _sy;
- *surface = _surface;
- return true;
- }
-
- return false;
-}
-
int
main(int argc, char *argv[])
{