From a1669267b3a6006c8b3b4574040a53528f22037e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Apr 2021 12:32:48 +0530 Subject: [PATCH] Fix hiding on window decorations not working with new CSD code --- glfw/wl_client_side_decorations.c | 3 +++ glfw/wl_window.c | 16 ++++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/glfw/wl_client_side_decorations.c b/glfw/wl_client_side_decorations.c index 5e6760d3b..96df5108e 100644 --- a/glfw/wl_client_side_decorations.c +++ b/glfw/wl_client_side_decorations.c @@ -159,6 +159,7 @@ create_csd_surfaces(_GLFWwindow *window, _GLFWWaylandCSDEdge *s) { bool ensure_csd_resources(_GLFWwindow *window) { + if (!window->decorated || window->wl.decorations.serverSide) return false; const bool is_focused = window->id == _glfw.focusedWindowId; const bool focus_changed = is_focused != decs.for_window_state.focused; const bool size_changed = ( @@ -212,11 +213,13 @@ free_all_csd_resources(_GLFWwindow *window) { void resize_csd(_GLFWwindow *window) { + if (!window->decorated || window->wl.decorations.serverSide) return; ensure_csd_resources(window); } void change_csd_title(_GLFWwindow *window) { + if (!window->decorated || window->wl.decorations.serverSide) return; if (ensure_csd_resources(window)) return; // CSD were re-rendered for other reasons if (decs.top.surface) { update_title_bar(window); diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 1750e476d..3ce69fdf9 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -257,13 +257,6 @@ static void dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, in } -static void -createDecorations(_GLFWwindow* window) { - if (!window->decorated || window->wl.decorations.serverSide) return; - - ensure_csd_resources(window); -} - static void xdgDecorationHandleConfigure(void* data, struct zxdg_toplevel_decoration_v1* decoration UNUSED, uint32_t mode) @@ -272,8 +265,7 @@ static void xdgDecorationHandleConfigure(void* data, window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); - if (!window->wl.decorations.serverSide) - createDecorations(window); + if (!window->wl.decorations.serverSide) ensure_csd_resources(window); } static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = { @@ -391,7 +383,7 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, bool on) } else { xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); if (!_glfw.wl.decorationManager) - createDecorations(window); + ensure_csd_resources(window); } } setIdleInhibitor(window, on); @@ -503,7 +495,7 @@ static void setXdgDecorations(_GLFWwindow* window) else { window->wl.decorations.serverSide = false; - createDecorations(window); + ensure_csd_resources(window); } } @@ -1086,7 +1078,7 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled) if (!window->monitor) { if (enabled) - createDecorations(window); + ensure_csd_resources(window); else free_csd_surfaces(window); }