Wayland: Fix undecorated libdecor frame creation

In order to safely call libdecor_frame_set_visibility during window
creation, a libdecor frame state was synthesized and committed.

This commit instead postpones the call to libdecor_frame_set_visibility
until after the frame state received by the frame configure event has
been committed.  This appears to be a more polite approach.

Related to #2842
This commit is contained in:
Camilla Löwy
2026-06-15 18:58:30 +02:00
parent dc86d02ff1
commit e94108d9db
3 changed files with 12 additions and 8 deletions
+6 -8
View File
@@ -896,6 +896,10 @@ void libdecorFrameHandleConfigure(struct libdecor_frame* frame,
libdecor_frame_commit(frame, frameState, config);
libdecor_state_free(frameState);
// NOTE: Frame visibility must only be set after a frame state has been committed
if (window->decorated != libdecor_frame_is_visible(window->wl.libdecor.frame))
libdecor_frame_set_visibility(window->wl.libdecor.frame, window->decorated);
if (window->wl.activated != activated)
{
window->wl.activated = activated;
@@ -977,11 +981,6 @@ static GLFWbool createLibdecorFrame(_GLFWwindow* window)
return GLFW_FALSE;
}
struct libdecor_state* frameState =
libdecor_state_new(window->wl.width, window->wl.height);
libdecor_frame_commit(window->wl.libdecor.frame, frameState, NULL);
libdecor_state_free(frameState);
if (strlen(window->wl.appId))
libdecor_frame_set_app_id(window->wl.libdecor.frame, window->wl.appId);
@@ -1017,12 +1016,11 @@ static GLFWbool createLibdecorFrame(_GLFWwindow* window)
}
else
{
// Frame visibility is applied in libdecorFrameHandleConfigure
if (window->wl.maximized)
libdecor_frame_set_maximized(window->wl.libdecor.frame);
if (!window->decorated)
libdecor_frame_set_visibility(window->wl.libdecor.frame, false);
setIdleInhibitor(window, GLFW_FALSE);
}