diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2022-01-31 20:55:52 +0300 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2022-01-31 21:00:20 +0300 |
commit | 3cfe29b5988190d7eb32cd0b76a6cfe810be7812 (patch) | |
tree | 49a0df0b1330226cb0c3bb98ca7b0fd088f0dae1 | |
parent | ab3b9f9a773e3ec2c40d80ab14277659b2a55ca6 (diff) |
cursor: ensure mapping box is always initialized
Commit 498f30aad100ca616640c7bcbf11ab8ef7d48c45 changed the logic of
get_mapping() in types/wlr_cursor.c to use updated version of
wlr_output_layout_get_box(). However, the case where c_device isn't NULL
but doesn't have output or geometry mappings wasn't handled properly,
resulting in leaving the output value uninitialized. This commit fixes
`c_device != NULL` branch by returning from the function only when a
mapping is found.
Fixes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3369
-rw-r--r-- | types/wlr_cursor.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index bab5ed10..034628cf 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -248,11 +248,12 @@ static void get_mapping(struct wlr_cursor *cur, if (c_device) { if (!wlr_box_empty(&c_device->mapped_box)) { *box = c_device->mapped_box; + return; } else if (c_device->mapped_output) { wlr_output_layout_get_box(cur->state->layout, c_device->mapped_output, box); + return; } - return; } if (!wlr_box_empty(&cur->state->mapped_box)) { |