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-10-16 10:12:48 +00:00
|
|
|
#include "scene.h"
|
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
|
|
|
class Toplevel;
|
|
|
|
class Workspace;
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
class WindowPaintData
|
2006-07-05 12:56:04 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-10-16 10:12:48 +00:00
|
|
|
WindowPaintData();
|
|
|
|
double opacity;
|
|
|
|
double xScale;
|
|
|
|
double yScale;
|
|
|
|
int xTranslate;
|
|
|
|
int yTranslate;
|
2006-07-05 12:56:04 +00:00
|
|
|
};
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
class ScreenPaintData
|
2006-07-05 12:56:04 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-10-16 10:12:48 +00:00
|
|
|
ScreenPaintData();
|
|
|
|
int xTranslate;
|
|
|
|
int yTranslate;
|
2006-07-05 12:56:04 +00:00
|
|
|
};
|
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
class Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~Effect();
|
2006-10-24 19:17:48 +00:00
|
|
|
virtual void prePaintScreen( int* mask, QRegion* region, int time );
|
2006-10-16 10:12:48 +00:00
|
|
|
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
|
2006-10-24 19:17:48 +00:00
|
|
|
virtual void prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time );
|
2006-10-16 18:46:07 +00:00
|
|
|
virtual void paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data );
|
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 );
|
2006-10-16 10:12:48 +00:00
|
|
|
virtual void windowAdded( Toplevel* c );
|
2006-07-06 13:17:44 +00:00
|
|
|
virtual void windowDeleted( Toplevel* c );
|
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-10-16 10:12:48 +00:00
|
|
|
// for use by effects
|
2006-10-29 19:06:32 +00:00
|
|
|
void prePaintScreen( int* mask, QRegion* region, int time );
|
|
|
|
void paintScreen( int mask, QRegion region, ScreenPaintData& data );
|
|
|
|
void prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time );
|
|
|
|
void paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data );
|
2006-10-16 10:12:48 +00:00
|
|
|
// internal (used by kwin core or compositing code)
|
2006-10-29 19:06:32 +00:00
|
|
|
void startPaint();
|
2006-07-06 13:17:44 +00:00
|
|
|
void windowUserMovedResized( Toplevel* c, bool first, bool last );
|
2006-10-16 10:12:48 +00:00
|
|
|
void windowAdded( Toplevel* c );
|
2006-07-06 13:17:44 +00:00
|
|
|
void windowDeleted( Toplevel* c );
|
2006-10-16 10:12:48 +00:00
|
|
|
private:
|
|
|
|
QVector< Effect* > effects;
|
|
|
|
int current_paint_window;
|
|
|
|
int current_paint_screen;
|
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-10-24 19:17:48 +00:00
|
|
|
virtual void prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time );
|
2006-10-22 10:15:19 +00:00
|
|
|
virtual void paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& 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-10-24 19:17:48 +00:00
|
|
|
virtual void prePaintScreen( int* mask, QRegion* region, int time );
|
|
|
|
virtual void prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time );
|
2006-10-22 10:15:19 +00:00
|
|
|
virtual void paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data );
|
2006-07-06 13:17:44 +00:00
|
|
|
virtual void windowDeleted( Toplevel* c );
|
|
|
|
private slots:
|
|
|
|
void tick();
|
|
|
|
private:
|
2006-10-22 10:15:19 +00:00
|
|
|
QMap< const Toplevel*, int > windows;
|
2006-07-06 13:17:44 +00:00
|
|
|
QTimer timer;
|
|
|
|
};
|
|
|
|
|
2006-10-22 10:15:19 +00:00
|
|
|
#if 0
|
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-10-21 18:07:00 +00:00
|
|
|
#endif
|
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 );
|
2006-10-24 19:17:48 +00:00
|
|
|
virtual void prePaintScreen( int* mask, QRegion* region, int time );
|
2006-10-21 18:07:00 +00:00
|
|
|
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
|
2006-07-06 19:02:14 +00:00
|
|
|
private slots:
|
|
|
|
void tick();
|
|
|
|
private:
|
|
|
|
QTimer timer;
|
|
|
|
bool up;
|
2006-10-24 19:17:48 +00:00
|
|
|
int diff;
|
2006-07-06 19:02:14 +00:00
|
|
|
Workspace* wspace;
|
|
|
|
};
|
2006-10-16 10:12:48 +00:00
|
|
|
|
2006-10-24 19:17:48 +00:00
|
|
|
class FadeIn
|
|
|
|
: public Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time );
|
|
|
|
virtual void paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data );
|
|
|
|
// TODO react also on virtual desktop changes
|
|
|
|
virtual void windowAdded( Toplevel* c );
|
|
|
|
virtual void windowDeleted( Toplevel* c );
|
|
|
|
private:
|
|
|
|
QMap< const Toplevel*, double > windows;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ScaleIn
|
|
|
|
: public Effect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time );
|
|
|
|
virtual void paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data );
|
|
|
|
// TODO react also on virtual desktop changes
|
|
|
|
virtual void windowAdded( Toplevel* c );
|
|
|
|
virtual void windowDeleted( Toplevel* c );
|
|
|
|
private:
|
|
|
|
QMap< const Toplevel*, double > windows;
|
|
|
|
};
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
inline
|
|
|
|
WindowPaintData::WindowPaintData()
|
|
|
|
: opacity( 1.0 )
|
|
|
|
, xScale( 1 )
|
|
|
|
, yScale( 1 )
|
|
|
|
, xTranslate( 0 )
|
|
|
|
, yTranslate( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
ScreenPaintData::ScreenPaintData()
|
|
|
|
: xTranslate( 0 )
|
|
|
|
, yTranslate( 0 )
|
|
|
|
{
|
|
|
|
}
|
2006-07-06 19:02:14 +00:00
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|