diff options
author | Samuel Rødal <samuel.rodal@digia.com> | 2012-10-01 10:17:21 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-19 18:11:06 +0200 |
commit | cdc2161b6f87deaac6a256885fd6ecdccad6eb82 (patch) | |
tree | 3d2cd1a20e2b4a0b7e871c6ab78b4fa2bcaf9195 /src/plugins/platforms/xcb/qxcbconnection.cpp | |
parent | 7d7f09650c3b3b2990f16ff4a6401a8c74e1f868 (diff) |
Made xcb plugin work when the GLX extension is not present.
Change-Id: I9285d7524586ff404206c088019ece33335137d9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index ad9fb1d19c..bb5f301fea 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -72,6 +72,10 @@ #include <xcb/render.h> #endif +#if defined(XCB_HAS_XCB_GLX) +#include <xcb/glx.h> +#endif + #ifdef XCB_USE_EGL //don't pull in eglext prototypes #include <EGL/egl.h> #endif @@ -263,6 +267,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char #endif , xfixes_first_event(0) , xrandr_first_event(0) + , has_glx_extension(false) , has_shape_extension(false) , has_randr_extension(false) , has_input_shape(false) @@ -320,6 +325,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY, m_screens.at(0)->screen()->root_visual, 0, 0); + initializeGLX(); initializeXFixes(); initializeXRender(); m_xi2Enabled = false; @@ -1312,6 +1318,33 @@ void QXcbConnection::initializeXRender() #endif } +void QXcbConnection::initializeGLX() +{ +#ifdef XCB_HAS_XCB_GLX + const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_glx_id); + if (!reply || !reply->present) + return; + + has_glx_extension = true; + + xcb_generic_error_t *error = 0; + xcb_glx_query_version_cookie_t xglx_query_cookie = xcb_glx_query_version(m_connection, + XCB_GLX_MAJOR_VERSION, + XCB_GLX_MINOR_VERSION); + xcb_glx_query_version_reply_t *xglx_query = xcb_glx_query_version_reply(m_connection, + xglx_query_cookie, &error); + if (!xglx_query || error) { + qWarning("QXcbConnection: Failed to initialize GLX"); + free(error); + has_glx_extension = false; + } + free(xglx_query); +#else + // no way to check, assume GLX is present + has_glx_extension = true; +#endif +} + void QXcbConnection::initializeXRandr() { const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_randr_id); |