Remove AbstractClient plumbing casts in WindowItem

This commit is contained in:
Vlad Zahorodnii 2022-04-18 11:11:52 +03:00
parent 76a3a31f42
commit e5561b194a

View file

@ -21,11 +21,9 @@ WindowItem::WindowItem(AbstractClient *window, Item *parent)
: Item(parent) : Item(parent)
, m_window(window) , m_window(window)
{ {
auto client = static_cast<AbstractClient *>(window->isClient() ? window : nullptr); connect(window, &AbstractClient::decorationChanged, this, &WindowItem::updateDecorationItem);
if (client) {
connect(client, &AbstractClient::decorationChanged, this, &WindowItem::updateDecorationItem);
updateDecorationItem(); updateDecorationItem();
}
connect(window, &AbstractClient::shadowChanged, this, &WindowItem::updateShadowItem); connect(window, &AbstractClient::shadowChanged, this, &WindowItem::updateShadowItem);
updateShadowItem(); updateShadowItem();
@ -108,12 +106,11 @@ void WindowItem::updateShadowItem()
void WindowItem::updateDecorationItem() void WindowItem::updateDecorationItem()
{ {
auto client = static_cast<AbstractClient *>(m_window->isClient() ? m_window : nullptr); if (m_window->isDeleted() || m_window->isZombie()) {
if (!client || client->isZombie()) {
return; return;
} }
if (client->decoration()) { if (m_window->decoration()) {
m_decorationItem.reset(new DecorationItem(client->decoration(), client, this)); m_decorationItem.reset(new DecorationItem(m_window->decoration(), m_window, this));
if (m_shadowItem) { if (m_shadowItem) {
m_decorationItem->stackAfter(m_shadowItem.data()); m_decorationItem->stackAfter(m_shadowItem.data());
} else if (m_surfaceItem) { } else if (m_surfaceItem) {