- if (id == screen->getCurrentWorkspaceID()) {
- // The window is on the visible workspace
- focusFallback(w);
- } else {
- // The window is not on the visible workspace.
- if (lastfocus == w) {
- // The window was the last-focus target, so we need to replace it.
- setLastFocusedWindow(stackingList.front());
- }
- // if the window focused on the current workspace, then reapply that
- // workspace's focus too
- if (w->isFocused())
- screen->getCurrentWorkspace()->focusFallback(w);
+ focusFallback(w);
+
+ // if the window is sticky, then it needs to be removed on all other
+ // workspaces too!
+ if (w->isStuck()) {
+ for (unsigned int i = 0; i < screen->getWorkspaceCount(); ++i)
+ if (i != id)
+ screen->getWorkspace(i)->focusFallback(w);