- if (! newfocus) {
- BlackboxWindowList::iterator it = stackingList.begin(),
- end = stackingList.end();
- for (; it != end; ++it) {
- BlackboxWindow *tmp = *it;
- if (tmp && tmp->setInputFocus()) {
- // we found our new focus target
- newfocus = tmp;
- break;
+ if (! newfocus ||
+ newfocus->isIconic() || // do not focus icons
+ newfocus->getWorkspaceNumber() != id || // or other workspaces
+ ! newfocus->setInputFocus())
+ newfocus = 0;
+ }
+
+ if (! newfocus) {
+ BlackboxWindowList::iterator it = stackingList.begin(),
+ end = stackingList.end();
+ for (; it != end; ++it) {
+ BlackboxWindow *tmp = *it;
+ if (! (tmp->windowType() == BlackboxWindow::Type_Dialog ||
+ tmp->windowType() == BlackboxWindow::Type_Normal))
+ continue; // don't fallback to special windows
+ if (tmp && tmp->setInputFocus()) {
+ // we found our new focus target
+ newfocus = tmp;
+ break;
+ }