diff options
author | Gediminas Liktaras <gliktaras@gmail.com> | 2011-12-08 13:34:09 (GMT) |
---|---|---|
committer | Paul Tagliamonte <paultag@fluxbox.org> | 2011-12-10 16:13:19 (GMT) |
commit | cd339169d1961eb508ea89cee2609ec6d0fc0c15 (patch) | |
tree | 01acd158a03fb17a72e067ff0b36701da75e49dc /util/fbcompose/plugins/xrender/fade/FadePlugin.hh | |
parent | 85ac5c4b2c6a526992f483a6e91867dc2f82a19e (diff) | |
download | fluxbox_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/plugins/xrender/fade/FadePlugin.hh')
-rw-r--r-- | util/fbcompose/plugins/xrender/fade/FadePlugin.hh | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/util/fbcompose/plugins/xrender/fade/FadePlugin.hh b/util/fbcompose/plugins/xrender/fade/FadePlugin.hh new file mode 100644 index 0000000..ef25e7b --- /dev/null +++ b/util/fbcompose/plugins/xrender/fade/FadePlugin.hh | |||
@@ -0,0 +1,169 @@ | |||
1 | /** FadePlugin.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_PLUGIN_XRENDER_FADE_FADEPLUGIN_HH | ||
25 | #define FBCOMPOSITOR_PLUGIN_XRENDER_FADE_FADEPLUGIN_HH | ||
26 | |||
27 | |||
28 | #include "Enumerations.hh" | ||
29 | #include "Exceptions.hh" | ||
30 | #include "TickTracker.hh" | ||
31 | #include "XRenderPlugin.hh" | ||
32 | #include "XRenderResources.hh" | ||
33 | |||
34 | #include "FbTk/FbString.hh" | ||
35 | |||
36 | #include <X11/Xlib.h> | ||
37 | #include <X11/extensions/Xrender.h> | ||
38 | |||
39 | #include <map> | ||
40 | #include <vector> | ||
41 | |||
42 | |||
43 | namespace FbCompositor { | ||
44 | |||
45 | class BaseScreen; | ||
46 | class XRenderScreen; | ||
47 | class XRenderWindow; | ||
48 | |||
49 | |||
50 | /** | ||
51 | * A simple plugin that provides window fades for XRender renderer. | ||
52 | */ | ||
53 | class FadePlugin : public XRenderPlugin { | ||
54 | public : | ||
55 | //--- CONSTRUCTORS AND DESTRUCTORS ------------------------------------- | ||
56 | |||
57 | /** Constructor. */ | ||
58 | FadePlugin(const BaseScreen &screen, const std::vector<FbTk::FbString> &args); | ||
59 | |||
60 | /** Destructor. */ | ||
61 | ~FadePlugin(); | ||
62 | |||
63 | |||
64 | //--- ACCESSORS -------------------------------------------------------- | ||
65 | |||
66 | /** \returns the name of the plugin. */ | ||
67 | const char *pluginName() const; | ||
68 | |||
69 | |||
70 | //--- WINDOW EVENT CALLBACKS ------------------------------------------- | ||
71 | |||
72 | /** Called, whenever a window becomes ignored. */ | ||
73 | void windowBecameIgnored(const BaseCompWindow &window); | ||
74 | |||
75 | /** Called, whenever a window is mapped. */ | ||
76 | void windowMapped(const BaseCompWindow &window); | ||
77 | |||
78 | /** Called, whenever a window is unmapped. */ | ||
79 | void windowUnmapped(const BaseCompWindow &window); | ||
80 | |||
81 | |||
82 | //--- RENDERING ACTIONS ------------------------------------------------ | ||
83 | |||
84 | /** Rectangles that the plugin wishes to damage. */ | ||
85 | const std::vector<XRectangle> &damagedAreas(); | ||
86 | |||
87 | |||
88 | /** Window rendering job initialization. */ | ||
89 | void windowRenderingJobInit(const XRenderWindow &window, XRenderRenderingJob &job); | ||
90 | |||
91 | |||
92 | /** Extra rendering actions and jobs. */ | ||
93 | const std::vector<XRenderRenderingJob> &extraRenderingActions(); | ||
94 | |||
95 | /** Post extra rendering actions. */ | ||
96 | void postExtraRenderingActions(); | ||
97 | |||
98 | |||
99 | private : | ||
100 | //--- INTERNAL FUNCTIONS ----------------------------------------------- | ||
101 | |||
102 | /** \returns the faded mask picture for the given window fade. */ | ||
103 | void createFadedMask(int alpha, XRenderPicturePtr mask, XRectangle dimensions, | ||
104 | XRenderPicturePtr fade_picture_return); | ||
105 | |||
106 | |||
107 | //--- GENERAL RENDERING VARIABLES -------------------------------------- | ||
108 | |||
109 | /** PictFormat for fade pictures. */ | ||
110 | XRenderPictFormat *m_fade_pict_format; | ||
111 | |||
112 | |||
113 | /** Vector, containing the areas that the plugin wishes to paint. */ | ||
114 | std::vector<XRectangle> m_damaged_areas; | ||
115 | |||
116 | /** Vector, containing the plugin's extra rendering jobs. */ | ||
117 | std::vector<XRenderRenderingJob> m_extra_jobs; | ||
118 | |||
119 | |||
120 | //--- FADE SPECIFIC ---------------------------------------------------- | ||
121 | |||
122 | /** Holds the data about positive fades. */ | ||
123 | struct PosFadeData { | ||
124 | XRectangle dimensions; ///< Window's dimensions. | ||
125 | int fade_alpha; ///< Window's relative fade alpha. | ||
126 | XRenderPicturePtr fade_picture; ///< Picture of the faded window. | ||
127 | TickTracker timer; ///< Timer that tracks the current fade. | ||
128 | }; | ||
129 | |||
130 | /** A list of appearing (positive) fades. */ | ||
131 | std::map<Window, PosFadeData> m_positive_fades; | ||
132 | |||
133 | |||
134 | /** Holds the data about positive fades. */ | ||
135 | struct NegFadeData { | ||
136 | Window window_id; ///< ID of the window that is being faded. | ||
137 | XRenderRenderingJob job; ///< Rendering job, associated with this fade. | ||
138 | XRenderPicturePtr mask_picture; ///< Window's shape mask. | ||
139 | |||
140 | XRectangle dimensions; ///< Window's dimensions. | ||
141 | int fade_alpha; ///< Window's relative fade alpha. | ||
142 | XRenderPicturePtr fade_picture; ///< Picture of the faded window. | ||
143 | TickTracker timer; ///< Timer that tracks the current fade. | ||
144 | }; | ||
145 | |||
146 | /** A list of disappearing (negative) fades. */ | ||
147 | std::vector<NegFadeData> m_negative_fades; | ||
148 | }; | ||
149 | |||
150 | |||
151 | //--- INLINE FUNCTIONS ----------------------------------------------------- | ||
152 | |||
153 | // Returns the name of the plugin. | ||
154 | inline const char *FadePlugin::pluginName() const { | ||
155 | return "fade"; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | |||
160 | //--- PLUGIN MANAGER FUNCTIONS ------------------------------------------------- | ||
161 | |||
162 | /** Creates a plugin object. */ | ||
163 | extern "C" FbCompositor::BasePlugin *createPlugin(const FbCompositor::BaseScreen &screen, const std::vector<FbTk::FbString> &args); | ||
164 | |||
165 | /** \returns the type of the plugin. */ | ||
166 | extern "C" FbCompositor::PluginType pluginType(); | ||
167 | |||
168 | |||
169 | #endif // FBCOMPOSITOR_PLUGIN_XRENDER_FADE_FADEPLUGIN_HH | ||