Correct detection of damaged windows in the taskbar thumbnail effect.

svn path=/trunk/KDE/kdebase/workspace/; revision=935762
This commit is contained in:
Lucas Murray 2009-03-06 06:16:00 +00:00
parent 8ba7586d79
commit 245cc3ecb6
2 changed files with 10 additions and 16 deletions

View file

@ -53,22 +53,9 @@ void TaskbarThumbnailEffect::prePaintScreen( ScreenPrePaintData& data, int time
// if( thumbnails.count() > 0 )
// // TODO this should not be needed (it causes whole screen repaint)
// data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
damagedWindows.clear();
effects->prePaintScreen(data, time);
}
void TaskbarThumbnailEffect::postPaintScreen()
{
// Update the thumbnail if the window was damaged
foreach( EffectWindow* w, thumbnails.keys() )
foreach( const Data &thumb, thumbnails.values( w ))
if( damagedWindows.contains( effects->findWindow( thumb.window )))
effects->addRepaint( thumb.rect.translated( w->pos() ));
effects->postPaintScreen();
}
void TaskbarThumbnailEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
{
// TODO what if of the windows is translucent and one not? change data.mask?
@ -77,8 +64,6 @@ void TaskbarThumbnailEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData
void TaskbarThumbnailEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{
if( !( region & w->geometry() ).isEmpty() )
damagedWindows.append( w ); // This window is damaged, TODO: Causes repaint loop if thumbnail covers window
effects->paintWindow( w, mask, region, data ); // paint window first
if( thumbnails.contains( w ))
{ // paint thumbnails on it
@ -102,6 +87,15 @@ void TaskbarThumbnailEffect::paintWindow( EffectWindow* w, int mask, QRegion reg
}
}
void TaskbarThumbnailEffect::windowDamaged( EffectWindow* w, const QRect& damage )
{
// Update the thumbnail if the window was damaged
foreach( EffectWindow* window, thumbnails.keys() )
foreach( const Data &thumb, thumbnails.values( window ))
if( w == effects->findWindow( thumb.window ))
effects->addRepaint( thumb.rect.translated( window->pos() ));
}
void TaskbarThumbnailEffect::windowAdded( EffectWindow* w )
{
propertyNotify( w, atom ); // read initial value

View file

@ -34,9 +34,9 @@ class TaskbarThumbnailEffect
TaskbarThumbnailEffect();
virtual ~TaskbarThumbnailEffect();
virtual void prePaintScreen( ScreenPrePaintData& data, int time );
virtual void postPaintScreen();
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
virtual void windowDamaged( EffectWindow* w, const QRect& damage );
virtual void windowAdded( EffectWindow* w );
virtual void windowDeleted( EffectWindow* w );
virtual void propertyNotify( EffectWindow* w, long atom );