From 0146b02aaf1fa6d93bd9b5e44b8ff55bbbc7e66e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 02:07:59 +0000 Subject: [PATCH] Fix #10082: Re-apply _NET_WM_STATE for X11 layer shell windows on each show Some window managers (e.g. kwin_x11) clear _NET_WM_STATE when a window is unmapped/withdrawn. This caused layer shell windows to lose states like _NET_WM_STATE_ABOVE, _NET_WM_STATE_SKIP_TASKBAR, etc. when hidden and re-shown via toggle. The result was inconsistent behaviour between the first show and subsequent shows. Fix by calling update_wm_hints() before XMapWindow in _glfwPlatformShowWindow() for layer shell windows, which re-applies all WM state properties (_NET_WM_STATE, window type, strut, size hints) before each map operation. --- glfw/x11_window.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/glfw/x11_window.c b/glfw/x11_window.c index ae1150a11..8fa76f53b 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -3021,11 +3021,18 @@ void _glfwPlatformShowWindow(_GLFWwindow* window, bool move_to_active_screen UNU if (_glfwPlatformWindowVisible(window)) return; - XMapWindow(_glfw.x11.display, window->x11.handle); - // without this floating window position is incorrect on KDE if (window->x11.layer_shell.is_active) { WindowGeometry wg = calculate_layer_geometry(window); + // Re-apply WM hints before mapping because some window managers (e.g. + // kwin_x11) clear _NET_WM_STATE when a window is unmapped/withdrawn, + // causing _NET_WM_STATE_ABOVE, _NET_WM_STATE_SKIP_TASKBAR and other + // states to be lost on the next map. + update_wm_hints(window, &wg, NULL); + XMapWindow(_glfw.x11.display, window->x11.handle); + // without this floating window position is incorrect on KDE _glfwPlatformSetWindowPos(window, wg.x, wg.y); + } else { + XMapWindow(_glfw.x11.display, window->x11.handle); } waitForVisibilityNotify(window); }