From 9352d8fe93cd443be18157abe81f16500549aec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 12 Jan 2026 19:16:35 +0100 Subject: [PATCH] X11: Cleanup --- src/x11_window.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index 5fc42b4a2..9a84e5c72 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2713,19 +2713,20 @@ void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled) // NOTE: We don't check for failure as this property may not exist yet // and that's fine (and we'll create it implicitly with append) - if (states) + unsigned long i; + + for (i = 0; i < count; i++) { - for (unsigned long i = 0; i < count; i++) - { - if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE) - { - states[i] = states[count - 1]; - XChangeProperty(_glfw.x11.display, window->x11.handle, - _glfw.x11.NET_WM_STATE, XA_ATOM, 32, - PropModeReplace, (unsigned char*) states, count - 1); - break; - } - } + if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE) + break; + } + + if (i < count) + { + states[i] = states[count - 1]; + XChangeProperty(_glfw.x11.display, window->x11.handle, + _glfw.x11.NET_WM_STATE, XA_ATOM, 32, + PropModeReplace, (unsigned char*) states, count - 1); } if (states)