cursor: ensure mapping box is always initialized

Commit 498f30aad1 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
This commit is contained in:
Kirill Primak 2022-01-31 20:55:52 +03:00
parent ab3b9f9a77
commit 3cfe29b598

View file

@ -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)) {