- if (w->getWorkspaceNumber() != BSENTINEL &&
- w->getWindowNumber() != BSENTINEL) {
- getWorkspace(w->getWorkspaceNumber())->removeWindow(w);
- if (w->isStuck()) {
- for (unsigned int i = 0; i < getNumberOfWorkspaces(); ++i)
- if (i != w->getWorkspaceNumber())
- getWorkspace(i)->removeWindow(w, True);
- }
- } else if (w->isIconic())
- removeIcon(w);
-
- if (w->isDesktop()) {
- WindowList::iterator it = desktopWindowList.begin();
- const WindowList::iterator end = desktopWindowList.end();
- for (; it != end; ++it)
- if (*it == w->getFrameWindow()) {
- desktopWindowList.erase(it);
- break;
- }
- assert(it != end); // the window wasnt a desktop window?
- } else { // if (w->isNormal()) {
- // we don't list desktop windows as managed windows
- windowList.remove(w);
- updateClientList();
-
- if (w->isTopmost()) {
- WindowList::iterator it = specialWindowList.begin();
- const WindowList::iterator end = specialWindowList.end();
- for (; it != end; ++it)
- if (*it == w->getFrameWindow()) {
- specialWindowList.erase(it);
- break;
- }
- assert(it != end); // the window wasnt a special window?
- }
- }
-
- if (blackbox->getFocusedWindow() == w)
- blackbox->setFocusedWindow((BlackboxWindow *) 0);
-
- /*
- some managed windows can also be window group controllers. when
- unmanaging such windows, we should also delete the window group.
- */
- BWindowGroup *group = blackbox->searchGroup(w->getClientWindow());
- delete group;
-
- delete w;
-}
-
-
-void BScreen::updateWorkArea(void) {
- if (workspacesList.size() > 0) {
- unsigned long *dims = new unsigned long[4 * workspacesList.size()];
- for (unsigned int i = 0, m = workspacesList.size(); i < m; ++i) {
- // XXX: this could be different for each workspace
- const Rect &area = availableArea();
- dims[(i * 4) + 0] = area.x();
- dims[(i * 4) + 1] = area.y();
- dims[(i * 4) + 2] = area.width();
- dims[(i * 4) + 3] = area.height();
- }
- xatom->setValue(getRootWindow(), XAtom::net_workarea, XAtom::cardinal,
- dims, 4 * workspacesList.size());
- delete [] dims;
- } else
- xatom->setValue(getRootWindow(), XAtom::net_workarea, XAtom::cardinal,
- 0, 0);
-}
-
-
-void BScreen::updateNetizenWorkspaceCount(void) {
- xatom->setValue(getRootWindow(), XAtom::net_number_of_desktops,
- XAtom::cardinal, workspacesList.size());
-
- updateWorkArea();
-}
-
-
-void BScreen::updateNetizenWindowFocus(void) {
- Window f = ((blackbox->getFocusedWindow()) ?
- blackbox->getFocusedWindow()->getClientWindow() : None);
-
- xatom->setValue(getRootWindow(), XAtom::net_active_window,
- XAtom::window, f);
-}
-
-
-void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) {
- // the 13 represents the number of blackbox windows such as menus
- int bbwins = 15;
-#ifdef XINERAMA
- ++bbwins;
-#endif // XINERAMA
-
- Window *session_stack = new
- Window[(num + specialWindowList.size() + bbwins)];
- unsigned int i = 0, k = num;
-
- WindowList::iterator sit, send = specialWindowList.end();
- for (sit = specialWindowList.begin(); sit != send; ++sit)
- *(session_stack + i++) = *sit;
-
- while (k--)
- *(session_stack + i++) = *(workspace_stack + k);
-
- XRestackWindows(blackbox->getXDisplay(), session_stack, i);
-
- delete [] session_stack;
-
- updateStackingList();
-}
-
-
-void BScreen::lowerWindows(Window *workspace_stack, unsigned int num) {
- assert(num > 0); // this would cause trouble in the XRaiseWindow call
-
- 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();
-}
-
-
-void BScreen::reassociateWindow(BlackboxWindow *w, unsigned int wkspc_id,
- bool ignore_sticky) {
- if (! w) return;
-
- if (wkspc_id == BSENTINEL)
- wkspc_id = current_workspace->getID();
-
- if (w->getWorkspaceNumber() == wkspc_id)
- return;
-
- if (w->isIconic()) {
- removeIcon(w);
- getWorkspace(wkspc_id)->addWindow(w);
- if (w->isStuck())
- for (unsigned int i = 0; i < getNumberOfWorkspaces(); ++i)
- if (i != w->getWorkspaceNumber())
- getWorkspace(i)->addWindow(w, True);
- } else if (ignore_sticky || ! w->isStuck()) {
- if (w->isStuck())
- w->stick();
- getWorkspace(w->getWorkspaceNumber())->removeWindow(w);
- getWorkspace(wkspc_id)->addWindow(w);
- }
- updateStackingList();
-}
-
-
-void BScreen::propagateWindowName(const BlackboxWindow *bw) {
- if (bw->isIconic()) {
- } else {
- }
-}
-
-
-void BScreen::nextFocus(void) const {
- BlackboxWindow *focused = blackbox->getFocusedWindow(),
- *next = focused;
-
- if (focused &&
- focused->getScreen()->getScreenNumber() == getScreenNumber() &&
- current_workspace->getCount() > 1) {
- do {
- next = current_workspace->getNextWindowInList(next);
- } while (next != focused && ! next->setInputFocus());
-
- if (next != focused)
- current_workspace->raiseWindow(next);
- } else if (current_workspace->getCount() > 0) {
- next = current_workspace->getTopWindowOnStack();
- next->setInputFocus();
- current_workspace->raiseWindow(next);
- }
-}
-
-
-void BScreen::prevFocus(void) const {
- BlackboxWindow *focused = blackbox->getFocusedWindow(),
- *next = focused;