From 17959aad33a75e050f606cc49b8ac6eaaa005399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 22:36:23 +0200 Subject: [PATCH] Wayland: Fix GLFW_DECORATED for XDG decorations On a compositor that supports server-side decorations, they were always enabled in windowed mode, even if GLFW_DECORATED was cleared. (cherry picked from commit f35e2274cbf253b659e9847354fe72d7b45dcc9a) --- README.md | 2 ++ src/wl_window.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6b789908..527947a8 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show - [Wayland] Bugfix: Hiding and then showing a window caused program abort on wlroots compositors (#1268) + - [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG + decorations ## Contact diff --git a/src/wl_window.c b/src/wl_window.c index 459f4b5b..a98b62ca 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -678,9 +678,15 @@ static GLFWbool createShellObjects(_GLFWwindow* window) zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, &xdgDecorationListener, window); - zxdg_toplevel_decoration_v1_set_mode( - window->wl.xdg.decoration, - ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + + uint32_t mode; + + if (window->decorated) + 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 createFallbackDecorations(window);