From 8cb1108f4e281421e59d04dcac0b937e932160c8 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 13 Jul 2002 21:25:19 +0000 Subject: [PATCH] properly lower windows and keep desktop windows on the bottom. --- src/Screen.cc | 26 ++++++++++++++++++++------ src/Screen.hh | 2 +- src/Workspace.cc | 5 +---- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 99224350..0186e97b 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1380,13 +1380,27 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) { } -void BScreen::lowerDesktops(void) { - if (desktopWindowList.empty()) return; +void BScreen::lowerWindows(Window *workspace_stack, unsigned int num) { + assert(num > 0); // this would cause trouble in the XRaiseWindow call - XLowerWindow(blackbox->getXDisplay(), desktopWindowList[0]); - if (desktopWindowList.size() > 1) - XRestackWindows(blackbox->getXDisplay(), &desktopWindowList[0], - desktopWindowList.size()); + Window *session_stack = new Window[(num + desktopWindowList.size())]; + unsigned int i = 0, k = num; + + XLowerWindow(blackbox->getXDisplay(), workspace_stack[0]); + + while (k--) + *(session_stack + i++) = *(workspace_stack + k); + + WindowList::iterator dit = desktopWindowList.begin(); + const WindowList::iterator d_end = desktopWindowList.end(); + for (; dit != d_end; ++dit) + *(session_stack + i++) = *dit; + + XRestackWindows(blackbox->getXDisplay(), session_stack, i); + + delete [] session_stack; + + updateStackingList(); } diff --git a/src/Screen.hh b/src/Screen.hh index 36a9f3cc..8986803b 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -326,7 +326,7 @@ public: void manageWindow(Window w); void unmanageWindow(BlackboxWindow *w, bool remap); void raiseWindows(Window *workspace_stack, unsigned int num); - void lowerDesktops(void); + void lowerWindows(Window *workspace_stack, unsigned int num); void reassociateWindow(BlackboxWindow *w, unsigned int wkspc_id, bool ignore_sticky); void propagateWindowName(const BlackboxWindow *bw); diff --git a/src/Workspace.cc b/src/Workspace.cc index 9606140d..c017d3e5 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -322,10 +322,7 @@ void Workspace::lowerWindow(BlackboxWindow *w) { wkspc->stackingList.push_back(win); } - XLowerWindow(screen->getBaseDisplay()->getXDisplay(), stack_vector.front()); - XRestackWindows(screen->getBaseDisplay()->getXDisplay(), - &stack_vector[0], stack_vector.size()); - screen->lowerDesktops(); + screen->lowerWindows(&stack_vector[0], stack_vector.size()); } -- 2.45.2