mirror of
https://github.com/labwc/labwc.git
synced 2026-03-17 05:33:47 -04:00
common: add box_midpoint()
This commit is contained in:
parent
e11600da9e
commit
227fe601ad
2 changed files with 15 additions and 0 deletions
|
|
@ -4,6 +4,12 @@
|
||||||
|
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
|
|
||||||
|
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);
|
bool box_intersects(struct wlr_box *box_a, struct wlr_box *box_b);
|
||||||
|
|
||||||
/* Returns the bounding box of 2 boxes */
|
/* Returns the bounding box of 2 boxes */
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,15 @@
|
||||||
#include "common/box.h"
|
#include "common/box.h"
|
||||||
#include "common/macros.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
|
bool
|
||||||
box_intersects(struct wlr_box *box_a, struct wlr_box *box_b)
|
box_intersects(struct wlr_box *box_a, struct wlr_box *box_b)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue