2007-04-29 17:35:43 +00:00
|
|
|
/*****************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#include "demo_shiftworkspaceup.h"
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KWIN_EFFECT(demo_shiftworkspaceup, ShiftWorkspaceUpEffect)
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
ShiftWorkspaceUpEffect::ShiftWorkspaceUpEffect()
|
2011-01-30 14:34:42 +00:00
|
|
|
: up(false)
|
|
|
|
, diff(0)
|
|
|
|
{
|
|
|
|
connect(&timer, SIGNAL(timeout()), SLOT(tick()));
|
|
|
|
timer.start(2000);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShiftWorkspaceUpEffect::prePaintScreen(ScreenPrePaintData& data, int time)
|
|
|
|
{
|
|
|
|
if (up && diff < 1000)
|
|
|
|
diff = qBound(0, diff + time, 1000); // KDE3: note this differs from KCLAMP
|
|
|
|
if (!up && diff > 0)
|
|
|
|
diff = qBound(0, diff - time, 1000);
|
|
|
|
if (diff != 0)
|
2007-07-07 14:01:32 +00:00
|
|
|
data.mask |= PAINT_SCREEN_TRANSFORMED;
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->prePaintScreen(data, time);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void ShiftWorkspaceUpEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
|
|
|
|
{
|
|
|
|
if (diff != 0)
|
2007-04-29 17:35:43 +00:00
|
|
|
data.yTranslate -= diff / 100;
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->paintScreen(mask, region, data);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void ShiftWorkspaceUpEffect::postPaintScreen()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (up ? diff < 1000 : diff > 0)
|
2007-04-29 17:35:43 +00:00
|
|
|
effects->addRepaintFull(); // trigger next animation repaint
|
|
|
|
effects->postPaintScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void ShiftWorkspaceUpEffect::tick()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
up = !up;
|
|
|
|
effects->addRepaintFull();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#include "demo_shiftworkspaceup.moc"
|