diff --git a/activation.cpp b/activation.cpp index 9e5dac3ba6..fc93bbdd0a 100644 --- a/activation.cpp +++ b/activation.cpp @@ -722,7 +722,7 @@ xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, c // Otherwise, refuse activation of a window // from already running application if this application // is not the active one (unless focus stealing prevention is turned off). - Client* act = workspace()->mostRecentlyActivatedClient(); + Client* act = dynamic_cast(workspace()->mostRecentlyActivatedClient()); if (act != NULL && !belongToSameApplication(act, this, true)) { bool first_window = true; auto sameApplicationActiveHackPredicate = [this](const Client *cl) { diff --git a/events.cpp b/events.cpp index f79d48066f..2cd292d810 100644 --- a/events.cpp +++ b/events.cpp @@ -491,7 +491,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e) updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp) if (!currentInput.isNull() && (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT)) { //kWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" ; - Client *c = mostRecentlyActivatedClient(); + AbstractClient *c = mostRecentlyActivatedClient(); if (c != NULL) requestFocus(c, true); else if (activateNextClient(NULL)) diff --git a/group.cpp b/group.cpp index 2e9f0edba0..f0c9e1533e 100644 --- a/group.cpp +++ b/group.cpp @@ -1052,7 +1052,7 @@ void Client::checkActiveModal() // if the active window got new modal transient, activate it. // cannot be done in AddTransient(), because there may temporarily // exist loops, breaking findModal - Client* check_modal = workspace()->mostRecentlyActivatedClient(); + Client* check_modal = dynamic_cast(workspace()->mostRecentlyActivatedClient()); if (check_modal != NULL && check_modal->check_active_modal) { Client* new_modal = dynamic_cast(check_modal->findModal()); if (new_modal != NULL && new_modal != check_modal) { diff --git a/layers.cpp b/layers.cpp index a273e8d6ab..32dc02c309 100644 --- a/layers.cpp +++ b/layers.cpp @@ -880,7 +880,7 @@ bool Client::isActiveFullScreen() const if (!isFullScreen()) return false; - const Client* ac = workspace()->mostRecentlyActivatedClient(); // instead of activeClient() - avoids flicker + const Client* ac = dynamic_cast(workspace()->mostRecentlyActivatedClient()); // instead of activeClient() - avoids flicker // according to NETWM spec implementation notes suggests // "focused windows having state _NET_WM_STATE_FULLSCREEN" to be on the highest layer. // we'll also take the screen into account diff --git a/workspace.cpp b/workspace.cpp index 0aecf8f05e..3e8b25500f 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1671,6 +1671,11 @@ AbstractClient *Workspace::activeClient() const return active_client; } +AbstractClient *Workspace::mostRecentlyActivatedClient() const +{ + return should_get_focus.count() > 0 ? should_get_focus.last() : active_client; +} + } // namespace #include "workspace.moc" diff --git a/workspace.h b/workspace.h index 8df61112d7..76612e856f 100644 --- a/workspace.h +++ b/workspace.h @@ -144,7 +144,7 @@ public: * we didn't process yet the matching FocusIn event. Used mostly in focus * stealing prevention code. */ - Client* mostRecentlyActivatedClient() const; + AbstractClient* mostRecentlyActivatedClient() const; Client* clientUnderMouse(int screen) const; @@ -634,11 +634,6 @@ inline bool Workspace::initializing() const return workspaceInit; } -inline Client* Workspace::mostRecentlyActivatedClient() const -{ - return should_get_focus.count() > 0 ? should_get_focus.last() : active_client; -} - inline void Workspace::addGroup(Group* group) { emit groupAdded(group);