Commit a9d5b845 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

scene: Refactor damage teardown in X11SurfaceItem

This introduces the markedAsZombie signal, which is emitted when the
window is about to become deleted. The X11SurfaceItem uses this signal
to determine when the damage must be destroyed.
parent 47113e09
......@@ -240,6 +240,7 @@ void AbstractClient::markAsZombie()
Q_ASSERT(!m_zombie);
m_zombie = true;
addWorkspaceRepaint(visibleGeometry());
emit markedAsZombie();
}
Layer AbstractClient::layer() const
......
......@@ -16,6 +16,8 @@ SurfaceItemX11::SurfaceItemX11(Scene::Window *window, Item *parent)
connect(toplevel, &Toplevel::bufferGeometryChanged,
this, &SurfaceItemX11::handleBufferGeometryChanged);
connect(toplevel, &Toplevel::markedAsZombie,
this, &SurfaceItemX11::destroyDamage);
connect(toplevel, &Toplevel::geometryShapeChanged,
this, &SurfaceItemX11::discardQuads);
......
......@@ -575,6 +575,7 @@ public:
}
Q_SIGNALS:
void markedAsZombie();
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
void damaged(KWin::Toplevel* toplevel, const QRegion& damage);
void inputTransformationChanged();
......
......@@ -128,6 +128,7 @@ bool Unmanaged::track(xcb_window_t w)
void Unmanaged::release(ReleaseReason releaseReason)
{
addWorkspaceRepaint(visibleGeometry());
emit markedAsZombie();
Deleted* del = nullptr;
if (releaseReason != ReleaseReason::KWinShutsDown) {
del = Deleted::create(this);
......@@ -214,15 +215,6 @@ QWindow *Unmanaged::findInternalWindow() const
return nullptr;
}
void Unmanaged::finishCompositing(ReleaseReason releaseReason)
{
SurfaceItemX11 *item = qobject_cast<SurfaceItemX11 *>(surfaceItem());
if (item) {
item->destroyDamage();
}
Toplevel::finishCompositing(releaseReason);
}
void Unmanaged::damageNotifyEvent()
{
Q_ASSERT(kwinApp()->operationMode() == Application::OperationModeX11);
......
......@@ -38,8 +38,6 @@ public:
NET::WindowType windowType(bool direct = false, int supported_types = 0) const override;
bool isOutline() const override;
void finishCompositing(ReleaseReason releaseReason = ReleaseReason::Release) override;
public Q_SLOTS:
void release(ReleaseReason releaseReason = ReleaseReason::Release);
......
......@@ -1367,11 +1367,6 @@ bool X11Client::setupCompositing()
void X11Client::finishCompositing(ReleaseReason releaseReason)
{
SurfaceItemX11 *item = qobject_cast<SurfaceItemX11 *>(surfaceItem());
if (item) {
item->destroyDamage();
}
Toplevel::finishCompositing(releaseReason);
updateVisibility();
// for safety in case KWin is just resizing the window
......
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