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-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-07-05 12:30:03 +00:00
|
|
|
protected:
|
2006-10-15 08:58:38 +00:00
|
|
|
enum
|
|
|
|
{
|
2006-10-16 18:46:07 +00:00
|
|
|
PAINT_WINDOW_OPAQUE = 1 << 0,
|
|
|
|
PAINT_WINDOW_TRANSLUCENT = 1 << 1
|
|
|
|
};
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PAINT_SCREEN_REGION = 1 << 0,
|
|
|
|
PAINT_SCREEN_ALL = 1 << 1
|
2006-10-15 08:58:38 +00:00
|
|
|
};
|
2006-10-16 21:06:34 +00:00
|
|
|
virtual void paintGenericScreen();
|
|
|
|
virtual void paintSimpleScreen( QRegion region );
|
|
|
|
virtual void paintBackground( QRegion region ) = 0;
|
|
|
|
virtual void paintWindow( Window* w, int mask, QRegion region );
|
2006-10-15 08:58:38 +00:00
|
|
|
static QRegion infiniteRegion();
|
|
|
|
struct Phase2Data
|
|
|
|
{
|
2006-10-16 21:06:34 +00:00
|
|
|
Phase2Data( Window* w, QRegion r ) : window( w ), region( r ) {}
|
|
|
|
Window* window;
|
2006-10-15 08:58:38 +00:00
|
|
|
QRegion region;
|
|
|
|
};
|
2006-10-16 21:06:34 +00:00
|
|
|
QVector< Window* > stacking_order;
|
2006-07-05 12:30:03 +00:00
|
|
|
Workspace* wspace;
|
2006-10-16 21:06:34 +00:00
|
|
|
class WrapperEffect;
|
2006-07-05 12:30:03 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
virtual void performPaint( QRegion region, int mask ) = 0;
|
2006-10-15 08:58:38 +00:00
|
|
|
int x() const;
|
|
|
|
int y() const;
|
|
|
|
int width() const;
|
|
|
|
int height() const;
|
|
|
|
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-07-05 12:30:03 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|