aboutsummaryrefslogtreecommitdiff
path: root/util/fbcompose/CompositorConfig.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/CompositorConfig.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/CompositorConfig.hh')
-rw-r--r--util/fbcompose/CompositorConfig.hh225
1 files changed, 225 insertions, 0 deletions
diff --git a/util/fbcompose/CompositorConfig.hh b/util/fbcompose/CompositorConfig.hh
new file mode 100644
index 0000000..cb4ae07
--- /dev/null
+++ b/util/fbcompose/CompositorConfig.hh
@@ -0,0 +1,225 @@
1/** CompositorConfig.cc 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_COMPOSITORCONFIG_HH
25#define FBCOMPOSITOR_COMPOSITORCONFIG_HH
26
27#ifdef HAVE_CONFIG_H
28 #include "config.h"
29#endif // HAVE_CONFIG_H
30
31#include "Enumerations.hh"
32#include "Exceptions.hh"
33
34#include "FbTk/FbString.hh"
35
36#include <X11/Xlib.h>
37
38#include <vector>
39#include <iosfwd>
40
41
42namespace FbCompositor {
43
44 /**
45 * Handles the compositor's configuration.
46 *
47 * This class is responsible for obtaining the compositor's configuration,
48 * ensuring that all of it is correct and presenting it to the Compositor
49 * class.
50 */
51 class CompositorConfig {
52 public:
53 //--- CONSTRUCTORS AND DESTRUCTORS -------------------------------------
54
55 /** Constructor. */
56 CompositorConfig(std::vector<FbTk::FbString> args);
57
58 /** Copy constructor. */
59 CompositorConfig(const CompositorConfig &other);
60
61 /** Assignment operator. */
62 CompositorConfig &operator=(const CompositorConfig &other);
63
64 /** Destructor. */
65 ~CompositorConfig();
66
67
68 //--- ACCESSORS --------------------------------------------------------
69
70 /** \returns the display name. */
71 const FbTk::FbString &displayName() const;
72
73 /** \returns the refresh rate. */
74 int framesPerSecond() const;
75
76 /** \returns the selected rendering mode. */
77 RenderingMode renderingMode() const;
78
79 /** \returns whether the X errors should be printed. */
80 bool showXErrors() const;
81
82 /** \returns whether the compositor should synchronize with the X server. */
83 bool synchronize() const;
84
85 /** \returns the user plugin directory. */
86 const FbTk::FbString &userPluginDir() const;
87
88#ifdef USE_XRENDER_COMPOSITING
89 /** \returns the XRender picture filter. */
90 const char *xRenderPictFilter() const;
91#endif // USE_XRENDER_COMPOSITING
92
93
94 /** \returns the number of available plugins. */
95 int pluginCount() const;
96
97 /** \returns the name of the given plugin. */
98 const FbTk::FbString &pluginName(int plugin_id) const;
99
100 /** \returns the arguments to the given plugin. */
101 const std::vector<FbTk::FbString> &pluginArgs(int plugin_id) const;
102
103
104 //--- CONVENIENCE FUNCTIONS --------------------------------------------
105
106 /** Output full help message. */
107 static void printFullHelp(std::ostream &os);
108
109 /** Output short help message. */
110 static void printShortHelp(std::ostream &os);
111
112 /** Output version information. */
113 static void printVersion(std::ostream &os);
114
115 private:
116 //--- INTERNAL FUNCTIONS -----------------------------------------------
117
118 /** Make the first scan of the arguments for special options. */
119 void preScanArguments();
120
121 /** Properly scan the command line arguments. */
122 void processArguments();
123
124
125 /** Fetch the value of the next command line argument, advance iterator. */
126 FbTk::FbString getNextOption(std::vector<FbTk::FbString>::iterator &it, const char *error_message);
127
128
129 //--- PRIVATE VARIABLES ------------------------------------------------
130
131 /** The passed command line arguments. */
132 std::vector<FbTk::FbString> m_args;
133
134
135 /** Selected rendering mode. */
136 RenderingMode m_rendering_mode;
137
138#ifdef USE_XRENDER_COMPOSITING
139 /** XRender picture filter. */
140 FbTk::FbString m_xrender_pict_filter;
141#endif // USE_XRENDER_COMPOSITING
142
143
144 /** The name of the display we want to use. */
145 FbTk::FbString m_display_name;
146
147 /** The refresh rate. */
148 int m_frames_per_second;
149
150 /** Plugins and their arguments. */
151 std::vector< std::pair< FbTk::FbString, std::vector<FbTk::FbString> > > m_plugins;
152
153 /** Whether the X errors should be printed. */
154 bool m_show_x_errors;
155
156 /** Whether the compositor should synchronize with the X server. */
157 bool m_synchronize;
158
159 /** User plugin directory. */
160 FbTk::FbString m_user_plugin_dir;
161 };
162
163
164 //--- INLINE FUNCTIONS -----------------------------------------------------
165
166 // Returns the display name.
167 inline const FbTk::FbString &CompositorConfig::displayName() const {
168 return m_display_name;
169 }
170
171 // Returns the refresh rate.
172 inline int CompositorConfig::framesPerSecond() const {
173 return m_frames_per_second;
174 }
175
176 // Returns the arguments to the given plugin.
177 inline const std::vector<FbTk::FbString> &CompositorConfig::pluginArgs(int plugin_id) const {
178 if ((plugin_id < 0) || (plugin_id >= pluginCount())) {
179 throw IndexException("Out of bounds index in CompositorConfig::pluginArgs.");
180 }
181 return m_plugins[plugin_id].second;
182 }
183
184 // Returns the number of available plugins.
185 inline int CompositorConfig::pluginCount() const {
186 return (int)(m_plugins.size());
187 }
188
189 // Returns the name of the given plugin.
190 inline const FbTk::FbString &CompositorConfig::pluginName(int plugin_id) const {
191 if ((plugin_id < 0) || (plugin_id >= pluginCount())) {
192 throw IndexException("Out of bounds index in CompositorConfig::pluginName.");
193 }
194 return m_plugins[plugin_id].first;
195 }
196
197 // Returns the rendering mode.
198 inline RenderingMode CompositorConfig::renderingMode() const {
199 return m_rendering_mode;
200 }
201
202 // Returns whether the X errors should be printed.
203 inline bool CompositorConfig::showXErrors() const {
204 return m_show_x_errors;
205 }
206
207 // Returns whether the compositor should synchronize with the X server.
208 inline bool CompositorConfig::synchronize() const {
209 return m_synchronize;
210 }
211
212 // Returns the user plugin directory.
213 inline const FbTk::FbString &CompositorConfig::userPluginDir() const {
214 return m_user_plugin_dir;
215 }
216
217#ifdef USE_XRENDER_COMPOSITING
218 // Returns the XRender picture filter.
219 inline const char *CompositorConfig::xRenderPictFilter() const {
220 return m_xrender_pict_filter.c_str();
221 }
222#endif // USE_XRENDER_COMPOSITING
223}
224
225#endif // FBCOMPOSITOR_COMPOSITORCONFIG_HH