diff --git a/include/common/box.h b/include/common/box.h index 9f18b45e..10608c25 100644 --- a/include/common/box.h +++ b/include/common/box.h @@ -4,6 +4,12 @@ #include +struct point { + int x, y; +}; + +struct point box_midpoint(const struct wlr_box *box); + bool box_intersects(struct wlr_box *box_a, struct wlr_box *box_b); /* Returns the bounding box of 2 boxes */ diff --git a/src/common/box.c b/src/common/box.c index 5cc91bf3..3cbe09df 100644 --- a/src/common/box.c +++ b/src/common/box.c @@ -2,6 +2,15 @@ #include "common/box.h" #include "common/macros.h" +struct point +box_midpoint(const struct wlr_box *box) +{ + return (struct point) { + .x = box->x + box->width / 2, + .y = box->y + box->height / 2, + }; +} + bool box_intersects(struct wlr_box *box_a, struct wlr_box *box_b) {