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.
This commit is contained in:
copilot-swe-agent[bot]
2026-05-28 02:07:59 +00:00
committed by GitHub
parent 3fc5bed364
commit 0146b02aaf
+9 -2
View File
@@ -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);
}