not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kwin / scene_xrender.h
blob2b800de43403f24aece6abb93a016f8e824ef335
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
21 #ifndef KWIN_SCENE_XRENDER_H
22 #define KWIN_SCENE_XRENDER_H
24 #include <config-workspace.h>
26 #include "scene.h"
28 #ifdef KWIN_HAVE_XRENDER_COMPOSITING
29 #include <X11/extensions/Xrender.h>
30 #include <X11/extensions/Xfixes.h>
32 namespace KWin
36 class SceneXrender
37 : public Scene
39 public:
40 SceneXrender( Workspace* ws );
41 virtual ~SceneXrender();
42 virtual bool initFailed() const;
43 virtual CompositingType compositingType() const { return XRenderCompositing; }
44 virtual void paint( QRegion damage, ToplevelList windows );
45 virtual void windowGeometryShapeChanged( Toplevel* );
46 virtual void windowOpacityChanged( Toplevel* );
47 virtual void windowAdded( Toplevel* );
48 virtual void windowClosed( Toplevel*, Deleted* );
49 virtual void windowDeleted( Deleted* );
50 Picture bufferPicture();
51 protected:
52 virtual void paintBackground( QRegion region );
53 virtual void paintGenericScreen( int mask, ScreenPaintData data );
54 private:
55 void paintTransformedScreen( int mask );
56 void createBuffer();
57 void flushBuffer( int mask, QRegion damage );
58 bool selfCheck();
59 XRenderPictFormat* format;
60 Picture front;
61 static Picture buffer;
62 static ScreenPaintData screen_paint;
63 class Window;
64 QHash< Toplevel*, Window* > windows;
65 bool init_ok;
68 class SceneXrender::Window
69 : public Scene::Window
71 public:
72 Window( Toplevel* c );
73 virtual ~Window();
74 virtual void performPaint( int mask, QRegion region, WindowPaintData data );
75 void discardPicture();
76 void discardAlpha();
77 QRegion transformedShape() const;
78 void setTransformedShape( const QRegion& shape );
79 private:
80 Picture picture();
81 Picture alphaMask( double opacity );
82 Picture _picture;
83 XRenderPictFormat* format;
84 Picture alpha;
85 double alpha_cached_opacity;
86 QRegion transformed_shape;
89 inline
90 Picture SceneXrender::bufferPicture()
92 return buffer;
95 inline
96 QRegion SceneXrender::Window::transformedShape() const
98 return transformed_shape;
101 inline
102 void SceneXrender::Window::setTransformedShape( const QRegion& shape )
104 transformed_shape = shape;
107 } // namespace
109 #endif
111 #endif