From 229d628ec47073c3778ba2e37c02c8d94140be77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 13 Jun 2022 19:37:34 +0200 Subject: [PATCH] Wayland: Fix toggling of server-side decorations This is a temporary local fix to have updates to GLFW_DECORATED mostly work as intended. The whole decoration state machine needs to be restructured, but not by this commit. --- README.md | 2 ++ src/wl_window.c | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6a76c298..8f3f74d9 100644 --- a/README.md +++ b/README.md @@ -346,6 +346,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically (#1991,#2115,#2127) - [Wayland] Bugfix: Size limits included frame size for fallback decorations + - [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side + decorations - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 0fea1a10..82fcfcd2 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2098,10 +2098,24 @@ void _glfwSetWindowResizableWayland(_GLFWwindow* window, GLFWbool enabled) void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled) { - if (enabled) - createDecorations(window); + if (window->wl.xdg.decoration) + { + uint32_t mode; + + if (enabled) + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE; + else + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; + + zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode); + } else - destroyDecorations(window); + { + if (enabled) + createDecorations(window); + else + destroyDecorations(window); + } } void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled)