summaryrefslogtreecommitdiff
path: root/src/FbTk/Transparent.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Transparent.cc')
-rw-r--r--src/FbTk/Transparent.cc68
1 files changed, 54 insertions, 14 deletions
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc
index b6521b9..f8ca2a8 100644
--- a/src/FbTk/Transparent.cc
+++ b/src/FbTk/Transparent.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Transparent.cc,v 1.8 2004/09/11 15:52:23 rathnor Exp $ 22// $Id: Transparent.cc,v 1.9 2004/09/12 14:56:20 rathnor Exp $
23 23
24#include "Transparent.hh" 24#include "Transparent.hh"
25#include "App.hh" 25#include "App.hh"
@@ -99,26 +99,67 @@ namespace FbTk {
99 99
100bool Transparent::s_init = false; 100bool Transparent::s_init = false;
101bool Transparent::s_render = false; 101bool Transparent::s_render = false;
102bool Transparent::s_composite = false;
102 103
103Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num): 104void Transparent::init() {
104 m_alpha_pic(0), m_src_pic(0), m_dest_pic(0),
105 m_source(src), m_dest(dest), m_alpha(alpha) {
106
107 Display *disp = FbTk::App::instance()->display(); 105 Display *disp = FbTk::App::instance()->display();
108 106
109 // check for RENDER support 107 int major_opcode, first_event, first_error;
110 if (!s_init) { 108 if (XQueryExtension(disp, "RENDER",
111 int major_opcode, first_event, first_error; 109 &major_opcode,
112 if (XQueryExtension(disp, "RENDER", 110 &first_event, &first_error) == False) {
111 s_render = false;
112 s_composite = false;
113 } else { // we have RENDER support
114 s_render = true;
115
116 if (XQueryExtension(disp, "Composite",
113 &major_opcode, 117 &major_opcode,
114 &first_event, &first_error) == False) { 118 &first_event, &first_error) == False) {
115 s_render = false; 119 s_composite = false;
116 } else { // we got RENDER support 120 } else { // we have Composite support
117 s_render = true; 121 s_composite = true;
118 } 122 }
119 s_init = true;
120 } 123 }
124 s_init = true;
125}
121 126
127void Transparent::usePseudoTransparent(bool no_composite) {
128 if (s_composite != no_composite)
129 return;
130
131 s_init = false;
132 init(); // only use render if we have it
133
134 if (no_composite)
135 s_composite = false;
136}
137
138bool Transparent::haveComposite(bool for_real) {
139 if (for_real) {
140 Display *disp = FbTk::App::instance()->display();
141 int major_opcode, first_event, first_error;
142
143 return (XQueryExtension(disp, "Composite",
144 &major_opcode,
145 &first_event, &first_error) == True);
146 } else {
147 if (!s_init)
148 init();
149
150 return s_composite;
151 }
152}
153
154Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num):
155 m_alpha_pic(0), m_src_pic(0), m_dest_pic(0),
156 m_source(src), m_dest(dest), m_alpha(alpha) {
157
158 Display *disp = FbTk::App::instance()->display();
159
160 // check for Extension support
161 if (!s_init)
162 init();
122 163
123#ifdef HAVE_XRENDER 164#ifdef HAVE_XRENDER
124 if (!s_render) 165 if (!s_render)
@@ -126,7 +167,6 @@ Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int s
126 167
127 allocAlpha(m_alpha); 168 allocAlpha(m_alpha);
128 169
129
130 XRenderPictFormat *format = 170 XRenderPictFormat *format =
131 XRenderFindVisualFormat(disp, 171 XRenderFindVisualFormat(disp,
132 DefaultVisual(disp, screen_num)); 172 DefaultVisual(disp, screen_num));