2008-08-02 13:17:21 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
// based on minimize animation by Rivo Laks <rivolaks@hot.ee>
|
|
|
|
|
|
|
|
#include "magiclamp.h"
|
2009-01-14 15:31:08 +00:00
|
|
|
#include <kwinconfig.h>
|
|
|
|
#include <kconfiggroup.h>
|
2008-08-02 13:17:21 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KWIN_EFFECT(magiclamp, MagicLampEffect)
|
|
|
|
KWIN_EFFECT_SUPPORTED(magiclamp, MagicLampEffect::supported())
|
2008-08-02 13:17:21 +00:00
|
|
|
|
|
|
|
MagicLampEffect::MagicLampEffect()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-08-02 13:17:21 +00:00
|
|
|
mActiveAnimations = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
reconfigure(ReconfigureAll);
|
2011-02-27 09:47:42 +00:00
|
|
|
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
|
2011-03-06 09:55:27 +00:00
|
|
|
connect(effects, SIGNAL(windowMinimized(EffectWindow*)), this, SLOT(slotWindowMinimized(EffectWindow*)));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
2009-04-01 09:56:01 +00:00
|
|
|
bool MagicLampEffect::supported()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-04-01 09:56:01 +00:00
|
|
|
return effects->compositingType() == OpenGLCompositing;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-04-01 09:56:01 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void MagicLampEffect::reconfigure(ReconfigureFlags)
|
|
|
|
{
|
|
|
|
KConfigGroup conf = effects->effectConfig("MagicLamp");
|
|
|
|
mAnimationDuration = animationTime(conf, "AnimationDuration", 250);
|
|
|
|
conf = effects->effectConfig("Shadow");
|
|
|
|
int v = conf.readEntry("Size", 5);
|
|
|
|
v += conf.readEntry("Fuzzyness", 10);
|
2009-11-25 17:46:50 +00:00
|
|
|
mShadowOffset[0] = mShadowOffset[1] = -v;
|
|
|
|
mShadowOffset[2] = mShadowOffset[3] = v;
|
2011-01-30 14:34:42 +00:00
|
|
|
v = conf.readEntry("XOffset", 0);
|
2009-11-25 17:46:50 +00:00
|
|
|
mShadowOffset[0] -= v;
|
|
|
|
mShadowOffset[2] += v;
|
2011-01-30 14:34:42 +00:00
|
|
|
v = conf.readEntry("YOffset", 3);
|
2009-11-25 17:46:50 +00:00
|
|
|
mShadowOffset[1] -= v;
|
|
|
|
mShadowOffset[3] += v;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void MagicLampEffect::prePaintScreen(ScreenPrePaintData& data, int time)
|
|
|
|
{
|
2009-11-25 17:46:50 +00:00
|
|
|
|
|
|
|
QHash< EffectWindow*, TimeLine >::iterator entry = mTimeLineWindows.begin();
|
|
|
|
bool erase = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
while (entry != mTimeLineWindows.end()) {
|
2009-11-25 17:46:50 +00:00
|
|
|
TimeLine &timeline = entry.value();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (entry.key()->isMinimized()) {
|
2009-11-25 17:46:50 +00:00
|
|
|
timeline.addTime(time);
|
|
|
|
erase = (timeline.progress() >= 1.0f);
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2009-11-25 17:46:50 +00:00
|
|
|
timeline.removeTime(time);
|
|
|
|
erase = (timeline.progress() <= 0.0f);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (erase)
|
|
|
|
entry = mTimeLineWindows.erase(entry);
|
2009-11-25 17:46:50 +00:00
|
|
|
else
|
|
|
|
++entry;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2008-08-02 13:17:21 +00:00
|
|
|
mActiveAnimations = mTimeLineWindows.count();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (mActiveAnimations > 0)
|
2008-08-02 13:17:21 +00:00
|
|
|
// We need to mark the screen windows as transformed. Otherwise the
|
|
|
|
// whole screen won't be repainted, resulting in artefacts
|
|
|
|
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
|
|
|
|
|
|
|
|
effects->prePaintScreen(data, time);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void MagicLampEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time)
|
|
|
|
{
|
2009-11-25 17:46:50 +00:00
|
|
|
// Schedule window for transformation if the animation is still in
|
|
|
|
// progress
|
2011-01-30 14:34:42 +00:00
|
|
|
if (mTimeLineWindows.contains(w)) {
|
2009-11-25 17:46:50 +00:00
|
|
|
// We'll transform this window
|
|
|
|
data.setTransformed();
|
2011-01-30 14:34:42 +00:00
|
|
|
data.quads = data.quads.makeGrid(40);
|
|
|
|
w->enablePainting(EffectWindow::PAINT_DISABLED_BY_MINIMIZE);
|
2008-08-02 13:17:21 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->prePaintWindow(w, data, time);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MagicLampEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
|
|
|
|
{
|
|
|
|
if (mTimeLineWindows.contains(w)) {
|
2008-08-02 13:17:21 +00:00
|
|
|
// 0 = not minimized, 1 = fully minimized
|
|
|
|
float progress = mTimeLineWindows[w].value();
|
|
|
|
|
|
|
|
QRect geo = w->geometry();
|
|
|
|
QRect icon = w->iconGeometry();
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect area = effects->clientArea(ScreenArea, w);
|
2009-11-25 17:46:50 +00:00
|
|
|
IconPosition position = Top;
|
2008-08-02 13:17:21 +00:00
|
|
|
// If there's no icon geometry, minimize to the center of the screen
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!icon.isValid()) {
|
2009-11-25 17:46:50 +00:00
|
|
|
QRect extG = geo.adjusted(mShadowOffset[0], mShadowOffset[1], mShadowOffset[2], mShadowOffset[3]);
|
|
|
|
QPoint pt = QCursor::pos();
|
|
|
|
// focussing inside the window is no good, leads to ugly artefacts, find nearest border
|
2011-01-30 14:34:42 +00:00
|
|
|
if (extG.contains(pt)) {
|
2009-11-25 17:46:50 +00:00
|
|
|
const int d[2][2] = { {pt.x() - extG.x(), extG.right() - pt.x()},
|
2011-01-30 14:34:42 +00:00
|
|
|
{pt.y() - extG.y(), extG.bottom() - pt.y()}
|
|
|
|
};
|
2009-11-25 17:46:50 +00:00
|
|
|
int di = d[1][0];
|
|
|
|
position = Top;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (d[0][0] < di) {
|
2009-11-25 17:46:50 +00:00
|
|
|
di = d[0][0];
|
|
|
|
position = Left;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (d[1][1] < di) {
|
2009-11-25 17:46:50 +00:00
|
|
|
di = d[1][1];
|
2009-03-08 15:12:55 +00:00
|
|
|
position = Bottom;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-11-25 17:46:50 +00:00
|
|
|
if (d[0][1] < di)
|
|
|
|
position = Right;
|
2011-01-30 14:34:42 +00:00
|
|
|
switch(position) {
|
|
|
|
case Top: pt.setY(extG.y()); break;
|
|
|
|
case Left: pt.setX(extG.x()); break;
|
|
|
|
case Bottom: pt.setY(extG.bottom()); break;
|
|
|
|
case Right: pt.setX(extG.right()); break;
|
|
|
|
}
|
|
|
|
} else {
|
2009-11-25 17:46:50 +00:00
|
|
|
if (pt.y() < geo.y())
|
|
|
|
position = Top;
|
|
|
|
else if (pt.x() < geo.x())
|
2009-03-08 15:12:55 +00:00
|
|
|
position = Left;
|
2009-11-25 17:46:50 +00:00
|
|
|
else if (pt.y() > geo.bottom())
|
|
|
|
position = Bottom;
|
|
|
|
else if (pt.x() > geo.right())
|
2009-03-08 15:12:55 +00:00
|
|
|
position = Right;
|
2008-08-22 09:40:46 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
icon = QRect(pt, QSize(0, 0));
|
|
|
|
} else {
|
2009-11-25 17:46:50 +00:00
|
|
|
// Assumption: there is a panel containing the icon position
|
|
|
|
EffectWindow* panel = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (EffectWindow * window, effects->stackingOrder()) {
|
|
|
|
if (!window->isDock())
|
2009-11-25 17:46:50 +00:00
|
|
|
continue;
|
|
|
|
// we have to use intersects as there seems to be a Plasma bug
|
|
|
|
// the published icon geometry might be bigger than the panel
|
2011-01-30 14:34:42 +00:00
|
|
|
if (window->geometry().intersects(icon)) {
|
2009-11-25 17:46:50 +00:00
|
|
|
panel = window;
|
|
|
|
break;
|
2009-03-08 15:12:55 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (panel) {
|
2009-11-25 17:46:50 +00:00
|
|
|
// Assumption: width of horizonal panel is greater than its height and vice versa
|
|
|
|
// The panel has to border one screen edge, so get it's screen area
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect panelScreen = effects->clientArea(ScreenArea, panel);
|
|
|
|
if (panel->width() >= panel->height()) {
|
2009-11-25 17:46:50 +00:00
|
|
|
// horizontal panel
|
2011-01-30 14:34:42 +00:00
|
|
|
if (panel->y() == panelScreen.y())
|
2009-11-25 17:46:50 +00:00
|
|
|
position = Top;
|
|
|
|
else
|
|
|
|
position = Bottom;
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2009-11-25 17:46:50 +00:00
|
|
|
// vertical panel
|
2011-01-30 14:34:42 +00:00
|
|
|
if (panel->x() == panelScreen.x())
|
2009-11-25 17:46:50 +00:00
|
|
|
position = Left;
|
|
|
|
else
|
|
|
|
position = Right;
|
2009-03-08 15:12:55 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2009-11-25 17:46:50 +00:00
|
|
|
// we did not find a panel, so it might be autohidden
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect iconScreen = effects->clientArea(ScreenArea, icon.topLeft(), effects->currentDesktop());
|
2009-11-25 17:46:50 +00:00
|
|
|
// as the icon geometry could be overlap a screen edge we use an intersection
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect rect = iconScreen.intersected(icon);
|
2009-11-25 17:46:50 +00:00
|
|
|
// here we need a different assumption: icon geometry borders one screen edge
|
|
|
|
// this assumption might be wrong for e.g. task applet being the only applet in panel
|
|
|
|
// in this case the icon borders two screen edges
|
|
|
|
// there might be a wrong animation, but not distorted
|
2011-01-30 14:34:42 +00:00
|
|
|
if (rect.x() == iconScreen.x()) {
|
2009-11-25 17:46:50 +00:00
|
|
|
position = Left;
|
2011-01-30 14:34:42 +00:00
|
|
|
} else if (rect.x() + rect.width() == iconScreen.x() + iconScreen.width()) {
|
2009-11-25 17:46:50 +00:00
|
|
|
position = Right;
|
2011-01-30 14:34:42 +00:00
|
|
|
} else if (rect.y() == iconScreen.y()) {
|
2009-11-25 17:46:50 +00:00
|
|
|
position = Top;
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2009-11-25 17:46:50 +00:00
|
|
|
position = Bottom;
|
2009-03-08 15:12:55 +00:00
|
|
|
}
|
2008-08-22 09:40:46 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
|
|
|
WindowQuadList newQuads;
|
2011-01-30 14:34:42 +00:00
|
|
|
foreach (WindowQuad quad, data.quads) { // krazy:exclude=foreach
|
|
|
|
if (position == Top || position == Bottom) {
|
2008-08-22 09:40:46 +00:00
|
|
|
// quadFactor defines how fast a quad is vertically moved: y coordinates near to window top are slowed down
|
|
|
|
// it is used as quadFactor^3/windowHeight^3
|
|
|
|
// quadFactor is the y position of the quad but is changed towards becomming the window height
|
|
|
|
// by that the factor becomes 1 and has no influence any more
|
|
|
|
float quadFactor;
|
|
|
|
// how far has a quad to be moved? Distance between icon and window multiplied by the progress and by the quadFactor
|
|
|
|
float yOffsetTop;
|
|
|
|
float yOffsetBottom;
|
|
|
|
// top and bottom progress is the factor which defines how far the x values have to be changed
|
|
|
|
// factor is the current moved y value diveded by the distance between icon and window
|
|
|
|
float topProgress;
|
|
|
|
float bottomProgress;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (position == Bottom) {
|
|
|
|
quadFactor = quad[0].y() + (geo.height() - quad[0].y()) * progress;
|
|
|
|
yOffsetTop = (icon.y() + quad[0].y() - geo.y()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.height() * geo.height() * geo.height()));
|
|
|
|
quadFactor = quad[2].y() + (geo.height() - quad[2].y()) * progress;
|
|
|
|
yOffsetBottom = (icon.y() + quad[2].y() - geo.y()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.height() * geo.height() * geo.height()));
|
|
|
|
topProgress = qMin(yOffsetTop / (icon.y() + icon.height() - geo.y() - (float)(quad[0].y() / geo.height() * geo.height())), 1.0f);
|
|
|
|
bottomProgress = qMin(yOffsetBottom / (icon.y() + icon.height() - geo.y() - (float)(quad[2].y() / geo.height() * geo.height())), 1.0f);
|
|
|
|
} else {
|
|
|
|
quadFactor = geo.height() - quad[0].y() + (quad[0].y()) * progress;
|
|
|
|
yOffsetTop = (geo.y() - icon.height() + geo.height() + quad[0].y() - icon.y()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.height() * geo.height() * geo.height()));
|
|
|
|
quadFactor = geo.height() - quad[2].y() + (quad[2].y()) * progress;
|
|
|
|
yOffsetBottom = (geo.y() - icon.height() + geo.height() + quad[2].y() - icon.y()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.height() * geo.height() * geo.height()));
|
|
|
|
topProgress = qMin(yOffsetTop / (geo.y() - icon.height() + geo.height() - icon.y() -
|
|
|
|
(float)((geo.height() - quad[0].y()) / geo.height() * geo.height())), 1.0f);
|
|
|
|
bottomProgress = qMin(yOffsetBottom / (geo.y() - icon.height() + geo.height() - icon.y() -
|
|
|
|
(float)((geo.height() - quad[2].y()) / geo.height() * geo.height())), 1.0f);
|
|
|
|
}
|
|
|
|
if (position == Top) {
|
2008-08-22 09:40:46 +00:00
|
|
|
yOffsetTop *= -1;
|
|
|
|
yOffsetBottom *= -1;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (topProgress < 0)
|
2008-08-22 09:40:46 +00:00
|
|
|
topProgress *= -1;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (bottomProgress < 0)
|
2008-08-22 09:40:46 +00:00
|
|
|
bottomProgress *= -1;
|
|
|
|
|
|
|
|
// x values are moved towards the center of the icon
|
2011-01-30 14:34:42 +00:00
|
|
|
quad[0].setX((icon.x() + icon.width()*(quad[0].x() / geo.width()) - (quad[0].x() + geo.x()))*topProgress + quad[0].x());
|
|
|
|
quad[1].setX((icon.x() + icon.width()*(quad[1].x() / geo.width()) - (quad[1].x() + geo.x()))*topProgress + quad[1].x());
|
|
|
|
quad[2].setX((icon.x() + icon.width()*(quad[2].x() / geo.width()) - (quad[2].x() + geo.x()))*bottomProgress + quad[2].x());
|
|
|
|
quad[3].setX((icon.x() + icon.width()*(quad[3].x() / geo.width()) - (quad[3].x() + geo.x()))*bottomProgress + quad[3].x());
|
2008-08-22 09:40:46 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
quad[0].setY(quad[0].y() + yOffsetTop);
|
|
|
|
quad[1].setY(quad[1].y() + yOffsetTop);
|
|
|
|
quad[2].setY(quad[2].y() + yOffsetBottom);
|
|
|
|
quad[3].setY(quad[3].y() + yOffsetBottom);
|
|
|
|
} else {
|
2008-08-22 09:40:46 +00:00
|
|
|
float quadFactor;
|
|
|
|
float xOffsetLeft;
|
|
|
|
float xOffsetRight;
|
|
|
|
float leftProgress;
|
|
|
|
float rightProgress;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (position == Right) {
|
|
|
|
quadFactor = quad[0].x() + (geo.width() - quad[0].x()) * progress;
|
|
|
|
xOffsetLeft = (icon.x() + quad[0].x() - geo.x()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.width() * geo.width() * geo.width()));
|
|
|
|
quadFactor = quad[1].x() + (geo.width() - quad[1].x()) * progress;
|
|
|
|
xOffsetRight = (icon.x() + quad[1].x() - geo.x()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.width() * geo.width() * geo.width()));
|
|
|
|
leftProgress = qMin(xOffsetLeft / (icon.x() + icon.width() - geo.x() - (float)(quad[0].x() / geo.width() * geo.width())), 1.0f);
|
|
|
|
rightProgress = qMin(xOffsetRight / (icon.x() + icon.width() - geo.x() - (float)(quad[1].x() / geo.width() * geo.width())), 1.0f);
|
|
|
|
} else {
|
|
|
|
quadFactor = geo.width() - quad[0].x() + (quad[0].x()) * progress;
|
|
|
|
xOffsetLeft = (geo.x() - icon.width() + geo.width() + quad[0].x() - icon.x()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.width() * geo.width() * geo.width()));
|
|
|
|
quadFactor = geo.width() - quad[1].x() + (quad[1].x()) * progress;
|
|
|
|
xOffsetRight = (geo.x() - icon.width() + geo.width() + quad[1].x() - icon.x()) * progress *
|
|
|
|
((quadFactor * quadFactor * quadFactor) / (geo.width() * geo.width() * geo.width()));
|
|
|
|
leftProgress = qMin(xOffsetLeft / (geo.x() - icon.width() + geo.width() - icon.x() -
|
|
|
|
(float)((geo.width() - quad[0].x()) / geo.width() * geo.width())), 1.0f);
|
|
|
|
rightProgress = qMin(xOffsetRight / (geo.x() - icon.width() + geo.width() - icon.x() -
|
|
|
|
(float)((geo.width() - quad[1].x()) / geo.width() * geo.width())), 1.0f);
|
|
|
|
}
|
|
|
|
if (position == Left) {
|
2008-08-22 09:40:46 +00:00
|
|
|
xOffsetLeft *= -1;
|
|
|
|
xOffsetRight *= -1;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (leftProgress < 0)
|
2008-08-22 09:40:46 +00:00
|
|
|
leftProgress *= -1;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (rightProgress < 0)
|
2008-08-22 09:40:46 +00:00
|
|
|
rightProgress *= -1;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
quad[0].setY((icon.y() + icon.height()*(quad[0].y() / geo.height()) - (quad[0].y() + geo.y()))*leftProgress + quad[0].y());
|
|
|
|
quad[1].setY((icon.y() + icon.height()*(quad[1].y() / geo.height()) - (quad[1].y() + geo.y()))*rightProgress + quad[1].y());
|
|
|
|
quad[2].setY((icon.y() + icon.height()*(quad[2].y() / geo.height()) - (quad[2].y() + geo.y()))*rightProgress + quad[2].y());
|
|
|
|
quad[3].setY((icon.y() + icon.height()*(quad[3].y() / geo.height()) - (quad[3].y() + geo.y()))*leftProgress + quad[3].y());
|
2008-08-22 09:40:46 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
quad[0].setX(quad[0].x() + xOffsetLeft);
|
|
|
|
quad[1].setX(quad[1].x() + xOffsetRight);
|
|
|
|
quad[2].setX(quad[2].x() + xOffsetRight);
|
|
|
|
quad[3].setX(quad[3].x() + xOffsetLeft);
|
2008-08-02 13:17:21 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
newQuads.append(quad);
|
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
data.quads = newQuads;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call the next effect.
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->paintWindow(w, mask, region, data);
|
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
|
|
|
void MagicLampEffect::postPaintScreen()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (mActiveAnimations > 0)
|
2008-08-02 13:17:21 +00:00
|
|
|
// Repaint the workspace so that everything would be repainted next time
|
|
|
|
effects->addRepaintFull();
|
|
|
|
mActiveAnimations = mTimeLineWindows.count();
|
|
|
|
|
|
|
|
// Call the next effect.
|
|
|
|
effects->postPaintScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
2011-02-27 09:47:42 +00:00
|
|
|
void MagicLampEffect::slotWindowDeleted(EffectWindow* w)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
mTimeLineWindows.remove(w);
|
|
|
|
}
|
2009-11-25 16:36:44 +00:00
|
|
|
|
2011-03-06 09:55:27 +00:00
|
|
|
void MagicLampEffect::slotWindowMinimized(EffectWindow* w)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (effects->activeFullScreenEffect())
|
2011-01-01 18:56:12 +00:00
|
|
|
return;
|
2008-08-02 13:17:21 +00:00
|
|
|
mTimeLineWindows[w].setCurveShape(TimeLine::LinearCurve);
|
2011-01-30 14:34:42 +00:00
|
|
|
mTimeLineWindows[w].setDuration(mAnimationDuration);
|
2008-08-02 13:17:21 +00:00
|
|
|
mTimeLineWindows[w].setProgress(0.0f);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void MagicLampEffect::windowUnminimized(EffectWindow* w)
|
|
|
|
{
|
|
|
|
if (effects->activeFullScreenEffect())
|
2011-01-01 18:56:12 +00:00
|
|
|
return;
|
2008-08-02 13:17:21 +00:00
|
|
|
mTimeLineWindows[w].setCurveShape(TimeLine::LinearCurve);
|
2011-01-30 14:34:42 +00:00
|
|
|
mTimeLineWindows[w].setDuration(mAnimationDuration);
|
2008-08-02 13:17:21 +00:00
|
|
|
mTimeLineWindows[w].setProgress(1.0f);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-02 13:17:21 +00:00
|
|
|
|
|
|
|
} // namespace
|