summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/egl/qegl_x11.cpp5
-rw-r--r--src/opengl/qgl_x11egl.cpp18
2 files changed, 18 insertions, 5 deletions
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 2c0bbd3..49c8d60 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -116,6 +116,7 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
setVisualFormat(qt_x11Info(dev));
}
+//#define QT_DEBUG_X11_VISUAL_SELECTION 1
VisualID QEgl::getCompatibleVisualId(EGLConfig config)
{
@@ -174,7 +175,7 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
if (visualId) {
#ifdef QT_DEBUG_X11_VISUAL_SELECTION
- if (configHasAlpha)
+ if (configAlphaSize > 0)
qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, (int)config);
else
qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, (int)config);
@@ -219,7 +220,7 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
}
if (visualId) {
# ifdef QT_DEBUG_X11_VISUAL_SELECTION
- if (configHasAlpha)
+ if (configAlphaSize > 0)
qDebug("Using ARGB Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config);
else
qDebug("Using Opaque Visual ID %d provided by XRender for EGL config %d", (int)visualId, (int)config);
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 972a5f6..b8da156 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -282,6 +282,7 @@ void QGLWidget::updateOverlayGL()
}
//#define QT_DEBUG_X11_VISUAL_SELECTION 1
+//#undef QT_DEBUG_X11_VISUAL_SELECTION
bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, const QX11Info &x11Info, bool useArgbVisual)
{
@@ -471,10 +472,21 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext,
if (visible)
hide();
- XVisualInfo vi;
QEglContext *eglContext = d->glcx->d_func()->eglContext;
- bool usingArgbVisual = qt_egl_setup_x11_visual(vi, eglContext->display(), eglContext->config(),
- x11Info(), tryArgbVisual);
+
+ XVisualInfo vi;
+ memset(&vi, 0, sizeof(XVisualInfo));
+ vi.visualid = QEgl::getCompatibleVisualId(eglContext->config());
+
+ {
+ XVisualInfo *visualInfoPtr;
+ int matchingCount = 0;
+ visualInfoPtr = XGetVisualInfo(X11->display, VisualIDMask, &vi, &matchingCount);
+ vi = *visualInfoPtr;
+ XFree(visualInfoPtr);
+ }
+
+ bool usingArgbVisual = eglContext->configAttrib(EGL_ALPHA_SIZE) > 0;
XSetWindowAttributes a;