Workspace::mostRecentlyActivatedClient returns an AbstractClient

Implementation temporarily moved to cpp. Needs to be moved back once
should_get_focus and active_client are AbstractClient.
This commit is contained in:
Martin Gräßlin 2015-03-12 11:56:55 +01:00
parent b1026aa162
commit 94ce47ef7b
6 changed files with 10 additions and 10 deletions

View file

@ -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<Client*>(workspace()->mostRecentlyActivatedClient());
if (act != NULL && !belongToSameApplication(act, this, true)) {
bool first_window = true;
auto sameApplicationActiveHackPredicate = [this](const Client *cl) {

View file

@ -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))

View file

@ -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<Client*>(workspace()->mostRecentlyActivatedClient());
if (check_modal != NULL && check_modal->check_active_modal) {
Client* new_modal = dynamic_cast<Client*>(check_modal->findModal());
if (new_modal != NULL && new_modal != check_modal) {

View file

@ -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<Client*>(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

View file

@ -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"

View file

@ -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);