xdg_shell: fix windows requesting fullscreen on startup

This commit is contained in:
Hanno 2026-06-18 18:47:19 +02:00
parent e5db9506b4
commit cee8e52055

View file

@ -192,15 +192,8 @@ close(struct cg_view *view)
}
static void
handle_xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *data)
set_fullscreen(struct cg_xdg_shell_view *xdg_shell_view, bool fullscreen)
{
struct cg_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, request_fullscreen);
bool fullscreen = xdg_shell_view->xdg_toplevel->requested.fullscreen;
if (!xdg_shell_view->xdg_toplevel->base->surface->mapped) {
return;
}
/**
* Certain clients do not like figuring out their own window geometry if they
* display in fullscreen mode, so we set it here.
@ -209,6 +202,24 @@ handle_xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *data)
wlr_output_layout_get_box(xdg_shell_view->view.server->output_layout, NULL, &layout_box);
wlr_xdg_toplevel_set_size(xdg_shell_view->xdg_toplevel, layout_box.width, layout_box.height);
wlr_xdg_toplevel_set_fullscreen(xdg_shell_view->xdg_toplevel, fullscreen);
}
static void
handle_xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *data)
{
struct cg_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, request_fullscreen);
bool fullscreen = xdg_shell_view->xdg_toplevel->requested.fullscreen;
if (!xdg_shell_view->xdg_toplevel->base->initial_commit) {
return;
}
set_fullscreen(xdg_shell_view, fullscreen);
if (!xdg_shell_view->xdg_toplevel->base->surface->mapped) {
return;
}
wlr_foreign_toplevel_handle_v1_set_fullscreen(xdg_shell_view->view.foreign_toplevel_handle, fullscreen);
}
@ -235,6 +246,8 @@ handle_xdg_toplevel_map(struct wl_listener *listener, void *data)
if (xdg_shell_view->xdg_toplevel->app_id)
wlr_foreign_toplevel_handle_v1_set_app_id(view->foreign_toplevel_handle,
xdg_shell_view->xdg_toplevel->app_id);
wlr_foreign_toplevel_handle_v1_set_fullscreen(view->foreign_toplevel_handle,
xdg_shell_view->xdg_toplevel->current.fullscreen);
/* Activation state will be set by seat_set_focus */
}
@ -249,9 +262,14 @@ handle_xdg_toplevel_commit(struct wl_listener *listener, void *data)
wlr_xdg_toplevel_set_wm_capabilities(xdg_shell_view->xdg_toplevel, XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
/* When an xdg_surface performs an initial commit, the compositor must
* reply with a configure so the client can map the surface. */
view_position(&xdg_shell_view->view);
if (xdg_shell_view->xdg_toplevel->requested.fullscreen) {
set_fullscreen(xdg_shell_view, true);
}
else {
/* When an xdg_surface performs an initial commit, the compositor must
* reply with a configure so the client can map the surface. */
view_position(&xdg_shell_view->view);
}
}
static void