Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kwin / scene_xrender.h
blob5492e41cd7277b47a37bff5b0588688cd52421f8
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 XRenderPictFormat* format;
58 Picture front;
59 static Picture buffer;
60 static ScreenPaintData screen_paint;
61 class Window;
62 QHash< Toplevel*, Window* > windows;
63 bool init_ok;
66 class SceneXrender::Window
67 : public Scene::Window
69 public:
70 Window( Toplevel* c );
71 virtual ~Window();
72 virtual void performPaint( int mask, QRegion region, WindowPaintData data );
73 void discardPicture();
74 void discardAlpha();
75 QRegion transformedShape() const;
76 void setTransformedShape( const QRegion& shape );
77 private:
78 Picture picture();
79 Picture alphaMask( double opacity );
80 Picture _picture;
81 XRenderPictFormat* format;
82 Picture alpha;
83 double alpha_cached_opacity;
84 QRegion transformed_shape;
87 inline
88 Picture SceneXrender::bufferPicture()
90 return buffer;
93 inline
94 QRegion SceneXrender::Window::transformedShape() const
96 return transformed_shape;
99 inline
100 void SceneXrender::Window::setTransformedShape( const QRegion& shape )
102 transformed_shape = shape;
105 } // namespace
107 #endif
109 #endif