Update the taskbar thumbnail if the original window was damaged.

svn path=/trunk/KDE/kdebase/workspace/; revision=932227
icc-effect-5.14.5
Lucas Murray 2009-02-26 10:38:52 +00:00
parent 67b8f942e3
commit 8f55220d9a
2 changed files with 19 additions and 2 deletions

View File

@ -53,9 +53,22 @@ 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?
@ -64,6 +77,8 @@ 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
@ -92,7 +107,7 @@ void TaskbarThumbnailEffect::windowAdded( EffectWindow* w )
propertyNotify( w, atom ); // read initial value
}
void TaskbarThumbnailEffect::windowRemoved( EffectWindow* w )
void TaskbarThumbnailEffect::windowDeleted( EffectWindow* w )
{
thumbnails.remove( w );
}

View File

@ -34,10 +34,11 @@ 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 windowAdded( EffectWindow* w );
virtual void windowRemoved( EffectWindow* w );
virtual void windowDeleted( EffectWindow* w );
virtual void propertyNotify( EffectWindow* w, long atom );
protected:
private:
@ -48,6 +49,7 @@ class TaskbarThumbnailEffect
};
long atom;
QMultiHash< EffectWindow*, Data > thumbnails;
EffectWindowList damagedWindows;
};
} // namespace