diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-05-28 08:42:20 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-05-28 11:18:45 (GMT) |
commit | 54aaf1f72e11ba4d7e38bbde127a4630aa27df23 (patch) | |
tree | 5f450c082be87bcb32c2f9d6ddca6928db99c710 /src/opengl | |
parent | 7ff70350f485f815bbcb2412631b636485ebe37d (diff) | |
download | Qt-54aaf1f72e11ba4d7e38bbde127a4630aa27df23.zip Qt-54aaf1f72e11ba4d7e38bbde127a4630aa27df23.tar.gz Qt-54aaf1f72e11ba4d7e38bbde127a4630aa27df23.tar.bz2 |
Make WA_TranslucentBackground work for QGLWidgets on X11/EGL
Reviewed-By: TrustMe
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 514e763..3c745b8 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -243,13 +243,24 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, return; } - - // Create the EGL Context (which will also choose the config for us) if (d->glcx) d->glcx->doneCurrent(); QGLContext* oldcx = d->glcx; d->glcx = context; + if (parentWidget()) { + // force creation of delay-created widgets + parentWidget()->winId(); + if (parentWidget()->x11Info().screen() != x11Info().screen()) + d_func()->xinfo = parentWidget()->d_func()->xinfo; + } + + // If the application has set WA_TranslucentBackground and not explicitly set + // the alpha buffer size to zero, modify the format so it have an alpha channel + QGLFormat& fmt = d->glcx->d_func()->glFormat; + if (testAttribute(Qt::WA_TranslucentBackground) && fmt.alphaBufferSize() == -1) + fmt.setAlphaBufferSize(1); + bool createFailed = false; if (!d->glcx->isValid()) { if (!d->glcx->create(shareContext ? shareContext : oldcx)) @@ -267,15 +278,6 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, return; } - - - // Make sure native winIds are avaliable - if (parentWidget()) { - parentWidget()->winId(); - if (parentWidget()->x11Info().screen() != x11Info().screen()) - d_func()->xinfo = parentWidget()->d_func()->xinfo; - } - bool visible = isVisible(); if (visible) hide(); @@ -384,6 +386,7 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, a.colormap = XCreateColormap(x11Info().display(), p, vi.visual, AllocNone); valueMask |= CWColormap; } + Window w = XCreateWindow(x11Info().display(), p, x(), y(), width(), height(), 0, vi.depth, InputOutput, vi.visual, valueMask, &a); @@ -406,6 +409,7 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, if (visible) show(); + XFlush(X11->display); d->glcx->setWindowCreated(true); } |