aboutsummaryrefslogtreecommitdiff
path: root/util/fbcompose/plugins/xrender/preview/PreviewPlugin.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/plugins/xrender/preview/PreviewPlugin.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/plugins/xrender/preview/PreviewPlugin.hh')
-rw-r--r--util/fbcompose/plugins/xrender/preview/PreviewPlugin.hh153
1 files changed, 153 insertions, 0 deletions
diff --git a/util/fbcompose/plugins/xrender/preview/PreviewPlugin.hh b/util/fbcompose/plugins/xrender/preview/PreviewPlugin.hh
new file mode 100644
index 0000000..5f1c0d1
--- /dev/null
+++ b/util/fbcompose/plugins/xrender/preview/PreviewPlugin.hh
@@ -0,0 +1,153 @@
1/** PreviewPlugin.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_PREVIEW_PREVIEWPLUGIN_HH
25#define FBCOMPOSITOR_PLUGIN_XRENDER_PREVIEW_PREVIEWPLUGIN_HH
26
27
28#include "Enumerations.hh"
29#include "TickTracker.hh"
30#include "XRenderPlugin.hh"
31#include "XRenderResources.hh"
32
33#include "FbTk/FbString.hh"
34
35#include <X11/Xlib.h>
36#include <X11/extensions/Xrender.h>
37
38#include <map>
39#include <vector>
40
41
42namespace FbCompositor {
43
44 class BaseScreen;
45 class XRenderScreen;
46 class XRenderWindow;
47
48
49 /**
50 * Provides window preview feature for the iconbar.
51 */
52 class PreviewPlugin : public XRenderPlugin {
53 struct PreviewWindowData;
54
55 public :
56 //--- CONSTRUCTORS AND DESTRUCTORS -------------------------------------
57
58 /** Constructor. */
59 PreviewPlugin(const BaseScreen &screen, const std::vector<FbTk::FbString> &args);
60
61 /** Destructor. */
62 ~PreviewPlugin();
63
64
65 //--- ACCESSORS --------------------------------------------------------
66
67 /** \returns the name of the plugin. */
68 const char *pluginName() const;
69
70
71 //--- WINDOW EVENT CALLBACKS -------------------------------------------
72
73 /** Called, whenever a new window is created. */
74 void windowCreated(const BaseCompWindow &window);
75
76 /** Called, whenever a window is destroyed. */
77 void windowDestroyed(const BaseCompWindow &window);
78
79
80 //--- RENDERING ACTIONS ------------------------------------------------
81
82 /** Rectangles that the plugin wishes to damage. */
83 const std::vector<XRectangle> &damagedAreas();
84
85 /** Extra rendering actions and jobs. */
86 const std::vector<XRenderRenderingJob> &extraRenderingActions();
87
88
89 private :
90 //--- INTERNAL FUNCTIONS -----------------------------------------------
91
92 /** Update the preview window data. */
93 void updatePreviewWindowData(PreviewWindowData &win_preview);
94
95 /** Update the preview window position. */
96 void updatePreviewWindowPos(PreviewWindowData &win_preview);
97
98
99 //--- GENERAL RENDERING VARIABLES --------------------------------------
100
101 /** Vector, containing the areas that the plugin wishes to paint. */
102 std::vector<XRectangle> m_damaged_areas;
103
104 /** Vector, containing the plugin's extra rendering jobs. */
105 std::vector<XRenderRenderingJob> m_extra_jobs;
106
107
108 /** Preview window's mask. */
109 XRenderPicturePtr m_mask_picture;
110
111 /** Timer that signals when the preview window should appear. */
112 TickTracker m_tick_tracker;
113
114
115 /** Previously modified rectangle. */
116 XRectangle m_previous_damage;
117
118 /** Previously drawn preview window. */
119 Window m_previous_window;
120
121
122 //--- PREVIEW WINDOW DATA ----------------------------------------------
123
124 /** Holds data about the preview window. */
125 struct PreviewWindowData {
126 const XRenderWindow &window; ///< The corresponding window object.
127 XRenderRenderingJob job; ///< Rendering job of this preview object.
128 };
129
130 /** A list of potential preview windows. */
131 std::map<Window, PreviewWindowData> m_preview_data;
132 };
133
134
135 //--- INLINE FUNCTIONS -----------------------------------------------------
136
137 // Returns the name of the plugin.
138 inline const char *PreviewPlugin::pluginName() const {
139 return "preview";
140 }
141}
142
143
144//--- PLUGIN MANAGER FUNCTIONS -------------------------------------------------
145
146/** Creates a plugin object. */
147extern "C" FbCompositor::BasePlugin *createPlugin(const FbCompositor::BaseScreen &screen, const std::vector<FbTk::FbString> &args);
148
149/** \returns the type of the plugin. */
150extern "C" FbCompositor::PluginType pluginType();
151
152
153#endif // FBCOMPOSITOR_PLUGIN_XRENDER_PREVIEW_PREVIEWPLUGIN_HH