Remove Workspace::hasClient() micro-optimization

Workspace::hasClient(X11Client *) is unused and not worth optimizing as
it doesn't appear in any hot path.
This commit is contained in:
Vlad Zahorodnii 2021-08-25 21:15:56 +03:00
parent c5d22b68b6
commit ac7eb252f1
2 changed files with 3 additions and 16 deletions

View file

@ -1859,15 +1859,10 @@ void Workspace::forEachToplevel(std::function<void (Toplevel *)> func)
bool Workspace::hasClient(const AbstractClient *c) bool Workspace::hasClient(const AbstractClient *c)
{ {
if (auto cc = dynamic_cast<const X11Client *>(c)) { return findAbstractClient([&c](const AbstractClient *test) {
return hasClient(cc);
} else {
return findAbstractClient([c](const AbstractClient *test) {
return test == c; return test == c;
}) != nullptr; }) != nullptr;
} }
return false;
}
void Workspace::forEachAbstractClient(std::function< void (AbstractClient*) > func) void Workspace::forEachAbstractClient(std::function< void (AbstractClient*) > func)
{ {

View file

@ -71,7 +71,6 @@ public:
bool workspaceEvent(xcb_generic_event_t*); bool workspaceEvent(xcb_generic_event_t*);
bool workspaceEvent(QEvent*); bool workspaceEvent(QEvent*);
bool hasClient(const X11Client *);
bool hasClient(const AbstractClient*); bool hasClient(const AbstractClient*);
/** /**
@ -791,13 +790,6 @@ void Workspace::forEachUnmanaged(std::function< void (Unmanaged*) > func)
std::for_each(m_unmanaged.constBegin(), m_unmanaged.constEnd(), func); std::for_each(m_unmanaged.constBegin(), m_unmanaged.constEnd(), func);
} }
inline bool Workspace::hasClient(const X11Client *c)
{
return findClient([c](const X11Client *test) {
return test == c;
});
}
inline Workspace *workspace() inline Workspace *workspace()
{ {
return Workspace::_self; return Workspace::_self;