From 9809035ed2aaab0cc7136f87d08428de7da1473d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 29 Nov 2023 16:25:29 +0100 Subject: [PATCH] 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 23e40548b15db9a53a755d152d1fd2072c39610e) --- src/wl_window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wl_window.c b/src/wl_window.c index a9c71b6e..7b0737e7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -789,6 +789,11 @@ 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.title)) libdecor_frame_set_title(window->wl.libdecor.frame, window->wl.title);