Fix active output segfault when view is off screen

When a new view has just been created (i.e. we're running the
kiwmi:on( "view", ... callback ), that window can be in a weird
position, off all the existing outputs.  Because the code for getting
the active output asks for the output at that window's position, it can
get back NULL and then segfault when trying to return wlr_output->data.

Now, if there's no output at the window's position, the code just moves
on to look at the cursor.
This commit is contained in:
Uks2 2022-06-03 19:44:40 +01:00
parent 822e5b5063
commit ec5f7bdb2b

View file

@ -112,8 +112,10 @@ desktop_active_output(struct kiwmi_server *server)
struct wlr_output *wlr_output =
wlr_output_layout_output_at(server->desktop.output_layout, lx, ly);
if (wlr_output) {
return wlr_output->data;
}
}
// 3. cursor
double lx = server->input.cursor->cursor->x;