From e5561b194a4822037efd2c34b184e12843a071f2 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 18 Apr 2022 11:11:52 +0300 Subject: [PATCH] Remove AbstractClient plumbing casts in WindowItem --- src/windowitem.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/windowitem.cpp b/src/windowitem.cpp index 003f505402..507054dc83 100644 --- a/src/windowitem.cpp +++ b/src/windowitem.cpp @@ -21,11 +21,9 @@ WindowItem::WindowItem(AbstractClient *window, Item *parent) : Item(parent) , m_window(window) { - auto client = static_cast(window->isClient() ? window : nullptr); - if (client) { - connect(client, &AbstractClient::decorationChanged, this, &WindowItem::updateDecorationItem); - updateDecorationItem(); - } + connect(window, &AbstractClient::decorationChanged, this, &WindowItem::updateDecorationItem); + updateDecorationItem(); + connect(window, &AbstractClient::shadowChanged, this, &WindowItem::updateShadowItem); updateShadowItem(); @@ -108,12 +106,11 @@ void WindowItem::updateShadowItem() void WindowItem::updateDecorationItem() { - auto client = static_cast(m_window->isClient() ? m_window : nullptr); - if (!client || client->isZombie()) { + if (m_window->isDeleted() || m_window->isZombie()) { return; } - if (client->decoration()) { - m_decorationItem.reset(new DecorationItem(client->decoration(), client, this)); + if (m_window->decoration()) { + m_decorationItem.reset(new DecorationItem(m_window->decoration(), m_window, this)); if (m_shadowItem) { m_decorationItem->stackAfter(m_shadowItem.data()); } else if (m_surfaceItem) {