From 597a9da77fc490ecc49971cde903edfec968c5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 30 Apr 2015 13:47:44 +0200 Subject: [PATCH] Workspace::activateNextClient and clientHidden operate on AbstractClient This is required to change the active_client after the active_client closes. --- activation.cpp | 9 ++++++--- workspace.h | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/activation.cpp b/activation.cpp index aa8120debf..1acbb047ff 100644 --- a/activation.cpp +++ b/activation.cpp @@ -402,7 +402,7 @@ void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags) \a c may already be destroyed */ -void Workspace::clientHidden(Client* c) +void Workspace::clientHidden(AbstractClient* c) { assert(!c->isShown(true) || !c->isOnCurrentDesktop() || !c->isOnCurrentActivity()); activateNextClient(c); @@ -431,7 +431,7 @@ Client *Workspace::clientUnderMouse(int screen) const } // deactivates 'c' and activates next client -bool Workspace::activateNextClient(Client* c) +bool Workspace::activateNextClient(AbstractClient* c) { // if 'c' is not the active or the to-become active one, do nothing if (!(c == active_client || (should_get_focus.count() > 0 && c == should_get_focus.last()))) @@ -478,7 +478,10 @@ bool Workspace::activateNextClient(Client* c) if (!get_focus) { // no suitable window under the mouse -> find sth. else // 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 (Client *client = qobject_cast(c)) { + get_focus = client->transientFor(); + } + if (c && get_focus && FocusChain::self()->isUsableFocusCandidate(get_focus, c)) { raiseClient(get_focus); // also raise - we don't know where it came from } else { // nope, ask the focus chain for the next candidate diff --git a/workspace.h b/workspace.h index fb753e3df4..24c52be293 100644 --- a/workspace.h +++ b/workspace.h @@ -162,7 +162,7 @@ public: void restoreFocus(); void gotFocusIn(const Client*); void setShouldGetFocus(Client*); - bool activateNextClient(Client* c); + bool activateNextClient(AbstractClient* c); bool focusChangeEnabled() { return block_focus == 0; } @@ -187,7 +187,7 @@ public: void updateStackingOrder(bool propagate_new_clients = false); void forceRestacking(); - void clientHidden(Client*); + void clientHidden(AbstractClient*); void clientAttentionChanged(AbstractClient* c, bool set); /**