X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FWorkspace.cc;h=0a95c24f04e644a76d2f98cc2f59e69e41fc8995;hb=df7120d5ff0942dcae5a20bed79052e7be9bc1d1;hp=9bbc617f70b60b3a35da45a2b9ff1373c83a7986;hpb=4b339891e7b680cc780f572889be5c7b9abb114e;p=chaz%2Fopenbox diff --git a/src/Workspace.cc b/src/Workspace.cc index 9bbc617f..0a95c24f 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -91,6 +91,16 @@ void Workspace::addWindow(BlackboxWindow *w, bool place) { clientmenu->update(); screen->updateNetizenWindowAdd(w->getClientWindow(), id); + + if (id != screen->getCurrentWorkspaceID() && + screen->doFocusNew()) { + /* + not on the focused workspace, so the window is not going to get focus + but if the user wants new windows focused, then it should get focus + when this workspace does become focused. + */ + lastfocus = w; + } } if (! w->isDesktop()) @@ -184,20 +194,24 @@ void Workspace::focusFallback(const BlackboxWindow *old_window) { void Workspace::showAll(void) { - std::for_each(stackingList.begin(), stackingList.end(), - std::mem_fun(&BlackboxWindow::show)); + BlackboxWindowList::iterator it = stackingList.begin(); + const BlackboxWindowList::iterator end = stackingList.end(); + for (; it != end; ++it) { + BlackboxWindow *bw = *it; + if (! bw->isStuck()) + bw->show(); + } } void Workspace::hideAll(void) { // withdraw in reverse order to minimize the number of Expose events - - BlackboxWindowList lst(stackingList.rbegin(), stackingList.rend()); - - BlackboxWindowList::iterator it = lst.begin(); - const BlackboxWindowList::iterator end = lst.end(); - for (; it != end; ++it) { + BlackboxWindowList::reverse_iterator it = stackingList.rbegin(); + const BlackboxWindowList::reverse_iterator end = stackingList.rend(); + while (it != end) { BlackboxWindow *bw = *it; + ++it; // withdraw removes the current item from the list so we need the next + // iterator before that happens if (! bw->isStuck()) bw->withdraw(); }