From d426d9dcd4814e27fd14a0ebe78f9cc63fd32bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 24 Nov 2006 21:50:10 +0000 Subject: [PATCH] Don't let the damage region be larger than the window, prevent painting errors when shrinking a window. svn path=/branches/work/kwin_composite/; revision=607510 --- composite.cpp | 4 ++++ events.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/composite.cpp b/composite.cpp index 3895b61c97..d93c8c8ad5 100644 --- a/composite.cpp +++ b/composite.cpp @@ -309,6 +309,9 @@ void Toplevel::addDamage( int x, int y, int w, int h ) if( !compositing()) return; QRect r( x, y, w, h ); + // resizing the decoration may lag behind a bit and when shrinking there + // may be a damage event coming with size larger than the current window size + r &= rect(); damage_region += r; r.translate( this->x(), this->y()); // this could be possibly optimized to damage Workspace only if the toplevel @@ -319,6 +322,7 @@ void Toplevel::addDamage( int x, int y, int w, int h ) void Toplevel::addDamageFull() { + damage_region = QRegion(); // first reset e.g. in case of shrinking addDamage( rect()); } diff --git a/events.cpp b/events.cpp index 446eaae44f..b231958249 100644 --- a/events.cpp +++ b/events.cpp @@ -1628,6 +1628,7 @@ bool Unmanaged::windowEvent( XEvent* e ) if( e->type == Extensions::shapeNotifyEvent() ) { detectShape( handle()); + addDamageFull(); if( scene != NULL ) scene->windowGeometryShapeChanged( this ); }