diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-02-10 14:28:35 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-02-10 14:30:08 (GMT) |
commit | 51b657a032cb0b9b3c4c7dbfab52c148cf9253af (patch) | |
tree | e2aad748bb7bed400758cd94ec2d7eb8bf9f679d /src/plugins/platforms/xcb/qxcbconnection.cpp | |
parent | e279d2ae598c7b05dff843e021fc8a08199c36de (diff) | |
download | Qt-51b657a032cb0b9b3c4c7dbfab52c148cf9253af.zip Qt-51b657a032cb0b9b3c4c7dbfab52c148cf9253af.tar.gz Qt-51b657a032cb0b9b3c4c7dbfab52c148cf9253af.tar.bz2 |
Added GL support to XCB backend.
We need to use a Xlib / XCB hybrid approach, as GLX depends on Xlib, and
there's no replacement for XCB.
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 2977d76..eafd83a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -49,19 +49,33 @@ #include <stdio.h> +#ifdef XCB_USE_XLIB_FOR_GLX +#include <X11/Xlib.h> +#include <X11/Xlib-xcb.h> +#endif + QXcbConnection::QXcbConnection(const char *displayName) : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) { - int primaryScreen; - + int primaryScreen = 0; + +#ifdef XCB_USE_XLIB_FOR_GLX + Display *dpy = XOpenDisplay(m_displayName.constData()); + primaryScreen = DefaultScreen(dpy); + m_connection = XGetXCBConnection(dpy); + XSetEventQueueOwner(dpy, XCBOwnsEventQueue); + m_xlib_display = dpy; +#else m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); +#endif m_setup = xcb_get_setup(xcb_connection()); xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); + int screenNumber = 0; while (it.rem) { - m_screens << new QXcbScreen(this, it.data); + m_screens << new QXcbScreen(this, it.data, screenNumber++); xcb_screen_next(&it); } @@ -77,7 +91,11 @@ QXcbConnection::~QXcbConnection() { qDeleteAll(m_screens); +#ifdef XCB_USE_XLIB_FOR_GLX + XCloseDisplay((Display *)m_xlib_display); +#else xcb_disconnect(xcb_connection()); +#endif delete m_keyboard; } |