diff options
Diffstat (limited to 'src/FbTk/FbWindow.cc')
-rw-r--r-- | src/FbTk/FbWindow.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 2e69339..7e6c863 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.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: FbWindow.cc,v 1.42 2004/09/11 22:59:15 fluxgen Exp $ | 22 | // $Id: FbWindow.cc,v 1.43 2004/09/12 14:56:19 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWindow.hh" | 24 | #include "FbWindow.hh" |
25 | #include "FbPixmap.hh" | 25 | #include "FbPixmap.hh" |
@@ -161,6 +161,9 @@ void FbWindow::clearArea(int x, int y, | |||
161 | 161 | ||
162 | void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, unsigned int the_height) { | 162 | void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, unsigned int the_height) { |
163 | #ifdef HAVE_XRENDER | 163 | #ifdef HAVE_XRENDER |
164 | if (!m_transparent.get()) | ||
165 | return; | ||
166 | |||
164 | if (width() == 0 || height() == 0) | 167 | if (width() == 0 || height() == 0) |
165 | return; | 168 | return; |
166 | 169 | ||
@@ -174,9 +177,6 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u | |||
174 | the_y = 0; | 177 | the_y = 0; |
175 | } | 178 | } |
176 | 179 | ||
177 | if (!m_transparent.get()) | ||
178 | return; | ||
179 | |||
180 | // update source and destination if needed | 180 | // update source and destination if needed |
181 | Pixmap root = FbPixmap::getRootPixmap(screenNumber()); | 181 | Pixmap root = FbPixmap::getRootPixmap(screenNumber()); |
182 | if (m_transparent->source() != root) | 182 | if (m_transparent->source() != root) |
@@ -215,7 +215,13 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u | |||
215 | 215 | ||
216 | void FbWindow::setAlpha(unsigned char alpha) { | 216 | void FbWindow::setAlpha(unsigned char alpha) { |
217 | #ifdef HAVE_XRENDER | 217 | #ifdef HAVE_XRENDER |
218 | if (m_transparent.get() == 0 && alpha < 255) { | 218 | if (FbTk::Transparent::haveComposite()) { |
219 | if (m_transparent.get() != 0) | ||
220 | m_transparent.reset(0); | ||
221 | |||
222 | // don't setOpaque, let controlling objects do that | ||
223 | // since it's only needed on toplevel windows | ||
224 | } else if (m_transparent.get() == 0 && alpha < 255) { | ||
219 | m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber())); | 225 | m_transparent.reset(new Transparent(FbPixmap::getRootPixmap(screenNumber()), window(), alpha, screenNumber())); |
220 | } else if (alpha < 255 && alpha != m_transparent->alpha()) | 226 | } else if (alpha < 255 && alpha != m_transparent->alpha()) |
221 | m_transparent->setAlpha(alpha); | 227 | m_transparent->setAlpha(alpha); |
@@ -395,6 +401,14 @@ long FbWindow::eventMask() const { | |||
395 | 401 | ||
396 | } | 402 | } |
397 | 403 | ||
404 | void FbWindow::setOpaque(unsigned char alpha) { | ||
405 | #ifdef HAVE_XRENDER | ||
406 | static Atom m_alphaatom = XInternAtom(display(), "_NET_WM_WINDOW_OPACITY", False); | ||
407 | unsigned int opacity = alpha << 24; | ||
408 | changeProperty(m_alphaatom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opacity, 1l); | ||
409 | #endif // HAVE_XRENDER | ||
410 | } | ||
411 | |||
398 | void FbWindow::setBufferPixmap(Pixmap pm) { | 412 | void FbWindow::setBufferPixmap(Pixmap pm) { |
399 | m_buffer_pm = pm; | 413 | m_buffer_pm = pm; |
400 | } | 414 | } |