summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qglxintegration.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-02-20 14:00:52 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-23 01:34:25 +0100
commitf2b26af2b4db25aeb74279a40365b76f0406a018 (patch)
treed45e7dc1c84e096413e164a5d366008e246caaac /src/plugins/platforms/xcb/qglxintegration.cpp
parent7e5750101699a408356439126649e8f49010d1df (diff)
Enforce OpenGL context creation under XCB
We don't support other context types, so fail in those cases. Also, return OpenGL as the rendereable type of our surface. Change-Id: Ic7b5ed0ec5eaf5c0f88f50f5bceb697ea414c696 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qglxintegration.cpp')
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 854f7bcd17..db942fc3ad 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -270,14 +270,19 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
: QPlatformOpenGLContext()
, m_screen(screen)
, m_context(0)
+ , m_shareContext(0)
, m_format(format)
, m_isPBufferCurrent(false)
{
- m_shareContext = 0;
+ if (m_format.renderableType() == QSurfaceFormat::DefaultRenderableType)
+ m_format.setRenderableType(QSurfaceFormat::OpenGL);
+ if (m_format.renderableType() != QSurfaceFormat::OpenGL)
+ return;
+
if (share)
m_shareContext = static_cast<const QGLXContext*>(share)->glxContext();
- GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),format);
+ GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),m_format);
XVisualInfo *visualInfo = 0;
Window window = 0; // Temporary window used to query OpenGL context
@@ -297,7 +302,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
// context format that that which was requested and is supported by the driver
const int maxSupportedVersion = (defaultContextInfo->format.majorVersion() << 8)
+ defaultContextInfo->format.minorVersion();
- const int requestedVersion = qMin((format.majorVersion() << 8) + format.minorVersion(),
+ const int requestedVersion = qMin((m_format.majorVersion() << 8) + m_format.minorVersion(),
maxSupportedVersion);
const int majorVersion = requestedVersion >> 8;
const int minorVersion = requestedVersion & 0xFF;