From 89aa8ee8dbcf6b0f1a49946c8e353c923d478bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 1 Apr 2011 21:49:44 +0200 Subject: [PATCH] Fix repainting of shadow after window closes Unmanaged needs to repaint the complete geometry including shadow when it ends compositing. Therefore we need to track the shadow passing to deleted correctly. Disadvantage: when turning off compositing the shadow is kept. Need to solve in a better way! --- composite.cpp | 4 ---- shadow.cpp | 6 ++++++ shadow.h | 7 +++++++ toplevel.cpp | 4 ++-- unmanaged.cpp | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/composite.cpp b/composite.cpp index 44a3865be4..3cb8bc8ae7 100644 --- a/composite.cpp +++ b/composite.cpp @@ -690,10 +690,6 @@ void Toplevel::finishCompositing() damage_region = QRegion(); repaints_region = QRegion(); effect_window = NULL; - if (hasShadow()) { - delete m_shadow; - m_shadow = NULL; - } #endif } diff --git a/shadow.cpp b/shadow.cpp index 0dba4e8650..422313e1e6 100644 --- a/shadow.cpp +++ b/shadow.cpp @@ -171,4 +171,10 @@ bool Shadow::updateShadow() return true; } +void Shadow::setToplevel(Toplevel *topLevel) +{ + m_topLevel = topLevel; + setParent(topLevel); +} + } // namespace diff --git a/shadow.h b/shadow.h index 2a5aeda4e9..6b4719ed57 100644 --- a/shadow.h +++ b/shadow.h @@ -85,6 +85,13 @@ public: **/ static Shadow *createShadow(Toplevel *toplevel); + /** + * Reparents the shadow to @p toplevel. + * Used when a window is deleted. + * @param toplevel The new parent + **/ + void setToplevel(Toplevel *toplevel); + protected: Shadow(Toplevel *toplevel); enum ShadowElements { diff --git a/toplevel.cpp b/toplevel.cpp index 68a4350491..99a5f42237 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -135,8 +135,7 @@ void Toplevel::copyToDeleted(Toplevel* c) c->window_pix = None; if (c->hasShadow()) { m_shadow = c->m_shadow; - c->m_shadow->setParent(this); - c->m_shadow = NULL; + m_shadow->setToplevel(this); } } @@ -145,6 +144,7 @@ void Toplevel::copyToDeleted(Toplevel* c) void Toplevel::disownDataPassedToDeleted() { info = NULL; + m_shadow = NULL; } QRect Toplevel::visibleRect() const diff --git a/unmanaged.cpp b/unmanaged.cpp index e717bf89f9..6fcd47398d 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -92,7 +92,7 @@ void Unmanaged::release() XShapeSelectInput(display(), window(), NoEventMask); XSelectInput(display(), window(), NoEventMask); } - addWorkspaceRepaint(geometry()); + addWorkspaceRepaint(visibleRect()); disownDataPassedToDeleted(); del->unrefWindow(); deleteUnmanaged(this, Allowed);