+void Workspace::hide(void) {
+ BlackboxWindow *focused = screen->getBlackbox()->getFocusedWindow();
+ if (focused && focused->getScreen() == screen) {
+ assert(focused->isStuck() || focused->getWorkspaceNumber() == id);
+
+ lastfocus = focused;
+ } else {
+ // if no window had focus, no need to store a last focus
+ lastfocus = (BlackboxWindow *) 0;
+ }
+
+ // when we switch workspaces, unfocus whatever was focused
+ screen->getBlackbox()->setFocusedWindow((BlackboxWindow *) 0);
+
+ // withdraw windows in reverse order to minimize the number of Expose events
+
+ BlackboxWindowList::reverse_iterator it = stackingList.rbegin();
+ const BlackboxWindowList::reverse_iterator end = stackingList.rend();
+ for (; it != end; ++it) {
+ BlackboxWindow *bw = *it;
+ // not normal windows cant focus from mouse enters anyways, so we dont
+ // need to unmap/remap them on workspace changes
+ if (! bw->isStuck() || bw->isNormal())
+ bw->withdraw();
+ }
+}
+
+
+void Workspace::show(void) {
+ std::for_each(stackingList.begin(), stackingList.end(),
+ std::mem_fun(&BlackboxWindow::show));
+
+ XSync(screen->getBlackbox()->getXDisplay(), False);
+
+ if (screen->doFocusLast()) {
+ if (! screen->isSloppyFocus() && ! lastfocus && ! stackingList.empty())
+ lastfocus = stackingList.front();
+
+ if (lastfocus)
+ lastfocus->setInputFocus();
+ }
+}
+
+