2006-07-05 12:30:03 +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.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_SCENE_H
|
|
|
|
#define KWIN_SCENE_H
|
|
|
|
|
2006-10-24 19:17:48 +00:00
|
|
|
#include <qdatetime.h>
|
|
|
|
|
2006-10-15 08:58:38 +00:00
|
|
|
#include "toplevel.h"
|
2006-10-16 21:06:34 +00:00
|
|
|
#include "utils.h"
|
2006-07-05 12:30:03 +00:00
|
|
|
|
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
|
|
|
class Workspace;
|
2006-10-16 10:12:48 +00:00
|
|
|
class WindowPaintData;
|
|
|
|
class ScreenPaintData;
|
2006-07-05 12:30:03 +00:00
|
|
|
|
|
|
|
class Scene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Scene( Workspace* ws );
|
2006-10-07 21:18:36 +00:00
|
|
|
virtual ~Scene() = 0;
|
2006-10-16 10:12:48 +00:00
|
|
|
class Window;
|
2006-10-01 21:14:53 +00:00
|
|
|
// repaints the given screen areas, windows provides the stacking order
|
2006-09-30 15:40:03 +00:00
|
|
|
virtual void paint( QRegion damage, ToplevelList windows ) = 0;
|
2006-10-01 21:14:53 +00:00
|
|
|
// shape/size of a window changed
|
2006-07-05 20:52:57 +00:00
|
|
|
virtual void windowGeometryShapeChanged( Toplevel* );
|
2006-10-01 21:14:53 +00:00
|
|
|
// opacity of a window changed
|
2006-07-05 20:52:57 +00:00
|
|
|
virtual void windowOpacityChanged( Toplevel* );
|
2006-10-01 21:14:53 +00:00
|
|
|
// a new window has been created
|
2006-09-29 19:05:36 +00:00
|
|
|
virtual void windowAdded( Toplevel* );
|
2006-10-01 21:14:53 +00:00
|
|
|
// a window has been destroyed
|
2006-07-05 20:52:57 +00:00
|
|
|
virtual void windowDeleted( Toplevel* );
|
2006-10-15 08:58:38 +00:00
|
|
|
enum
|
|
|
|
{
|
2006-10-16 18:46:07 +00:00
|
|
|
PAINT_WINDOW_OPAQUE = 1 << 0,
|
2006-10-21 18:07:00 +00:00
|
|
|
PAINT_WINDOW_TRANSLUCENT = 1 << 1,
|
|
|
|
PAINT_WINDOW_TRANSFORMED = 1 << 2,
|
|
|
|
PAINT_SCREEN_REGION = 1 << 3,
|
|
|
|
PAINT_SCREEN_TRANSFORMED = 1 << 4
|
2006-10-16 18:46:07 +00:00
|
|
|
};
|
2006-10-24 19:17:48 +00:00
|
|
|
// there's nothing to paint (adjust time_diff later)
|
|
|
|
void idle();
|
2006-10-21 18:07:00 +00:00
|
|
|
protected:
|
2006-10-24 13:38:31 +00:00
|
|
|
void paintScreen( int* mask, QRegion* region );
|
2006-10-29 19:06:32 +00:00
|
|
|
friend class EffectsHandler;
|
|
|
|
void finalPaintScreen( int mask, QRegion region, ScreenPaintData& data );
|
2006-10-21 18:07:00 +00:00
|
|
|
virtual void paintGenericScreen( int mask, ScreenPaintData data );
|
|
|
|
virtual void paintSimpleScreen( int mask, QRegion region );
|
2006-10-16 21:06:34 +00:00
|
|
|
virtual void paintBackground( QRegion region ) = 0;
|
2006-10-29 19:06:32 +00:00
|
|
|
void finalPaintWindow( Window* w, int mask, QRegion region, WindowPaintData& data );
|
2006-10-16 21:06:34 +00:00
|
|
|
virtual void paintWindow( Window* w, int mask, QRegion region );
|
2006-10-15 08:58:38 +00:00
|
|
|
static QRegion infiniteRegion();
|
2006-10-24 19:17:48 +00:00
|
|
|
void updateTimeDiff();
|
2006-10-15 08:58:38 +00:00
|
|
|
struct Phase2Data
|
|
|
|
{
|
2006-10-22 10:15:19 +00:00
|
|
|
Phase2Data( Window* w, QRegion r, int m ) : window( w ), region( r ), mask( m ) {}
|
2006-10-16 21:06:34 +00:00
|
|
|
Window* window;
|
2006-10-15 08:58:38 +00:00
|
|
|
QRegion region;
|
2006-10-22 10:15:19 +00:00
|
|
|
int mask;
|
2006-10-15 08:58:38 +00:00
|
|
|
};
|
2006-10-16 21:06:34 +00:00
|
|
|
QVector< Window* > stacking_order;
|
2006-10-24 19:17:48 +00:00
|
|
|
int time_diff;
|
|
|
|
QTime last_time;
|
2006-07-05 12:30:03 +00:00
|
|
|
Workspace* wspace;
|
|
|
|
};
|
|
|
|
|
2006-10-15 08:58:38 +00:00
|
|
|
class Scene::Window
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Window( Toplevel* c );
|
2006-10-16 10:12:48 +00:00
|
|
|
virtual ~Window();
|
2006-10-16 21:06:34 +00:00
|
|
|
virtual void free(); // is often copied by value, use manually instead of dtor
|
2006-10-22 10:15:19 +00:00
|
|
|
virtual void performPaint( int mask, QRegion region, WindowPaintData data ) = 0;
|
2006-10-15 08:58:38 +00:00
|
|
|
int x() const;
|
|
|
|
int y() const;
|
|
|
|
int width() const;
|
|
|
|
int height() const;
|
2006-10-22 10:15:19 +00:00
|
|
|
const Toplevel* window() const;
|
2006-10-15 08:58:38 +00:00
|
|
|
bool isVisible() const;
|
|
|
|
bool isOpaque() const;
|
|
|
|
QRegion shape() const;
|
|
|
|
void discardShape();
|
|
|
|
Window() {} // QMap sucks even in Qt4
|
|
|
|
protected:
|
|
|
|
Toplevel* toplevel;
|
|
|
|
private:
|
|
|
|
mutable QRegion shape_region;
|
|
|
|
mutable bool shape_valid;
|
|
|
|
};
|
|
|
|
|
2006-07-05 12:30:03 +00:00
|
|
|
extern Scene* scene;
|
|
|
|
|
2006-10-15 08:58:38 +00:00
|
|
|
inline
|
|
|
|
QRegion Scene::infiniteRegion()
|
|
|
|
{ // INT_MIN / 2 because it's width/height (INT_MIN+INT_MAX==-1)
|
|
|
|
return QRegion( INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
int Scene::Window::x() const
|
|
|
|
{
|
|
|
|
return toplevel->x();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
int Scene::Window::y() const
|
|
|
|
{
|
|
|
|
return toplevel->y();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
int Scene::Window::width() const
|
|
|
|
{
|
|
|
|
return toplevel->width();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
int Scene::Window::height() const
|
|
|
|
{
|
|
|
|
return toplevel->height();
|
|
|
|
}
|
2006-10-22 10:15:19 +00:00
|
|
|
|
|
|
|
inline
|
|
|
|
const Toplevel* Scene::Window::window() const
|
|
|
|
{
|
|
|
|
return toplevel;
|
|
|
|
}
|
|
|
|
|
2006-07-05 12:30:03 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|