aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2024-01-31 20:44:01 +0300
committerSimon Zeni <simon@bl4ckb0ne.ca>2024-02-01 14:42:00 +0000
commit56cc25185d440616e264f26a35d02d708479956a (patch)
tree03f8b697ea02a078dbf26b8e6f136b57726f8ed2
parent60af3b6b78365f26247187593fbb722515719027 (diff)
cursor: fix and simplify region mapping
Fixes: 4462f5dcb38b8b4ddc4c1eb888aa0d0c859a10a1
-rw-r--r--types/wlr_cursor.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c
index cc37ef70..a1d6b042 100644
--- a/types/wlr_cursor.c
+++ b/types/wlr_cursor.c
@@ -1179,21 +1179,11 @@ void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
void wlr_cursor_map_to_region(struct wlr_cursor *cur,
const struct wlr_box *box) {
- cur->state->mapped_box = (struct wlr_box){0};
-
- if (box) {
- if (wlr_box_empty(box)) {
- wlr_log(WLR_ERROR, "cannot map cursor to an empty region");
- return;
- }
- cur->state->mapped_box = *box;
- }
+ cur->state->mapped_box = wlr_box_empty(box) ? (struct wlr_box){0} : *box;
}
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
struct wlr_input_device *dev, const struct wlr_box *box) {
- cur->state->mapped_box = (struct wlr_box){0};
-
struct wlr_cursor_device *c_device = get_cursor_device(cur, dev);
if (!c_device) {
wlr_log(WLR_ERROR, "Cannot map device \"%s\" to geometry (not found in"
@@ -1201,13 +1191,5 @@ void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
return;
}
- if (box) {
- if (wlr_box_empty(box)) {
- wlr_log(WLR_ERROR,
- "cannot map device \"%s\" input to an empty region",
- dev->name);
- return;
- }
- c_device->mapped_box = *box;
- }
+ c_device->mapped_box = wlr_box_empty(box) ? (struct wlr_box){0} : *box;
}