1 /*****************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2006 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 ******************************************************************/
11 #include "demo_shiftworkspaceup.h"
16 KWIN_EFFECT( demo_shiftworkspaceup
, ShiftWorkspaceUpEffect
)
18 ShiftWorkspaceUpEffect::ShiftWorkspaceUpEffect()
22 connect( &timer
, SIGNAL( timeout()), SLOT( tick()));
26 void ShiftWorkspaceUpEffect::prePaintScreen( ScreenPrePaintData
& data
, int time
)
28 if( up
&& diff
< 1000 )
29 diff
= qBound( 0, diff
+ time
, 1000 ); // KDE3: note this differs from KCLAMP
31 diff
= qBound( 0, diff
- time
, 1000 );
33 data
.mask
|= PAINT_SCREEN_TRANSFORMED
;
34 effects
->prePaintScreen( data
, time
);
37 void ShiftWorkspaceUpEffect::paintScreen( int mask
, QRegion region
, ScreenPaintData
& data
)
40 data
.yTranslate
-= diff
/ 100;
41 effects
->paintScreen( mask
, region
, data
);
44 void ShiftWorkspaceUpEffect::postPaintScreen()
46 if( up
? diff
< 1000 : diff
> 0 )
47 effects
->addRepaintFull(); // trigger next animation repaint
48 effects
->postPaintScreen();
51 void ShiftWorkspaceUpEffect::tick()
54 effects
->addRepaintFull();
59 #include "demo_shiftworkspaceup.moc"