#endif
ob_debug_type(OB_DEBUG_FOCUS, "trying omnipresentness\n");
- if (allow_refocus && old && old->desktop == DESKTOP_ALL)
+ if (allow_refocus && old && old->desktop == DESKTOP_ALL &&
+ client_normal(old))
+ {
return old;
+ }
ob_debug_type(OB_DEBUG_FOCUS, "trying the focus order\n");
a splashscreen or a desktop window (save the desktop as a
backup fallback though)
*/
- if (client_can_focus(c) && c->desktop == screen_desktop &&
- !c->iconic)
+ if (client_can_focus(c) && !c->iconic)
{
- if (client_normal(c)) {
+ if (c->desktop == screen_desktop && client_normal(c)) {
ob_debug_type(OB_DEBUG_FOCUS, "found in focus order\n");
return it->data;
- } else if (c->type == OB_CLIENT_TYPE_DESKTOP && !desktop)
+ } else if ((c->desktop == screen_desktop ||
+ c->desktop == DESKTOP_ALL) &&
+ c->type == OB_CLIENT_TYPE_DESKTOP &&
+ desktop == NULL)
desktop = c;
}
}
/* as a last resort fallback to the desktop window if there is one.
(if there's more than one, then the one most recently focused.)
*/
+ ob_debug_type(OB_DEBUG_FOCUS, "found desktop: \n", !!desktop);
return desktop;
}