2006-07-04 20:51:01 +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.
|
|
|
|
******************************************************************/
|
|
|
|
|
2006-07-05 12:56:04 +00:00
|
|
|
// TODO MIT or some other licence, perhaps move to some lib
|
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
#ifndef KWIN_EFFECTS_H
|
|
|
|
#define KWIN_EFFECTS_H
|
|
|
|
|
2006-07-06 14:20:03 +00:00
|
|
|
#include <qmap.h>
|
|
|
|
#include <qpoint.h>
|
|
|
|
#include <qtimer.h>
|
2006-07-06 13:17:44 +00:00
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
|
|
|
class Toplevel;
|
|
|
|
class Workspace;
|
|
|
|
|
2006-07-05 12:56:04 +00:00
|
|
|
class Matrix
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Matrix();
|
2006-07-06 13:17:44 +00:00
|
|
|
Matrix& operator*=( const Matrix& m );
|
|
|
|
bool isOnlyTranslate() const;
|
|
|
|
bool isIdentity() const;
|
|
|
|
double xTranslate() const;
|
|
|
|
double yTranslate() const;
|
|
|
|
double zTranslate() const;
|
2006-07-06 14:20:03 +00:00
|
|
|
QPoint transform( const QPoint& p ) const;
|
2006-07-05 22:26:34 +00:00
|
|
|
double m[ 4 ][ 4 ];
|
2006-07-05 12:56:04 +00:00
|
|
|
};
|
|
|
|
|
2006-07-06 13:17:44 +00:00
|
|
|
Matrix operator*( const Matrix& m1, const Matrix& m2 );
|
|
|
|
|
|
|
|
inline Matrix& Matrix::operator*=( const Matrix& m )
|
|
|
|
{
|
|
|
|
return *this = *this * m;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline double Matrix::xTranslate() const
|
|
|
|
{
|
|
|
|
return m[ 0 ][ 3 ];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline double Matrix::yTranslate() const
|
|
|
|
{
|
|
|
|
return m[ 1 ][ 3 ];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline double Matrix::zTranslate() const
|
|
|
|
{
|
|
|
|
return m[ 2 ][ 3 ];
|
|
|
|
}
|
|
|
|
|
2006-07-05 12:56:04 +00:00
|
|
|
class EffectData
|
|
|
|
{
|
|
|
|
public:
|
2006-07-05 22:26:34 +00:00
|
|
|
double opacity;
|
2006-07-05 12:56:04 +00:00
|
|
|
};
|
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
class Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Effect();
|
2006-07-06 13:17:44 +00:00
|
|
|
// called when moved/resized or once after it's finished
|
|
|
|
virtual void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
|
|
|
virtual void windowDeleted( Toplevel* c );
|
2006-07-06 18:22:01 +00:00
|
|
|
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
2006-07-06 19:02:14 +00:00
|
|
|
virtual void transformWorkspace( Matrix& m, EffectData& data );
|
2006-07-04 20:51:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class EffectsHandler
|
|
|
|
{
|
|
|
|
public:
|
2006-07-06 19:02:14 +00:00
|
|
|
EffectsHandler( Workspace* ws );
|
2006-07-10 18:34:57 +00:00
|
|
|
~EffectsHandler();
|
2006-07-06 13:17:44 +00:00
|
|
|
void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
|
|
|
void windowDeleted( Toplevel* c );
|
2006-07-06 18:22:01 +00:00
|
|
|
void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
2006-07-06 19:02:14 +00:00
|
|
|
void transformWorkspace( Matrix& m, EffectData& data );
|
2006-07-04 20:51:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern EffectsHandler* effects;
|
|
|
|
|
2006-07-06 13:17:44 +00:00
|
|
|
class MakeHalfTransparent
|
|
|
|
: public Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
2006-07-06 18:22:01 +00:00
|
|
|
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
2006-07-06 13:17:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ShakyMove
|
|
|
|
: public QObject, public Effect
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ShakyMove();
|
|
|
|
virtual void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
2006-07-06 18:22:01 +00:00
|
|
|
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
2006-07-06 13:17:44 +00:00
|
|
|
virtual void windowDeleted( Toplevel* c );
|
|
|
|
private slots:
|
|
|
|
void tick();
|
|
|
|
private:
|
|
|
|
QMap< Toplevel*, int > windows;
|
|
|
|
QTimer timer;
|
|
|
|
};
|
|
|
|
|
2006-07-06 18:22:01 +00:00
|
|
|
class GrowMove
|
|
|
|
: public Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
|
|
|
virtual void transformWindow( Toplevel* c, Matrix& m, EffectData& data );
|
|
|
|
};
|
2006-07-06 13:17:44 +00:00
|
|
|
|
2006-07-06 19:02:14 +00:00
|
|
|
class ShiftWorkspaceUp
|
|
|
|
: public QObject, public Effect
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ShiftWorkspaceUp( Workspace* ws );
|
|
|
|
virtual void transformWorkspace( Matrix& m, EffectData& data );
|
|
|
|
private slots:
|
|
|
|
void tick();
|
|
|
|
private:
|
|
|
|
QTimer timer;
|
|
|
|
bool up;
|
|
|
|
Workspace* wspace;
|
|
|
|
};
|
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|