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