Show Desktop: activateNextClient prefers desktop

othrwise closing a keepabove or desktop group
window would activate some random window and break
the state as a side-effect

REVIEW: 123783
CCBUG: 346837
CCBUG: 346933
CCBUG: 347212
This commit is contained in:
Thomas Lübking 2015-05-13 23:35:37 +02:00
parent 43e3b7db28
commit eb789e43e3

View file

@ -463,6 +463,11 @@ bool Workspace::activateNextClient(Client* c)
get_focus = NULL; get_focus = NULL;
} }
const int desktop = VirtualDesktopManager::self()->current();
if (!get_focus && showingDesktop())
get_focus = findDesktop(true, desktop); // to not break the state
if (!get_focus && options->isNextFocusPrefersMouse()) { if (!get_focus && options->isNextFocusPrefersMouse()) {
get_focus = clientUnderMouse(c ? c->screen() : screens()->current()); get_focus = clientUnderMouse(c ? c->screen() : screens()->current());
if (get_focus && (get_focus == c || get_focus->isDesktop())) { if (get_focus && (get_focus == c || get_focus->isDesktop())) {
@ -471,8 +476,6 @@ bool Workspace::activateNextClient(Client* c)
} }
} }
const int desktop = VirtualDesktopManager::self()->current();
if (!get_focus) { // no suitable window under the mouse -> find sth. else if (!get_focus) { // no suitable window under the mouse -> find sth. else
// first try to pass the focus to the (former) active clients leader // first try to pass the focus to the (former) active clients leader
if (c && (get_focus = c->transientFor()) && FocusChain::self()->isUsableFocusCandidate(get_focus, c)) { if (c && (get_focus = c->transientFor()) && FocusChain::self()->isUsableFocusCandidate(get_focus, c)) {