From d4f74457493f1698103bfdcbfbda60d5a7e9952d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 12 Mar 2015 13:43:39 +0100 Subject: [PATCH] Remove remaining Client usage from FocusChain --- activation.cpp | 4 ++-- focuschain.cpp | 11 +++++------ focuschain.h | 7 +++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/activation.cpp b/activation.cpp index 56e8d9a04f..243d061239 100644 --- a/activation.cpp +++ b/activation.cpp @@ -455,7 +455,7 @@ bool Workspace::activateNextClient(Client* c) if (!options->focusPolicyIsReasonable()) return false; - Client* get_focus = NULL; + AbstractClient* get_focus = NULL; // precedence on keeping the current tabgroup active. to the user that's the same window if (c && c->tabGroup() && c->isShown(false)) { @@ -506,7 +506,7 @@ void Workspace::setCurrentScreen(int new_screen) return; closeActivePopup(); const int desktop = VirtualDesktopManager::self()->current(); - Client *get_focus = FocusChain::self()->getForActivation(desktop, new_screen); + AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen); if (get_focus == NULL) get_focus = findDesktop(true, desktop); if (get_focus != NULL && get_focus != mostRecentlyActivatedClient()) diff --git a/focuschain.cpp b/focuschain.cpp index 4556c38113..c62a7a14c6 100644 --- a/focuschain.cpp +++ b/focuschain.cpp @@ -19,7 +19,6 @@ along with this program. If not, see . *********************************************************************/ #include "focuschain.h" #include "abstract_client.h" -#include "client.h" #include "screens.h" namespace KWin @@ -60,12 +59,12 @@ void FocusChain::resize(uint previousSize, uint newSize) } } -Client *FocusChain::getForActivation(uint desktop) const +AbstractClient *FocusChain::getForActivation(uint desktop) const { return getForActivation(desktop, screens()->current()); } -Client *FocusChain::getForActivation(uint desktop, int screen) const +AbstractClient *FocusChain::getForActivation(uint desktop, int screen) const { DesktopChains::const_iterator it = m_desktopFocusChains.find(desktop); if (it == m_desktopFocusChains.constEnd()) { @@ -77,7 +76,7 @@ Client *FocusChain::getForActivation(uint desktop, int screen) const // TODO: move the check into Client if (tmp->isShown(false) && tmp->isOnCurrentActivity() && ( !m_separateScreenFocus || tmp->screen() == screen)) { - return dynamic_cast(tmp); + return tmp; } } return NULL; @@ -220,7 +219,7 @@ bool FocusChain::isUsableFocusCandidate(AbstractClient *c, AbstractClient *prev) (!m_separateScreenFocus || c->isOnScreen(prev ? prev->screen() : screens()->current())); } -Client *FocusChain::nextForDesktop(AbstractClient *reference, uint desktop) const +AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint desktop) const { DesktopChains::const_iterator it = m_desktopFocusChains.find(desktop); if (it == m_desktopFocusChains.end()) { @@ -230,7 +229,7 @@ Client *FocusChain::nextForDesktop(AbstractClient *reference, uint desktop) cons for (int i = chain.size() - 1; i >= 0; --i) { auto client = chain.at(i); if (isUsableFocusCandidate(client, reference)) { - return dynamic_cast(client); + return client; } } return NULL; diff --git a/focuschain.h b/focuschain.h index 0ba6136918..886b37ea96 100644 --- a/focuschain.h +++ b/focuschain.h @@ -29,7 +29,6 @@ namespace KWin { // forward declarations class AbstractClient; -class Client; /** * @brief Singleton class to handle the various focus chains. @@ -99,7 +98,7 @@ public: * @param desktop The virtual desktop to look for a Client for activation * @return :Client* The Client which could be activated or @c null if there is none. **/ - Client *getForActivation(uint desktop) const; + AbstractClient *getForActivation(uint desktop) const; /** * @brief Finds the best Client to become the new active Client in the focus chain for the given * virtual @p desktop on the given @p screen. @@ -112,7 +111,7 @@ public: * @param screen The screen to constrain the search on with separate screen focus * @return :Client* The Client which could be activated or @c null if there is none. **/ - Client *getForActivation(uint desktop, int screen) const; + AbstractClient *getForActivation(uint desktop, int screen) const; /** * @brief Checks whether the most recently used focus chain contains the given @p client. @@ -157,7 +156,7 @@ public: * @param desktop The virtual desktop whose focus chain should be used * @return :Client* The next usable Client or @c null if none can be found. **/ - Client *nextForDesktop(AbstractClient *reference, uint desktop) const; + AbstractClient *nextForDesktop(AbstractClient *reference, uint desktop) const; /** * @brief Returns the first Client in the most recently used focus chain. First Client in this * case means really the first Client in the chain and not the most recently used Client.