aboutsummaryrefslogtreecommitdiff
path: root/util/fbcompose/Compositor.hh
diff options
context:
space:
mode:
authorGediminas Liktaras <gliktaras@gmail.com>2011-12-08 13:34:09 (GMT)
committerPaul Tagliamonte <paultag@fluxbox.org>2011-12-10 16:13:19 (GMT)
commitcd339169d1961eb508ea89cee2609ec6d0fc0c15 (patch)
tree01acd158a03fb17a72e067ff0b36701da75e49dc /util/fbcompose/Compositor.hh
parent85ac5c4b2c6a526992f483a6e91867dc2f82a19e (diff)
downloadfluxbox_paul-cd339169d1961eb508ea89cee2609ec6d0fc0c15.zip
fluxbox_paul-cd339169d1961eb508ea89cee2609ec6d0fc0c15.tar.bz2
fbcompose - A compositing addon for fluxbox window manager.
fbcompose(1) is an optional compositing addon for fluxbox window manager. It augments fluxbox with a number of graphical features. Most notably, fbcompose allows fluxbox to properly display applications that require compositing (docky, for example), adds support for true window transparency (as opposed to fluxbox's pseudo transparency) and provides a plugin framework to extend the compositor's functionality. As this is still a beta version of the compositor, the bugs are likely.
Diffstat (limited to 'util/fbcompose/Compositor.hh')
-rw-r--r--util/fbcompose/Compositor.hh188
1 files changed, 188 insertions, 0 deletions
diff --git a/util/fbcompose/Compositor.hh b/util/fbcompose/Compositor.hh
new file mode 100644
index 0000000..459bfb0
--- /dev/null
+++ b/util/fbcompose/Compositor.hh
@@ -0,0 +1,188 @@
1/** Compositor.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_COMPOSITOR_HH
25#define FBCOMPOSITOR_COMPOSITOR_HH
26
27
28#include "Enumerations.hh"
29#include "Exceptions.hh"
30#include "TickTracker.hh"
31
32#include "FbTk/App.hh"
33
34#include <X11/Xlib.h>
35
36#include <vector>
37
38
39namespace FbCompositor {
40
41 class BaseScreen;
42 class CompositorConfig;
43
44
45 //--- TYPEDEFS -------------------------------------------------------------
46
47 /** A pointer to an X query extension function. */
48 typedef Bool (*QueryExtensionFunction)(Display*, int*, int*);
49
50 /** A pointer to an X query version function. */
51 typedef Status (*QueryVersionFunction)(Display*, int*, int*);
52
53
54 //--- MAIN COMPOSITOR CLASS ------------------------------------------------
55
56 /**
57 * Main class for the compositor.
58 *
59 * Note that if the serverauto rendering mode is selected, ServerAutoApp is
60 * used instead. This was done to take out the ad-hoc code out of this
61 * class, since this class is too complex for serverauto rendering.
62 */
63 class Compositor : public FbTk::App {
64 public:
65 //--- CONSTRUCTORS AND DESTRUCTORS -------------------------------------
66
67 /** Constructor. */
68 Compositor(const CompositorConfig &configuration);
69
70 /** Destructor. */
71 ~Compositor();
72
73
74 //--- EVENT LOOP -------------------------------------------------------
75
76 /** Enters the event loop. */
77 void eventLoop();
78
79
80 private:
81 //--- CONSTRUCTORS -----------------------------------------------------
82
83 /** Copy constructor. */
84 Compositor(const Compositor&);
85
86 /** Assignment operator. */
87 Compositor &operator=(const Compositor&);
88
89
90 //--- INITIALIZATION FUNCTIONS -----------------------------------------
91
92 /** Acquire the ownership of compositing manager selections. */
93 Window getCMSelectionOwnership(int screen_number);
94
95 /** Initializes all relevant X's extensions. */
96 void initAllExtensions();
97
98 /** Initializes a particular X server extension. */
99 void initExtension(const char *extension_name, QueryExtensionFunction extension_func,
100 QueryVersionFunction version_func, const int min_major_ver, const int min_minor_ver,
101 int &event_base, int &error_base);
102
103 /** Initializes monitor heads on every screen. */
104 void initHeads();
105
106
107 //--- INTERNAL FUNCTIONS -----------------------------------------------
108
109 /** \returns the exposed area in a XExposeEvent as an XRectangle. */
110 XRectangle getExposedRect(const XExposeEvent &event);
111
112 /** Locates the screen an event affects. Returns -1 on failure. */
113 int screenOfEvent(const XEvent &event);
114
115
116 //--- COMPOSITOR VARIABLES ---------------------------------------------
117
118 /** A tick tracker that controls when the screen is redrawn. */
119 TickTracker m_timer;
120
121 /** Rendering mode in use. */
122 RenderingMode m_rendering_mode;
123
124 /** The array of available screens. */
125 std::vector<BaseScreen*> m_screens;
126
127
128 //--- EXTENSION BASE VARIABLES -----------------------------------------
129
130 /** Event base of the X Composite extension. */
131 int m_composite_event_base;
132
133 /** Error base of the X Composite extension. */
134 int m_composite_error_base;
135
136 /** Event base of the X Damage extension. */
137 int m_damage_event_base;
138
139 /** Error base of the X Damage extension. */
140 int m_damage_error_base;
141
142 /** Event base of the GLX extension. */
143 int m_glx_event_base;
144
145 /** Error base of the GLX extension. */
146 int m_glx_error_base;
147
148 /** Event base of the X Fixes extension. */
149 int m_fixes_event_base;
150
151 /** Error base of the X Fixes extension. */
152 int m_fixes_error_base;
153
154 /** Event base of the X Render extension. */
155 int m_render_event_base;
156
157 /** Error base of the X Render extension. */
158 int m_render_error_base;
159
160 /** Event base of the X Shape extension. */
161 int m_shape_event_base;
162
163 /** Error base of the X Shape extension. */
164 int m_shape_error_base;
165
166 /** Event base of the Xinerama extension. */
167 int m_xinerama_event_base;
168
169 /** Error base of the Xinerama extension. */
170 int m_xinerama_error_base;
171 };
172
173
174 //--- VARIOUS HANDLERS -----------------------------------------------------
175
176 /** Custom signal handler. */
177 void handleSignal(int signal);
178
179
180 /** Custom X error handler (ignore). */
181 int ignoreXError(Display *display, XErrorEvent *error);
182
183 /** Custom X error handler (print, continue). */
184 int printXError(Display *display, XErrorEvent *error);
185}
186
187
188#endif // FBCOMPOSITOR_COMPOSITOR_HH