aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-05-24 09:26:34 +0300
committerSimon Ser <contact@emersion.fr>2023-05-24 08:55:15 +0000
commitdc6402d1536d355c14d072b7ebfb1f25256099dc (patch)
treea7d08c25f763acf3de989d27aa01c582a7d69a0f /util
parent09f5a005854094a67e9408f0f85cb28af0b9c987 (diff)
util/box: transform empty boxes' origins
Not a huge fan of this, but changing this behavior would be a breaking change to a stable API. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3650
Diffstat (limited to 'util')
-rw-r--r--util/box.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/util/box.c b/util/box.c
index 46c8c5d6..bc2c60dd 100644
--- a/util/box.c
+++ b/util/box.c
@@ -71,13 +71,11 @@ bool wlr_box_contains_point(const struct wlr_box *box, double x, double y) {
void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
enum wl_output_transform transform, int width, int height) {
- if (wlr_box_empty(box)) {
- *dest = (struct wlr_box){0};
- return;
+ struct wlr_box src = {0};
+ if (box != NULL) {
+ src = *box;
}
- struct wlr_box src = *box;
-
if (transform % 2 == 0) {
dest->width = src.width;
dest->height = src.height;
@@ -128,13 +126,11 @@ bool wlr_fbox_empty(const struct wlr_fbox *box) {
void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box,
enum wl_output_transform transform, double width, double height) {
- if (wlr_fbox_empty(box)) {
- *dest = (struct wlr_fbox){0};
- return;
+ struct wlr_fbox src = {0};
+ if (box != NULL) {
+ src = *box;
}
- struct wlr_fbox src = *box;
-
if (transform % 2 == 0) {
dest->width = src.width;
dest->height = src.height;