From 7969aa267e3c2c99458b6ecf84dd97aa3ebf0e0a Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Wed, 21 May 2025 20:43:17 +0900 Subject: [PATCH] common/box: drop box_contains() --- include/common/box.h | 2 -- src/common/box.c | 12 ------------ src/view.c | 4 ++-- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/include/common/box.h b/include/common/box.h index 6dc2fe3e..3d900a0e 100644 --- a/include/common/box.h +++ b/include/common/box.h @@ -4,8 +4,6 @@ #include -bool box_contains(struct wlr_box *box_super, struct wlr_box *box_sub); - 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 a6316d16..0b1c0b44 100644 --- a/src/common/box.c +++ b/src/common/box.c @@ -3,18 +3,6 @@ #include "common/box.h" #include "common/macros.h" -bool -box_contains(struct wlr_box *box_super, struct wlr_box *box_sub) -{ - if (wlr_box_empty(box_super) || wlr_box_empty(box_sub)) { - return false; - } - return box_super->x <= box_sub->x - && box_super->x + box_super->width >= box_sub->x + box_sub->width - && box_super->y <= box_sub->y - && box_super->y + box_super->height >= box_sub->y + box_sub->height; -} - bool box_intersects(struct wlr_box *box_a, struct wlr_box *box_b) { diff --git a/src/view.c b/src/view.c index 2b01cce8..c520a947 100644 --- a/src/view.c +++ b/src/view.c @@ -1050,12 +1050,12 @@ view_cascade(struct view *view) * top-left corner is not covered by other views, * shift the candidate to bottom-right. */ - if (box_contains(&candidate, &other) + if (wlr_box_contains_box(&candidate, &other) && !wlr_box_contains_point( &covered, other.x, other.y)) { candidate.x = other.x + offset_x; candidate.y = other.y + offset_y; - if (!box_contains(&usable, &candidate)) { + if (!wlr_box_contains_box(&usable, &candidate)) { /* * If the candidate doesn't fit within * the usable area, fall back to center -- 2.52.0