aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Transparent.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Transparent.cc')
-rw-r--r--src/FbTk/Transparent.cc42
1 files changed, 15 insertions, 27 deletions
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc
index 6563d5a..d80b2b2 100644
--- a/src/FbTk/Transparent.cc
+++ b/src/FbTk/Transparent.cc
@@ -112,6 +112,7 @@ namespace FbTk {
112bool Transparent::s_init = false; 112bool Transparent::s_init = false;
113bool Transparent::s_render = false; 113bool Transparent::s_render = false;
114bool Transparent::s_composite = false; 114bool Transparent::s_composite = false;
115bool Transparent::s_use_composite = false;
115 116
116void Transparent::init() { 117void Transparent::init() {
117 Display *disp = FbTk::App::instance()->display(); 118 Display *disp = FbTk::App::instance()->display();
@@ -119,48 +120,35 @@ void Transparent::init() {
119 int major_opcode, first_event, first_error; 120 int major_opcode, first_event, first_error;
120 if (XQueryExtension(disp, "RENDER", 121 if (XQueryExtension(disp, "RENDER",
121 &major_opcode, 122 &major_opcode,
122 &first_event, &first_error) == False) { 123 &first_event, &first_error)) {
123 s_render = false; 124 // we have XRENDER support
124 s_composite = false;
125 } else { // we have RENDER support
126 s_render = true; 125 s_render = true;
127 126
128 if (XQueryExtension(disp, "Composite", 127 if (XQueryExtension(disp, "Composite",
129 &major_opcode, 128 &major_opcode,
130 &first_event, &first_error) == False) { 129 &first_event, &first_error)) {
131 s_composite = false; 130 // we have Composite support
132 } else { // we have Composite support
133 s_composite = true; 131 s_composite = true;
132 s_use_composite = true;
134 } 133 }
135 } 134 }
136 s_init = true; 135 s_init = true;
137} 136}
138 137
139void Transparent::usePseudoTransparent(bool no_composite) { 138void Transparent::usePseudoTransparent(bool force) {
140 if (s_composite != no_composite) 139 if (!s_init)
141 return; 140 init();
142 141 s_use_composite = (!force && s_composite);
143 s_init = false;
144 init(); // only use render if we have it
145
146 if (no_composite)
147 s_composite = false;
148} 142}
149 143
150bool Transparent::haveComposite(bool for_real) { 144bool Transparent::haveComposite(bool for_real) {
151 if (for_real) { 145 if (!s_init)
152 Display *disp = FbTk::App::instance()->display(); 146 init();
153 int major_opcode, first_event, first_error;
154
155 return (XQueryExtension(disp, "Composite",
156 &major_opcode,
157 &first_event, &first_error) == True);
158 } else {
159 if (!s_init)
160 init();
161 147
148 if (for_real)
162 return s_composite; 149 return s_composite;
163 } 150 else
151 return s_use_composite;
164} 152}
165 153
166Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num): 154Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num):