menu.c: Handle out of screen submenus

Fixes #276
This commit is contained in:
Consolatis 2022-03-16 05:51:36 +01:00 committed by Johan Malm
parent 5fd5024ca6
commit 428423cfa9

View file

@ -357,6 +357,12 @@ menu_configure(struct menu *menu, int lx, int ly, enum menu_align align)
double oy = ly;
struct wlr_output *wlr_output = wlr_output_layout_output_at(
menu->server->output_layout, lx, ly);
if (!wlr_output) {
wlr_log(WLR_ERROR,
"Failed to position menu %s (%s) and its submenus: "
"Not enough screen space", menu->id, menu->label);
return;
}
wlr_output_layout_output_coords(menu->server->output_layout,
wlr_output, &ox, &oy);
struct wlr_box usable = output_usable_area_from_cursor_coords(menu->server);