xdg,xwayland: Set initial output for views

This commit is contained in:
John Lindgren 2023-02-03 14:45:04 -05:00 committed by Johan Malm
parent 64bea4f511
commit ed19bc4f9e
2 changed files with 22 additions and 6 deletions

View file

@ -178,6 +178,9 @@ static void
handle_request_maximize(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, request_maximize);
if (!view->mapped && !view->output) {
view->output = output_nearest_to_cursor(view->server);
}
view_maximize(view, xdg_toplevel_from_view(view)->requested.maximized,
/*store_natural_geometry*/ true);
}
@ -186,6 +189,9 @@ static void
handle_request_fullscreen(struct wl_listener *listener, void *data)
{
struct view *view = wl_container_of(listener, view, request_fullscreen);
if (!view->mapped && !view->output) {
view->output = output_nearest_to_cursor(view->server);
}
struct wlr_xdg_toplevel *xdg_toplevel = xdg_toplevel_from_view(view);
struct output *output = output_from_wlr_output(view->server,
xdg_toplevel->requested.fullscreen_output);
@ -317,6 +323,9 @@ xdg_toplevel_view_map(struct view *view)
return;
}
view->mapped = true;
if (!view->output) {
view->output = output_nearest_to_cursor(view->server);
}
struct wlr_xdg_surface *xdg_surface = xdg_surface_from_view(view);
view->surface = xdg_surface->surface;
wlr_scene_node_set_enabled(&view->scene_tree->node, true);