aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbWindow.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-04-21 16:07:45 (GMT)
committersimonb <simonb>2006-04-21 16:07:45 (GMT)
commit67326a080a6b8029c1d3b0cc23dfadaf888da32f (patch)
treed366009b22706bf6cf6a0e646dea03a414a62ce3 /src/FbTk/FbWindow.cc
parenta8b9672792908ca6f3a05a6060ce9927adb878b1 (diff)
downloadfluxbox_pavel-67326a080a6b8029c1d3b0cc23dfadaf888da32f.zip
fluxbox_pavel-67326a080a6b8029c1d3b0cc23dfadaf888da32f.tar.bz2
update transparent window backgrounds on bg change
Diffstat (limited to 'src/FbTk/FbWindow.cc')
-rw-r--r--src/FbTk/FbWindow.cc37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index a380312..8f204b1 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -118,8 +118,10 @@ FbWindow::FbWindow(Window client):FbDrawable(), m_parent(0),
118FbWindow::~FbWindow() { 118FbWindow::~FbWindow() {
119 119
120 // Need to free xrender pics before destroying window 120 // Need to free xrender pics before destroying window
121 if (m_transparent.get() != 0) 121 if (m_transparent.get() != 0) {
122 removeAlphaWin(*this);
122 m_transparent.reset(0); 123 m_transparent.reset(0);
124 }
123 125
124 if (m_window != 0) { 126 if (m_window != 0) {
125 // so we don't get any dangling eventhandler for this window 127 // so we don't get any dangling eventhandler for this window
@@ -127,6 +129,7 @@ FbWindow::~FbWindow() {
127 if (m_destroy) 129 if (m_destroy)
128 XDestroyWindow(display(), m_window); 130 XDestroyWindow(display(), m_window);
129 } 131 }
132
130} 133}
131 134
132void FbWindow::setBackgroundColor(const FbTk::Color &bg_color) { 135void FbWindow::setBackgroundColor(const FbTk::Color &bg_color) {
@@ -319,8 +322,10 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u
319void FbWindow::setAlpha(unsigned char alpha) { 322void FbWindow::setAlpha(unsigned char alpha) {
320#ifdef HAVE_XRENDER 323#ifdef HAVE_XRENDER
321 if (FbTk::Transparent::haveComposite()) { 324 if (FbTk::Transparent::haveComposite()) {
322 if (m_transparent.get() != 0) 325 if (m_transparent.get() != 0) {
326 removeAlphaWin(*this);
323 m_transparent.reset(0); 327 m_transparent.reset(0);
328 }
324 329
325 // don't setOpaque, let controlling objects do that 330 // don't setOpaque, let controlling objects do that
326 // since it's only needed on toplevel windows 331 // since it's only needed on toplevel windows
@@ -330,10 +335,13 @@ void FbWindow::setAlpha(unsigned char alpha) {
330 335
331 if (m_transparent.get() == 0 && alpha < 255) { 336 if (m_transparent.get() == 0 && alpha < 255) {
332 m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber())); 337 m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber()));
338 addAlphaWin(*this);
333 } else if (alpha < 255 && alpha != m_transparent->alpha()) 339 } else if (alpha < 255 && alpha != m_transparent->alpha())
334 m_transparent->setAlpha(alpha); 340 m_transparent->setAlpha(alpha);
335 else if (alpha == 255) 341 else if (alpha == 255) {
342 removeAlphaWin(*this);
336 m_transparent.reset(0); // destroy transparent object 343 m_transparent.reset(0); // destroy transparent object
344 }
337 } 345 }
338#endif // HAVE_XRENDER 346#endif // HAVE_XRENDER
339} 347}
@@ -592,6 +600,29 @@ void FbWindow::sendConfigureNotify(int x, int y,
592 600
593} 601}
594 602
603FbWindow::FbWinList FbWindow::m_alpha_wins;
604
605void FbWindow::addAlphaWin(FbWindow &win) {
606 m_alpha_wins.insert(&win);
607}
608
609void FbWindow::removeAlphaWin(FbWindow &win) {
610 FbWinList::iterator it = m_alpha_wins.find(&win);
611 if (it != m_alpha_wins.end())
612 m_alpha_wins.erase(it);
613}
614
615void FbWindow::updatedAlphaBackground(int screen) {
616 FbWinList::iterator it = m_alpha_wins.begin();
617 FbWinList::iterator it_end = m_alpha_wins.end();
618 for (; it != it_end; ++it) {
619 if ((*it)->screenNumber() == screen) {
620 (*it)->updateBackground(false);
621 (*it)->clear();
622 }
623 }
624}
625
595bool operator == (Window win, const FbWindow &fbwin) { 626bool operator == (Window win, const FbWindow &fbwin) {
596 return win == fbwin.window(); 627 return win == fbwin.window();
597} 628}