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
This commit is contained in:
Luboš Luňák 2006-11-24 21:50:10 +00:00
parent 277449f545
commit d426d9dcd4
2 changed files with 5 additions and 0 deletions

View file

@ -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());
}

View file

@ -1628,6 +1628,7 @@ bool Unmanaged::windowEvent( XEvent* e )
if( e->type == Extensions::shapeNotifyEvent() )
{
detectShape( handle());
addDamageFull();
if( scene != NULL )
scene->windowGeometryShapeChanged( this );
}