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

View file

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

View file

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