mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-21 20:35:58 +01:00
util/box: introduce wlr_fbox_empty
Same as wlr_box_empty, but for wlr_fbox.
This commit is contained in:
parent
7939bf8cc6
commit
fdc22449d6
2 changed files with 15 additions and 3 deletions
|
@ -42,7 +42,7 @@ struct wlr_fbox {
|
|||
|
||||
/**
|
||||
* Finds the closest point within the box bounds
|
||||
*
|
||||
*
|
||||
* Returns NAN if the box is empty
|
||||
*/
|
||||
void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
|
||||
|
@ -59,7 +59,7 @@ bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a,
|
|||
/**
|
||||
* Verifies if a point is contained within the bounds of a given wlr_box.
|
||||
*
|
||||
* For example:
|
||||
* For example:
|
||||
* - A point at (100, 50) is not contained in the box (0, 0, 100, 50).
|
||||
* - A point at (10, 10) is contained in the box (10, 0, 50, 50).
|
||||
*/
|
||||
|
@ -67,7 +67,7 @@ bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
|
|||
|
||||
/**
|
||||
* Checks whether a box is empty or not.
|
||||
*
|
||||
*
|
||||
* A wlr_box is considered empty if its width and/or height is zero or negative.
|
||||
*/
|
||||
bool wlr_box_empty(const struct wlr_box *box);
|
||||
|
@ -78,9 +78,17 @@ bool wlr_box_empty(const struct wlr_box *box);
|
|||
void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
|
||||
enum wl_output_transform transform, int width, int height);
|
||||
|
||||
/**
|
||||
* Checks whether a box is empty or not.
|
||||
*
|
||||
* A wlr_box is considered empty if its width and/or height is zero or negative.
|
||||
*/
|
||||
bool wlr_fbox_empty(const struct wlr_fbox *box);
|
||||
|
||||
/**
|
||||
* Transforms a floating-point box inside a (0, 0, width, height) box.
|
||||
*/
|
||||
void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box,
|
||||
enum wl_output_transform transform, double width, double height);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -120,6 +120,10 @@ void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
|
|||
}
|
||||
}
|
||||
|
||||
bool wlr_fbox_empty(const struct wlr_fbox *box) {
|
||||
return box == NULL || box->width <= 0 || box->height <= 0;
|
||||
}
|
||||
|
||||
void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box,
|
||||
enum wl_output_transform transform, double width, double height) {
|
||||
struct wlr_fbox src = *box;
|
||||
|
|
Loading…
Reference in a new issue