aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorsimonb <simonb>2005-04-26 11:37:29 (GMT)
committersimonb <simonb>2005-04-26 11:37:29 (GMT)
commit6df9d6ed54a299c0897cdd2d8aa380dc02b15a41 (patch)
tree44152df68ee2dac4b2fa82d6dbe59e8aebcd9033 /src/FbTk
parente57a30f664f7fb2660967f40db2c10759c2e9e4f (diff)
downloadfluxbox_paul-6df9d6ed54a299c0897cdd2d8aa380dc02b15a41.zip
fluxbox_paul-6df9d6ed54a299c0897cdd2d8aa380dc02b15a41.tar.bz2
fix drawing foreground when transparency off
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/FbWindow.cc38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index e00fa14..2863b3a 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -159,11 +159,12 @@ void FbWindow::updateBackground(bool only_if_alpha) {
159 if (only_if_alpha && alpha == 255) 159 if (only_if_alpha && alpha == 255)
160 return; 160 return;
161 161
162 162 // still use bg buffer pixmap if transparent
163 if (alpha != 255 && m_lastbg_pm != ParentRelative) { 163 // cause it does nice caching things
164 if (m_lastbg_pm != ParentRelative) {
164 // update source and destination if needed 165 // update source and destination if needed
165 Pixmap root = FbPixmap::getRootPixmap(screenNumber()); 166 Pixmap root = FbPixmap::getRootPixmap(screenNumber());
166 if (m_transparent->source() != root) 167 if (alpha != 255 && m_transparent->source() != root)
167 m_transparent->setSource(root, screenNumber()); 168 m_transparent->setSource(root, screenNumber());
168 169
169 FbPixmap newpm = FbPixmap(*this, width(), height(), depth()); 170 FbPixmap newpm = FbPixmap(*this, width(), height(), depth());
@@ -178,7 +179,9 @@ void FbWindow::updateBackground(bool only_if_alpha) {
178 newpm.copyArea((m_lastbg_pm == None)?drawable():m_lastbg_pm, gc, 0, 0, 0, 0, width(), height()); 179 newpm.copyArea((m_lastbg_pm == None)?drawable():m_lastbg_pm, gc, 0, 0, 0, 0, width(), height());
179 } 180 }
180 XFreeGC(display(), gc); 181 XFreeGC(display(), gc);
181 m_transparent->setDest(newpm.drawable(), screenNumber()); 182
183 if (alpha != 255)
184 m_transparent->setDest(newpm.drawable(), screenNumber());
182 185
183 // get root position 186 // get root position
184 187
@@ -196,15 +199,17 @@ void FbWindow::updateBackground(bool only_if_alpha) {
196 } 199 }
197 200
198 // render background image from root pos to our window 201 // render background image from root pos to our window
199 m_transparent->render(root_x, root_y, 202 if (alpha != 255)
200 0, 0, 203 m_transparent->render(root_x, root_y,
201 width(), height()); 204 0, 0,
205 width(), height());
202 206
203 // render any foreground items 207 // render any foreground items
204 if (m_renderer) 208 if (m_renderer)
205 m_renderer->renderForeground(*this, newpm); 209 m_renderer->renderForeground(*this, newpm);
206 210
207 m_transparent->freeDest(); // it's only temporary, don't leave it hanging around 211 if (alpha != 255)
212 m_transparent->freeDest(); // it's only temporary, don't leave it hanging around
208 newbg = newpm.release(); 213 newbg = newpm.release();
209 } 214 }
210 215
@@ -315,12 +320,17 @@ void FbWindow::setAlpha(unsigned char alpha) {
315 320
316 // don't setOpaque, let controlling objects do that 321 // don't setOpaque, let controlling objects do that
317 // since it's only needed on toplevel windows 322 // since it's only needed on toplevel windows
318 } else if (m_transparent.get() == 0 && alpha < 255) { 323 } else {
319 m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber())); 324 if (!FbTk::Transparent::haveRender())
320 } else if (alpha < 255 && alpha != m_transparent->alpha()) 325 alpha = 255;
321 m_transparent->setAlpha(alpha); 326
322 else if (alpha == 255) 327 if (m_transparent.get() == 0 && alpha < 255) {
323 m_transparent.reset(0); // destroy transparent object 328 m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber()));
329 } else if (alpha < 255 && alpha != m_transparent->alpha())
330 m_transparent->setAlpha(alpha);
331 else if (alpha == 255)
332 m_transparent.reset(0); // destroy transparent object
333 }
324#endif // HAVE_XRENDER 334#endif // HAVE_XRENDER
325} 335}
326 336