add asserts/notes

This commit is contained in:
Devin J. Pohly 2020-04-26 14:23:32 -05:00
parent 7185888772
commit ceb9ab9a6b

17
dwl.c
View File

@ -247,6 +247,7 @@ assert_pointer_focus_invariants(void)
xytoclient(cursor->x, cursor->y, &surface, &sx, &sy);
if (cursor_mode == CurNormal) {
/* Pointer focus is surface under pointer */
/* XXX fails when popups are created under pointer */
assert(wlr_seat_pointer_surface_has_focus(seat, surface));
} else {
/* No surface has pointer focus */
@ -1620,8 +1621,8 @@ view(const Arg *arg)
assert_pointer_focus_invariants();
}
Client *
xytoclient(double x, double y,
static Client *
_xytoclient(double x, double y,
struct wlr_surface **surface, double *sx, double *sy)
{
/* XXX what if (x,y) is within a window's border? */
@ -1655,6 +1656,18 @@ xytoclient(double x, double y,
return NULL;
}
Client *
xytoclient(double x, double y,
struct wlr_surface **surface, double *sx, double *sy)
{
assert(surface != NULL);
assert(sx != NULL);
assert(sy != NULL);
Client *ret = _xytoclient(x, y, surface, sx, sy);
assert(EQV(ret != NULL, *surface != NULL));
return ret;
}
Monitor *
xytomon(double x, double y)
{