aboutsummaryrefslogtreecommitdiff
path: root/util/fbcompose/XRenderScreen.hh
diff options
context:
space:
mode:
Diffstat (limited to 'util/fbcompose/XRenderScreen.hh')
-rw-r--r--util/fbcompose/XRenderScreen.hh164
1 files changed, 164 insertions, 0 deletions
diff --git a/util/fbcompose/XRenderScreen.hh b/util/fbcompose/XRenderScreen.hh
new file mode 100644
index 0000000..2453b0f
--- /dev/null
+++ b/util/fbcompose/XRenderScreen.hh
@@ -0,0 +1,164 @@
1/** XRenderScreen.hh file for the fluxbox compositor. */
2
3// Copyright (c) 2011 Gediminas Liktaras (gliktaras at gmail dot com)
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21// THE SOFTWARE.
22
23
24#ifndef FBCOMPOSITOR_XRENDERSCREEN_HH
25#define FBCOMPOSITOR_XRENDERSCREEN_HH
26
27
28#include "BaseScreen.hh"
29
30#include "XRenderPlugin.hh"
31#include "XRenderResources.hh"
32
33#include <X11/extensions/Xfixes.h>
34#include <X11/extensions/Xrender.h>
35#include <X11/Xlib.h>
36
37
38namespace FbCompositor {
39
40 class BaseScreen;
41 class CompositorConfig;
42 class XRenderScreen;
43 class XRenderWindow;
44
45
46 /**
47 * Manages the screen in XRender rendering mode.
48 */
49 class XRenderScreen : public BaseScreen {
50 public:
51 //--- CONSTRUCTORS AND DESTRUCTORS -------------------------------------
52
53 /** Constructor. */
54 XRenderScreen(int screen_number, const CompositorConfig &config);
55
56 /** Destructor. */
57 ~XRenderScreen();
58
59
60 //--- ACCESSORS --------------------------------------------------------
61
62 /** \returns the preferred filter for XRender Pictures. */
63 const char *pictFilter() const;
64
65
66 //--- SCREEN MANIPULATION ----------------------------------------------
67
68 /** Notifies the screen of a background change. */
69 void setRootPixmapChanged();
70
71 /** Notifies the screen of a root window change. */
72 void setRootWindowSizeChanged();
73
74
75 //--- SCREEN RENDERING -------------------------------------------------
76
77 /** Renders the screen's contents. */
78 void renderScreen();
79
80
81 protected:
82 //--- SPECIALIZED WINDOW MANIPULATION FUNCTIONS ------------------------
83
84 /** Creates a window object from its XID. */
85 BaseCompWindow *createWindowObject(Window window);
86
87
88 private:
89 //--- INITIALIZATION FUNCTIONS -----------------------------------------
90
91 /** Initializes the rendering surface. */
92 void initRenderingSurface();
93
94
95 //--- SCREEN MANIPULATION ----------------------------------------------
96
97 /** Update the background picture. */
98 void updateBackgroundPicture();
99
100
101 //--- RENDERING FUNCTIONS ----------------------------------------------
102
103 /** Clips the backbuffer picture to damaged area. */
104 void clipBackBufferToDamage();
105
106 /** Perform a rendering job on the back buffer picture. */
107 void executeRenderingJob(const XRenderRenderingJob &job);
108
109 /** Render the desktop wallpaper. */
110 void renderBackground();
111
112 /** Perform extra rendering jobs from plugins. */
113 void renderExtraJobs();
114
115 /** Render the reconfigure rectangle. */
116 void renderReconfigureRect();
117
118 /** Render a particular window onto the screen. */
119 void renderWindow(XRenderWindow &window);
120
121 /** Swap back and front buffers. */
122 void swapBuffers();
123
124
125 //--- MAIN RENDERING-RELATED VARIABLES ---------------------------------
126
127 /** The rendering window. */
128 Window m_rendering_window;
129
130 /** The picture of the back buffer. */
131 XRenderPicturePtr m_back_buffer_picture;
132
133 /** The picture of the rendering window. */
134 XRenderPicturePtr m_rendering_picture;
135
136
137 /** A container for rectangle, damaged by plugins. */
138 std::vector<XRectangle> m_plugin_damage_rects;
139
140 /** Screen region, damaged by plugins. */
141 XserverRegion m_plugin_damage;
142
143
144 /** The picture of the root window. */
145 XRenderPicturePtr m_root_picture;
146
147 /** Whether the root window has changed since the last update. */
148 bool m_root_changed;
149
150
151 /** The picture filter to use. */
152 const char *m_pict_filter;
153 };
154
155
156 //--- INLINE FUNCTIONS -------------------------------------------------
157
158 // Returns the preferred filter for XRender Pictures.
159 inline const char *XRenderScreen::pictFilter() const {
160 return m_pict_filter;
161 }
162}
163
164#endif // FBCOMPOSITOR_XRENDERSCREEN_HH