From 23e40548b15db9a53a755d152d1fd2072c39610e 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. --- README.md | 1 + src/wl_window.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index d0a40c34..52081c1c 100644 --- a/README.md +++ b/README.md @@ -387,6 +387,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450) - [Wayland] Bugfix: Joysticks connected after `glfwInit` were not detected (#2198) - [Wayland] Bugfix: Fallback decorations emitted `GLFW_CURSOR_UNAVAILABLE` errors + - [Wayland] Bugfix: Showing an undecorated window would cause a protocol error - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043) diff --git a/src/wl_window.c b/src/wl_window.c index c7dd62b0..8292dcd6 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -750,6 +750,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.appId)) libdecor_frame_set_app_id(window->wl.libdecor.frame, window->wl.appId);