From 47ade6395dcd94e390f4a02d0a5556a13376d652 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 18 Jul 2026 03:31:22 +1000 Subject: [PATCH] [client] wayland: fix fullscreen option launch bug --- .../Wayland/desktops/libdecor/libdecor.c | 10 ++++++---- client/displayservers/Wayland/desktops/xdg/xdg.c | 9 +++++++-- client/displayservers/Wayland/wayland.c | 9 ++++++++- client/displayservers/Wayland/window.c | 12 ++++++++++++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/client/displayservers/Wayland/desktops/libdecor/libdecor.c b/client/displayservers/Wayland/desktops/libdecor/libdecor.c index 2021bd5e..0eaef2f9 100644 --- a/client/displayservers/Wayland/desktops/libdecor/libdecor.c +++ b/client/displayservers/Wayland/desktops/libdecor/libdecor.c @@ -75,11 +75,7 @@ static void libdecorFrameConfigure(struct libdecor_frame * frame, struct libdecor_configuration * configuration, void * opaque) { if (!state.configured) - { xdg_surface_ack_configure(libdecor_frame_get_xdg_surface(frame), configuration->serial); - state.configured = true; - return; - } int width, height; if (libdecor_configuration_get_content_size(configuration, frame, &width, &height)) @@ -96,6 +92,12 @@ static void libdecorFrameConfigure(struct libdecor_frame * frame, if (libdecor_configuration_get_window_state(configuration, &windowState)) state.fullscreen = windowState & LIBDECOR_WINDOW_STATE_FULLSCREEN; + if (!state.configured) + { + state.configured = true; + return; + } + state.resizeSerial = configuration->serial; waylandNeedsResize(); } diff --git a/client/displayservers/Wayland/desktops/xdg/xdg.c b/client/displayservers/Wayland/desktops/xdg/xdg.c index e6eb7dc8..248f455a 100644 --- a/client/displayservers/Wayland/desktops/xdg/xdg.c +++ b/client/displayservers/Wayland/desktops/xdg/xdg.c @@ -93,8 +93,13 @@ static const struct xdg_surface_listener xdgSurfaceListener = { static void xdgToplevelConfigure(void * data, struct xdg_toplevel * xdgToplevel, int32_t width, int32_t height, struct wl_array * states) { - state.width = width; - state.height = height; + // A zero size means that the compositor is leaving the size up to us. + if (width > 0 && height > 0) + { + state.width = width; + state.height = height; + } + state.fullscreen = false; state.floating = true; diff --git a/client/displayservers/Wayland/wayland.c b/client/displayservers/Wayland/wayland.c index 93aa2fc2..cbbf1c69 100644 --- a/client/displayservers/Wayland/wayland.c +++ b/client/displayservers/Wayland/wayland.c @@ -172,9 +172,16 @@ static bool waylandInit(const LG_DSInitParams params) params.borderless, params.resizable)) return false; - if (!waylandEGLInit(params.w, params.h)) + int width, height; + wlWm.desktop->getSize(&width, &height); + + if (!waylandEGLInit(waylandScaleMulInt(wlWm.scale, width), + waylandScaleMulInt(wlWm.scale, height))) return false; + app_handleResizeEvent(width, height, waylandScaleToDouble(wlWm.scale), + (struct Border) {0, 0, 0, 0}); + waylandIconInit(); #ifdef ENABLE_OPENGL diff --git a/client/displayservers/Wayland/window.c b/client/displayservers/Wayland/window.c index 14637ab0..5b1087ac 100644 --- a/client/displayservers/Wayland/window.c +++ b/client/displayservers/Wayland/window.c @@ -152,6 +152,18 @@ bool waylandWindowInit(const char * title, const char * appId, bool fullscreen, return false; wl_surface_commit(wlWm.surface); + + // The initial configure supplies the compositor-selected size for states + // such as fullscreen. It must be received before the first buffer is made. + while (!wlWm.desktop->configured()) + { + if (wl_display_roundtrip(wlWm.display) < 0) + { + DEBUG_ERROR("Failed waiting for the initial Wayland configure"); + return false; + } + } + return true; }