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-10-16 10:12:48 +00:00
|
|
|
#include "scene.h"
|
|
|
|
|
2007-01-05 16:45:56 +00:00
|
|
|
#include <qpair.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();
|
2006-11-09 21:27:27 +00:00
|
|
|
/**
|
|
|
|
* Window opacity, in range 0 = transparent to 1 = fully opaque
|
|
|
|
*/
|
2006-10-16 10:12:48 +00:00
|
|
|
double opacity;
|
|
|
|
double xScale;
|
|
|
|
double yScale;
|
|
|
|
int xTranslate;
|
|
|
|
int yTranslate;
|
2006-11-09 21:27:27 +00:00
|
|
|
/**
|
|
|
|
* Saturation of the window, in range [0; 1]
|
|
|
|
* 1 means that the window is unchanged, 0 means that it's completely
|
|
|
|
* unsaturated (greyscale). 0.5 would make the colors less intense,
|
|
|
|
* but not completely grey
|
|
|
|
**/
|
2006-11-07 23:33:23 +00:00
|
|
|
float saturation;
|
2006-11-09 21:27:27 +00:00
|
|
|
/**
|
|
|
|
* Brightness of the window, in range [0; 1]
|
|
|
|
* 1 means that the window is unchanged, 0 means that it's completely
|
|
|
|
* black. 0.5 would make it 50% darker than usual
|
|
|
|
**/
|
2006-11-08 19:10:07 +00:00
|
|
|
float brightness;
|
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();
|
2006-12-03 13:36:40 +00:00
|
|
|
double xScale;
|
|
|
|
double yScale;
|
2006-10-16 10:12:48 +00:00
|
|
|
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-29 19:07:10 +00:00
|
|
|
virtual void postPaintScreen();
|
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-10-29 19:07:10 +00:00
|
|
|
virtual void postPaintWindow( Scene::Window* w );
|
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-10-30 22:49:59 +00:00
|
|
|
virtual void windowActivated( Toplevel* c );
|
2007-01-05 16:45:56 +00:00
|
|
|
virtual void windowInputMouseEvent( Window w, QEvent* e );
|
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 );
|
2006-10-29 19:07:10 +00:00
|
|
|
void postPaintScreen();
|
2006-10-29 19:06:32 +00:00
|
|
|
void prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time );
|
|
|
|
void paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data );
|
2006-10-29 19:07:10 +00:00
|
|
|
void postPaintWindow( Scene::Window* w );
|
2007-01-05 16:45:56 +00:00
|
|
|
// Functions for handling input - e.g. when an Expose-like effect is shown, an input window
|
|
|
|
// covering the whole screen is created and all mouse events will be intercepted by it.
|
|
|
|
// The effect's windowInputMouseEvent() will get called with such events.
|
|
|
|
Window createInputWindow( Effect* e, int x, int y, int w, int h, const QCursor& cursor );
|
|
|
|
Window createInputWindow( Effect* e, const QRect& r, const QCursor& cursor );
|
|
|
|
void destroyInputWindow( Window w );
|
|
|
|
// functions that allow controlling windows/desktop
|
|
|
|
void activateWindow( Client* c );
|
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-30 22:49:59 +00:00
|
|
|
void windowActivated( Toplevel* c );
|
2007-01-05 16:45:56 +00:00
|
|
|
bool checkInputWindowEvent( XEvent* e );
|
|
|
|
void checkInputWindowStacking();
|
2006-10-16 10:12:48 +00:00
|
|
|
private:
|
|
|
|
QVector< Effect* > effects;
|
2007-01-05 16:45:56 +00:00
|
|
|
typedef QPair< Effect*, Window > InputWindowPair;
|
|
|
|
QList< InputWindowPair > input_windows;
|
2006-10-16 10:12:48 +00:00
|
|
|
int current_paint_window;
|
|
|
|
int current_paint_screen;
|
2006-07-04 20:51:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern EffectsHandler* effects;
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
inline
|
|
|
|
WindowPaintData::WindowPaintData()
|
|
|
|
: opacity( 1.0 )
|
|
|
|
, xScale( 1 )
|
|
|
|
, yScale( 1 )
|
|
|
|
, xTranslate( 0 )
|
|
|
|
, yTranslate( 0 )
|
2006-11-07 23:33:23 +00:00
|
|
|
, saturation( 1 )
|
2006-11-08 19:10:07 +00:00
|
|
|
, brightness( 1 )
|
2006-10-16 10:12:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
ScreenPaintData::ScreenPaintData()
|
2006-12-03 13:36:40 +00:00
|
|
|
: xScale( 1 )
|
|
|
|
, yScale( 1 )
|
|
|
|
, xTranslate( 0 )
|
2006-10-16 10:12:48 +00:00
|
|
|
, yTranslate( 0 )
|
|
|
|
{
|
|
|
|
}
|
2006-07-06 19:02:14 +00:00
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|