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`.
This commit is contained in:
Nils Fenner 2022-04-14 19:36:34 +00:00 committed by Vlad Zahorodnii
parent e48a5c0535
commit 31ec0ceb24
2 changed files with 5 additions and 5 deletions

View file

@ -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 {};

View file

@ -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;