[client] wayland: fix fullscreen option launch bug

This commit is contained in:
Geoffrey McRae
2026-07-18 03:31:22 +10:00
parent acb5c06794
commit 47ade6395d
4 changed files with 33 additions and 7 deletions

View File

@@ -75,11 +75,7 @@ static void libdecorFrameConfigure(struct libdecor_frame * frame,
struct libdecor_configuration * configuration, void * opaque) struct libdecor_configuration * configuration, void * opaque)
{ {
if (!state.configured) if (!state.configured)
{
xdg_surface_ack_configure(libdecor_frame_get_xdg_surface(frame), configuration->serial); xdg_surface_ack_configure(libdecor_frame_get_xdg_surface(frame), configuration->serial);
state.configured = true;
return;
}
int width, height; int width, height;
if (libdecor_configuration_get_content_size(configuration, frame, &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)) if (libdecor_configuration_get_window_state(configuration, &windowState))
state.fullscreen = windowState & LIBDECOR_WINDOW_STATE_FULLSCREEN; state.fullscreen = windowState & LIBDECOR_WINDOW_STATE_FULLSCREEN;
if (!state.configured)
{
state.configured = true;
return;
}
state.resizeSerial = configuration->serial; state.resizeSerial = configuration->serial;
waylandNeedsResize(); waylandNeedsResize();
} }

View File

@@ -93,8 +93,13 @@ static const struct xdg_surface_listener xdgSurfaceListener = {
static void xdgToplevelConfigure(void * data, struct xdg_toplevel * xdgToplevel, static void xdgToplevelConfigure(void * data, struct xdg_toplevel * xdgToplevel,
int32_t width, int32_t height, struct wl_array * states) int32_t width, int32_t height, struct wl_array * states)
{ {
state.width = width; // A zero size means that the compositor is leaving the size up to us.
state.height = height; if (width > 0 && height > 0)
{
state.width = width;
state.height = height;
}
state.fullscreen = false; state.fullscreen = false;
state.floating = true; state.floating = true;

View File

@@ -172,9 +172,16 @@ static bool waylandInit(const LG_DSInitParams params)
params.borderless, params.resizable)) params.borderless, params.resizable))
return false; 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; return false;
app_handleResizeEvent(width, height, waylandScaleToDouble(wlWm.scale),
(struct Border) {0, 0, 0, 0});
waylandIconInit(); waylandIconInit();
#ifdef ENABLE_OPENGL #ifdef ENABLE_OPENGL

View File

@@ -152,6 +152,18 @@ bool waylandWindowInit(const char * title, const char * appId, bool fullscreen,
return false; return false;
wl_surface_commit(wlWm.surface); 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; return true;
} }