Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 3dff1a8a authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[effects] Drop static_cast in getMainWindows

Summary:
We use a function template, so static_cast in getMainWindows looks out
of place. Also, it's not good idea to do static_cast based on output of
isDeleted().

Test Plan: The Dialog Parent effect works.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17426
parent c3e712e9
......@@ -1897,9 +1897,8 @@ EffectWindow* EffectWindowImpl::findModal()
}
template <typename T>
EffectWindowList getMainWindows(Toplevel *toplevel)
EffectWindowList getMainWindows(T *c)
{
T *c = static_cast<T*>(toplevel);
const auto mainclients = c->mainClients();
EffectWindowList ret;
ret.reserve(mainclients.size());
......@@ -1911,12 +1910,13 @@ EffectWindowList getMainWindows(Toplevel *toplevel)
EffectWindowList EffectWindowImpl::mainWindows() const
{
if (dynamic_cast<AbstractClient*>(toplevel)) {
return getMainWindows<AbstractClient>(toplevel);
} else if (toplevel->isDeleted()) {
return getMainWindows<Deleted>(toplevel);
if (auto client = qobject_cast<AbstractClient *>(toplevel)) {
return getMainWindows(client);
}
return EffectWindowList();
if (auto deleted = qobject_cast<Deleted *>(toplevel)) {
return getMainWindows(deleted);
}
return {};
}
WindowQuadList EffectWindowImpl::buildQuads(bool force) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment