mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-12 08:21:33 -04:00
util/box: introduce wlr_fbox_intersects
Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
This commit is contained in:
parent
d05f14f38b
commit
807373594e
2 changed files with 16 additions and 0 deletions
|
|
@ -114,6 +114,13 @@ void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box,
|
|||
*/
|
||||
bool wlr_box_intersects(const struct wlr_box *a, const struct wlr_box *b);
|
||||
|
||||
/**
|
||||
* Checks whether two boxes intersect.
|
||||
*
|
||||
* Returns false if either box is empty.
|
||||
*/
|
||||
bool wlr_fbox_intersects(const struct wlr_fbox *a, const struct wlr_fbox *b);
|
||||
|
||||
/**
|
||||
* Returns true if the two boxes are equal, false otherwise.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -111,6 +111,15 @@ bool wlr_box_intersects(const struct wlr_box *a, const struct wlr_box *b) {
|
|||
a->y < b->y + b->height && b->y < a->y + a->height;
|
||||
}
|
||||
|
||||
bool wlr_fbox_intersects(const struct wlr_fbox *a, const struct wlr_fbox *b) {
|
||||
if (wlr_fbox_empty(a) || wlr_fbox_empty(b)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return a->x < b->x + b->width && b->x < a->x + a->width &&
|
||||
a->y < b->y + b->height && b->y < a->y + a->height;
|
||||
}
|
||||
|
||||
void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
|
||||
enum wl_output_transform transform, int width, int height) {
|
||||
struct wlr_box src = {0};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue