diff options
author | Louai Al-Khanji <louai.al-khanji@qt.io> | 2017-01-06 15:15:54 -0800 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-04-21 10:56:02 +0000 |
commit | 07942adb77f60738a6043665673d51fc7991233b (patch) | |
tree | 6a94958d0b02d7b2149fa00b1047297370737831 /src/plugins/platforms/xcb/qxcbconnection.cpp | |
parent | 7be9653f1288d32bc732262b01ba910f6a321ecd (diff) |
xcb: Add experimental legacy support for native X11 painting
This commit revives the old native QPixmap and QPaintEngine
implementations that were present in Qt4. The backing store supports
regular raster windows in this commit. Support for render-to-texture
widgets and OpenGL compositing will be added in a follow-up commit.
Change-Id: I80a9c4f0c42a6f68f571dfee930d95000d5dd950
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index c2e4edf2d5..58799793ae 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -148,8 +148,18 @@ static const char * const xcbConnectionErrors[] = { "Error during FD passing" /* XCB_CONN_CLOSED_FDPASSING_FAILED */ }; -static int nullErrorHandler(Display *, XErrorEvent *) +static int nullErrorHandler(Display *dpy, XErrorEvent *err) { +#ifndef Q_XCB_DEBUG + Q_UNUSED(dpy); + Q_UNUSED(err); +#else + const int buflen = 1024; + char buf[buflen]; + + XGetErrorText(dpy, err->error_code, buf, buflen); + fprintf(stderr, "X Error: serial %lu error %d %s\n", err->serial, (int) err->error_code, buf); +#endif return 0; } @@ -528,6 +538,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , m_defaultVisualId(defaultVisualId) , m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) , m_nativeInterface(nativeInterface) + , has_render_extension(false) { #ifdef XCB_USE_XLIB Display *dpy = XOpenDisplay(m_displayName.constData()); @@ -1980,11 +1991,14 @@ void QXcbConnection::initializeXRender() if (!reply || !reply->present) return; + has_render_extension = true; auto xrender_query = Q_XCB_REPLY(xcb_render_query_version, m_connection, XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION); - if (!xrender_query || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) + if (!xrender_query || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) { qWarning("QXcbConnection: Failed to initialize XRender"); + has_render_extension = false; + } #endif } |