From 3a4c0e5bc63badc3da26e167823f3f8c85e9e210 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 23 Nov 2021 17:43:27 +0100 Subject: [PATCH] make floating windows on top on each new window --- src/events/events.cpp | 5 ++--- src/windowManager.cpp | 9 +++++++++ src/windowManager.hpp | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/events/events.cpp b/src/events/events.cpp index 0a89b80..b1e6499 100644 --- a/src/events/events.cpp +++ b/src/events/events.cpp @@ -128,9 +128,8 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating) { g_pWindowManager->setFocusedWindow(windowID); - float values[1]; - values[0] = XCB_STACK_MODE_BELOW; - xcb_configure_window(g_pWindowManager->DisplayConnection, windowID, XCB_CONFIG_WINDOW_STACK_MODE, values); + // Make all floating windows above + g_pWindowManager->setAllFloatingWindowsTop(); return g_pWindowManager->getWindowFromDrawable(windowID); } diff --git a/src/windowManager.cpp b/src/windowManager.cpp index 6bcf46d..8a10ea7 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -900,3 +900,12 @@ void CWindowManager::updateBarInfo() { statusBar.setCurrentWorkspace(activeWorkspaces[getMonitorFromCursor()->ID]); } + +void CWindowManager::setAllFloatingWindowsTop() { + for (auto& window : windows) { + if (window.getIsFloating()) { + Values[0] = XCB_STACK_MODE_ABOVE; + xcb_configure_window(g_pWindowManager->DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_STACK_MODE, Values); + } + } +} \ No newline at end of file diff --git a/src/windowManager.hpp b/src/windowManager.hpp index 4fb4dde..794e3b2 100644 --- a/src/windowManager.hpp +++ b/src/windowManager.hpp @@ -63,6 +63,7 @@ public: bool isWorkspaceVisible(int workspaceID); void setAllWindowsDirty(); + void setAllFloatingWindowsTop(); SMonitor* getMonitorFromWindow(CWindow*); SMonitor* getMonitorFromCursor();