Wayland: Fix protocol error on undecorated window

When setting the visibility of a libdecor frame on a compositor that
supports XDG decorations, libdecor 0.1 will update the geometry of the
XDG surface.  GLFW attempted to set the visibility before having told
libdecor what size the content area is.  This caused a Wayland protocol
error when libdecor attempted to set the window size to 0x0.

This commit adds setting the content area size for the libdecor frame
directly after creation, allowing libdecor to know what it's doing.

(cherry picked from commit 23e40548b1)
This commit is contained in:
Camilla Löwy 2023-11-29 16:25:29 +01:00
parent 7cc8879ab9
commit 9809035ed2

View File

@ -789,6 +789,11 @@ static GLFWbool createLibdecorFrame(_GLFWwindow* window)
return GLFW_FALSE; 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.title)) if (strlen(window->wl.title))
libdecor_frame_set_title(window->wl.libdecor.frame, window->wl.title); libdecor_frame_set_title(window->wl.libdecor.frame, window->wl.title);