1 /*****************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
7 You can Freely distribute this program under the GNU General Public
8 License. See the file "COPYING" for the exact licensing terms.
9 ******************************************************************/
13 Testing of painting a window more than once. The active window is painted
14 once more as a thumbnail in the bottom-right corner of the screen.
18 #include "test_thumbnail.h"
23 KWIN_EFFECT( test_thumbnail
, TestThumbnailEffect
)
25 TestThumbnailEffect::TestThumbnailEffect()
26 : active_window( NULL
)
30 void TestThumbnailEffect::paintScreen( int mask
, QRegion region
, ScreenPaintData
& data
)
32 effects
->paintScreen( mask
, region
, data
);
33 if( active_window
!= NULL
&& region
.contains( thumbnailRect()))
35 WindowPaintData
data( active_window
);
37 setPositionTransformations( data
, region
, active_window
, thumbnailRect(), Qt::KeepAspectRatio
);
38 effects
->drawWindow( active_window
,
39 PAINT_WINDOW_OPAQUE
| PAINT_WINDOW_TRANSLUCENT
| PAINT_WINDOW_TRANSFORMED
,
44 void TestThumbnailEffect::windowActivated( EffectWindow
* act
)
47 effects
->addRepaint( thumbnailRect());
50 void TestThumbnailEffect::windowDamaged( EffectWindow
* w
, const QRect
& )
52 if( w
== active_window
)
53 effects
->addRepaint( thumbnailRect());
54 // TODO maybe just the relevant part of the area should be repainted?
57 void TestThumbnailEffect::windowGeometryShapeChanged( EffectWindow
* w
, const QRect
& old
)
59 if( w
== active_window
&& w
->size() != old
.size())
60 effects
->addRepaint( thumbnailRect());
63 void TestThumbnailEffect::windowClosed( EffectWindow
* w
)
65 if( w
== active_window
)
68 effects
->addRepaint( thumbnailRect());
72 QRect
TestThumbnailEffect::thumbnailRect() const
74 return QRect( displayWidth() - 100, displayHeight() - 100, 100, 100 );