Commit 31ec0ceb authored by Nils Fenner's avatar Nils Fenner Committed by Vlad Zahorodnii
Browse files

Use Toplevel::isDeleted() to resolve Deleted type.

Prepares #81 (part 2)

Note that the `Unmanaged` type is not explicitly checked - implies `(t->isDeleted() || t->isClient()) == false`.
parent e48a5c05
Pipeline #164120 passed with stage
in 15 minutes and 32 seconds
......@@ -1994,7 +1994,7 @@ const EffectWindowGroup *EffectWindowImpl::group() const
void EffectWindowImpl::refWindow()
{
if (auto d = qobject_cast<Deleted *>(toplevel)) {
if (auto d = static_cast<Deleted *>(toplevel->isDeleted() ? toplevel : nullptr)) {
return d->refWindow();
}
Q_UNREACHABLE(); // TODO
......@@ -2002,7 +2002,7 @@ void EffectWindowImpl::refWindow()
void EffectWindowImpl::unrefWindow()
{
if (auto d = qobject_cast<Deleted *>(toplevel)) {
if (auto d = static_cast<Deleted *>(toplevel->isDeleted() ? toplevel : nullptr)) {
return d->unrefWindow(); // delays deletion in case
}
Q_UNREACHABLE(); // TODO
......@@ -2071,7 +2071,7 @@ TOPLEVEL_HELPER(QUuid, internalId, internalId)
if (client) { \
return client->propertyname(); \
} \
auto deleted = qobject_cast<Deleted *>(toplevel); \
auto deleted = static_cast<Deleted *>(toplevel->isDeleted() ? toplevel : nullptr); \
if (deleted) { \
return deleted->propertyname(); \
} \
......@@ -2240,7 +2240,7 @@ EffectWindowList EffectWindowImpl::mainWindows() const
if (auto client = static_cast<AbstractClient *>(toplevel->isClient() ? toplevel : nullptr)) {
return getMainWindows(client);
}
if (auto deleted = qobject_cast<Deleted *>(toplevel)) {
if (auto deleted = static_cast<Deleted *>(toplevel->isDeleted() ? toplevel : nullptr)) {
return getMainWindows(deleted);
}
return {};
......
......@@ -248,7 +248,7 @@ void SceneQPainter::Window::renderDecorationItem(QPainter *painter, DecorationIt
QRect dtr, dlr, drr, dbr;
if (auto client = static_cast<AbstractClient *>(toplevel->isClient() ? toplevel : nullptr)) {
client->layoutDecorationRects(dlr, dtr, drr, dbr);
} else if (auto deleted = qobject_cast<Deleted *>(toplevel)) {
} else if (auto deleted = static_cast<Deleted *>(toplevel->isDeleted() ? toplevel : nullptr)) {
deleted->layoutDecorationRects(dlr, dtr, drr, dbr);
} else {
return;
......
Supports Markdown
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