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()
30
void TestThumbnailEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
32
effects->paintScreen(mask, region, data);
33
if (active_window != NULL && region.contains(thumbnailRect())) {
34
WindowPaintData data(active_window);
36
setPositionTransformations(data, region, active_window, thumbnailRect(), Qt::KeepAspectRatio);
37
effects->drawWindow(active_window,
38
PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED,
43
void TestThumbnailEffect::windowActivated(EffectWindow* act)
46
effects->addRepaint(thumbnailRect());
49
void TestThumbnailEffect::windowDamaged(EffectWindow* w, const QRect&)
51
if (w == active_window)
52
effects->addRepaint(thumbnailRect());
53
// TODO maybe just the relevant part of the area should be repainted?
56
void TestThumbnailEffect::windowGeometryShapeChanged(EffectWindow* w, const QRect& old)
58
if (w == active_window && w->size() != old.size())
59
effects->addRepaint(thumbnailRect());
62
void TestThumbnailEffect::windowClosed(EffectWindow* w)
64
if (w == active_window) {
66
effects->addRepaint(thumbnailRect());
70
QRect TestThumbnailEffect::thumbnailRect() const
72
return QRect(displayWidth() - 100, displayHeight() - 100, 100, 100);