allow passing NULLs to xytoclient

For sx/sy, these are handled by the underlying call to
wlr_surface_surface_at.
main
Devin J. Pohly 2020-05-02 14:43:28 -05:00
parent 8c80f74513
commit 20ed6cb3d5
1 changed files with 6 additions and 8 deletions

12
dwl.c
View File

@ -270,9 +270,8 @@ buttonpress(struct wl_listener *listener, void *data)
switch (event->state) { switch (event->state) {
case WLR_BUTTON_PRESSED:; case WLR_BUTTON_PRESSED:;
/* Change focus if the button was _pressed_ over a client */ /* Change focus if the button was _pressed_ over a client */
double sx, sy;
struct wlr_surface *surface; struct wlr_surface *surface;
Client *c = xytoclient(cursor->x, cursor->y, &surface, &sx, &sy); Client *c = xytoclient(cursor->x, cursor->y, &surface, NULL, NULL);
if (c) if (c)
focusclient(c, surface, 1); focusclient(c, surface, 1);
@ -731,9 +730,7 @@ motionrelative(struct wl_listener *listener, void *data)
void void
moveresize(const Arg *arg) moveresize(const Arg *arg)
{ {
struct wlr_surface *surface; grabc = xytoclient(cursor->x, cursor->y, NULL, NULL, NULL);
double sx, sy;
grabc = xytoclient(cursor->x, cursor->y, &surface, &sx, &sy);
if (!grabc) if (!grabc)
return; return;
@ -1359,9 +1356,10 @@ xytoclient(double x, double y,
*/ */
/* XXX set *surface to xdg_surface->surface instead of /* XXX set *surface to xdg_surface->surface instead of
* NULL? what should sx/sy be in that case? */ * NULL? what should sx/sy be in that case? */
if (surface)
*surface = wlr_xdg_surface_surface_at(c->xdg_surface, *surface = wlr_xdg_surface_surface_at(c->xdg_surface,
x - c->geom.x - c->bw, y - c->geom.y - c->bw, x - c->geom.x - c->bw,
sx, sy); y - c->geom.y - c->bw, sx, sy);
return c; return c;
} }
} }