Remove most_recently_raised micro optimization

This micro optimization is simply not worth having. raiseOrLowerClient()
is not in any hot path, besides that raiseClient() is not the only place
where a window can be raised above other windows. In addition to that,
the most_recently_raised check in raiseOrLowerClient() doesn't take into
account whether the cached window is on the current activity.
This commit is contained in:
Vlad Zahorodnii 2021-05-10 11:02:43 +03:00
parent a3d32fa836
commit 9577423dfa
3 changed files with 3 additions and 22 deletions

View file

@ -277,14 +277,9 @@ AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const
void Workspace::raiseOrLowerClient(AbstractClient *c)
{
if (!c) return;
AbstractClient* topmost = nullptr;
// TODO Q_ASSERT( block_stacking_updates == 0 );
if (most_recently_raised && stacking_order.contains(most_recently_raised) &&
most_recently_raised->isShown(true) && c->isOnCurrentDesktop())
topmost = most_recently_raised;
else
topmost = topClientOnDesktop(c->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : c->desktop(),
options->isSeparateScreenFocus() ? c->screen() : -1);
const AbstractClient *topmost =
topClientOnDesktop(c->isOnAllDesktops() ? VirtualDesktopManager::self()->current() : c->desktop(),
options->isSeparateScreenFocus() ? c->screen() : -1);
if (c == topmost)
lowerClient(c);
@ -317,9 +312,6 @@ void Workspace::lowerClient(AbstractClient* c, bool nogroup)
lowerClient(wins[ i ], true);
}
}
if (c == most_recently_raised)
most_recently_raised = nullptr;
}
void Workspace::lowerClientWithinApplication(AbstractClient* c)
@ -372,10 +364,6 @@ void Workspace::raiseClient(AbstractClient* c, bool nogroup)
unconstrained_stacking_order.removeAll(c);
unconstrained_stacking_order.append(c);
if (!c->isSpecialWindow()) {
most_recently_raised = c;
}
}
void Workspace::raiseClientWithinApplication(AbstractClient* c)

View file

@ -114,7 +114,6 @@ Workspace::Workspace()
, m_initialDesktop(1)
, active_client(nullptr)
, last_active_client(nullptr)
, most_recently_raised(nullptr)
, movingClient(nullptr)
, delayfocus_client(nullptr)
, force_restacking(false)
@ -650,8 +649,6 @@ void Workspace::removeClient(X11Client *c)
if (group != nullptr)
group->lostLeader();
if (c == most_recently_raised)
most_recently_raised = nullptr;
should_get_focus.removeAll(c);
if (c == active_client)
active_client = nullptr;
@ -768,9 +765,6 @@ void Workspace::removeShellClient(AbstractClient *client)
{
clientHidden(client);
m_allClients.removeAll(client);
if (client == most_recently_raised) {
most_recently_raised = nullptr;
}
if (client == delayfocus_client) {
cancelDelayFocus();
}

View file

@ -576,7 +576,6 @@ private:
AbstractClient* active_client;
AbstractClient* last_active_client;
AbstractClient* most_recently_raised; // Used ONLY by raiseOrLowerClient()
AbstractClient* movingClient;
// Delay(ed) window focus timer and client