From 6df9d6ed54a299c0897cdd2d8aa380dc02b15a41 Mon Sep 17 00:00:00 2001 From: simonb Date: Tue, 26 Apr 2005 11:37:29 +0000 Subject: fix drawing foreground when transparency off --- ChangeLog | 3 +++ src/FbTk/FbWindow.cc | 38 ++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73e4ce5..c439291 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.13 +*05/04/27: + * Fix drawing when transparency off (Simon) + FbWindow.cc *05/04/26: * Fix systray icon sizing (send a configurenotify on resize) (Simon) SystemTray.cc WinClient.hh/cc FbTk/FbWindow.hh/cc Window.cc 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) { if (only_if_alpha && alpha == 255) return; - - if (alpha != 255 && m_lastbg_pm != ParentRelative) { + // still use bg buffer pixmap if transparent + // cause it does nice caching things + if (m_lastbg_pm != ParentRelative) { // update source and destination if needed Pixmap root = FbPixmap::getRootPixmap(screenNumber()); - if (m_transparent->source() != root) + if (alpha != 255 && m_transparent->source() != root) m_transparent->setSource(root, screenNumber()); FbPixmap newpm = FbPixmap(*this, width(), height(), depth()); @@ -178,7 +179,9 @@ void FbWindow::updateBackground(bool only_if_alpha) { newpm.copyArea((m_lastbg_pm == None)?drawable():m_lastbg_pm, gc, 0, 0, 0, 0, width(), height()); } XFreeGC(display(), gc); - m_transparent->setDest(newpm.drawable(), screenNumber()); + + if (alpha != 255) + m_transparent->setDest(newpm.drawable(), screenNumber()); // get root position @@ -196,15 +199,17 @@ void FbWindow::updateBackground(bool only_if_alpha) { } // render background image from root pos to our window - m_transparent->render(root_x, root_y, - 0, 0, - width(), height()); + if (alpha != 255) + m_transparent->render(root_x, root_y, + 0, 0, + width(), height()); // render any foreground items if (m_renderer) m_renderer->renderForeground(*this, newpm); - m_transparent->freeDest(); // it's only temporary, don't leave it hanging around + if (alpha != 255) + m_transparent->freeDest(); // it's only temporary, don't leave it hanging around newbg = newpm.release(); } @@ -315,12 +320,17 @@ void FbWindow::setAlpha(unsigned char alpha) { // don't setOpaque, let controlling objects do that // since it's only needed on toplevel windows - } else if (m_transparent.get() == 0 && alpha < 255) { - m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber())); - } else if (alpha < 255 && alpha != m_transparent->alpha()) - m_transparent->setAlpha(alpha); - else if (alpha == 255) - m_transparent.reset(0); // destroy transparent object + } else { + if (!FbTk::Transparent::haveRender()) + alpha = 255; + + if (m_transparent.get() == 0 && alpha < 255) { + m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber())); + } else if (alpha < 255 && alpha != m_transparent->alpha()) + m_transparent->setAlpha(alpha); + else if (alpha == 255) + m_transparent.reset(0); // destroy transparent object + } #endif // HAVE_XRENDER } -- cgit v0.11.2