mirror of
https://github.com/labwc/labwc.git
synced 2026-03-05 01:40:24 -05:00
common/box: drop box_contains()
This commit is contained in:
parent
51844c7fc9
commit
7969aa267e
3 changed files with 2 additions and 16 deletions
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
|
|
||||||
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);
|
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 */
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,6 @@
|
||||||
#include "common/box.h"
|
#include "common/box.h"
|
||||||
#include "common/macros.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
|
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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1050,12 +1050,12 @@ view_cascade(struct view *view)
|
||||||
* top-left corner is not covered by other views,
|
* top-left corner is not covered by other views,
|
||||||
* shift the candidate to bottom-right.
|
* shift the candidate to bottom-right.
|
||||||
*/
|
*/
|
||||||
if (box_contains(&candidate, &other)
|
if (wlr_box_contains_box(&candidate, &other)
|
||||||
&& !wlr_box_contains_point(
|
&& !wlr_box_contains_point(
|
||||||
&covered, other.x, other.y)) {
|
&covered, other.x, other.y)) {
|
||||||
candidate.x = other.x + offset_x;
|
candidate.x = other.x + offset_x;
|
||||||
candidate.y = other.y + offset_y;
|
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
|
* If the candidate doesn't fit within
|
||||||
* the usable area, fall back to center
|
* the usable area, fall back to center
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue