xdg_shell: fix windows requesting fullscreen on startup

This commit is contained in:
nodscher 2026-06-28 18:20:38 +02:00 committed by Simon Ser
parent e5db9506b4
commit 5f83b27d62

View file

@ -192,15 +192,8 @@ close(struct cg_view *view)
} }
static void 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 * Certain clients do not like figuring out their own window geometry if they
* display in fullscreen mode, so we set it here. * display in fullscreen mode, so we set it here.
@ -209,7 +202,19 @@ 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_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_size(xdg_shell_view->xdg_toplevel, layout_box.width, layout_box.height);
wlr_xdg_toplevel_set_fullscreen(xdg_shell_view->xdg_toplevel, fullscreen); wlr_xdg_toplevel_set_fullscreen(xdg_shell_view->xdg_toplevel, fullscreen);
wlr_foreign_toplevel_handle_v1_set_fullscreen(xdg_shell_view->view.foreign_toplevel_handle, 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->initialized) {
return;
}
set_fullscreen(xdg_shell_view, fullscreen);
} }
static void static void
@ -243,15 +248,24 @@ handle_xdg_toplevel_commit(struct wl_listener *listener, void *data)
{ {
struct cg_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, commit); struct cg_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, commit);
if (xdg_shell_view->xdg_toplevel->base->surface->mapped) {
wlr_foreign_toplevel_handle_v1_set_fullscreen(xdg_shell_view->view.foreign_toplevel_handle,
xdg_shell_view->xdg_toplevel->current.fullscreen);
}
if (!xdg_shell_view->xdg_toplevel->base->initial_commit) { if (!xdg_shell_view->xdg_toplevel->base->initial_commit) {
return; return;
} }
wlr_xdg_toplevel_set_wm_capabilities(xdg_shell_view->xdg_toplevel, XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); 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 if (xdg_shell_view->xdg_toplevel->requested.fullscreen) {
* reply with a configure so the client can map the surface. */ set_fullscreen(xdg_shell_view, true);
view_position(&xdg_shell_view->view); } 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 static void