windowitem: properly handle sub-subsurfaces

The damage of the whole subsurface tree needs to be considered, not just the
topmost subsurfaces of a window.

BUG: 466747
This commit is contained in:
Xaver Hugl 2023-03-03 14:56:00 +01:00
parent 46cad20ea8
commit 43a9add5fe
2 changed files with 13 additions and 6 deletions

View file

@ -176,6 +176,17 @@ void WindowItem::updatePosition()
setPosition(m_window->pos());
}
void WindowItem::addSurfaceItemDamageConnects(Item *item)
{
auto surfaceItem = static_cast<SurfaceItem *>(item);
connect(surfaceItem, &SurfaceItem::damaged, this, &WindowItem::markDamaged);
connect(surfaceItem, &SurfaceItem::childAdded, this, &WindowItem::addSurfaceItemDamageConnects);
const auto childItems = item->childItems();
for (const auto &child : childItems) {
addSurfaceItemDamageConnects(child);
}
}
void WindowItem::updateSurfaceItem(SurfaceItem *surfaceItem)
{
m_surfaceItem.reset(surfaceItem);
@ -184,12 +195,7 @@ void WindowItem::updateSurfaceItem(SurfaceItem *surfaceItem)
connect(m_window, &Window::shadeChanged, this, &WindowItem::updateSurfaceVisibility);
connect(m_window, &Window::bufferGeometryChanged, this, &WindowItem::updateSurfacePosition);
connect(m_window, &Window::frameGeometryChanged, this, &WindowItem::updateSurfacePosition);
connect(surfaceItem, &SurfaceItem::damaged, this, &WindowItem::markDamaged);
connect(surfaceItem, &SurfaceItem::childAdded, this, [this](Item *item) {
auto surfaceItem = static_cast<SurfaceItem *>(item);
connect(surfaceItem, &SurfaceItem::damaged, this, &WindowItem::markDamaged);
});
addSurfaceItemDamageConnects(surfaceItem);
updateSurfacePosition();
updateSurfaceVisibility();

View file

@ -65,6 +65,7 @@ private Q_SLOTS:
void updatePosition();
void updateOpacity();
void updateStackingOrder();
void addSurfaceItemDamageConnects(Item *item);
private:
bool computeVisibility() const;