Fix OpenGL on Harmattan showing only the first frame.

swapBuffers would wait until DRI2_InvalidateBuffers was received from the
X server, but would never receive it since we are not running the xlib event loop.

This patch calls the XESetWireToEvent xlib callback of an unhandled event from the
xcb event loop directly, if one is available for its response type.

Change-Id: I3b4ef3f6e3efbae25f49f161e229e9b15e951778
Reviewed-on: http://codereview.qt-project.org/6557
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Jocelyn Turcotte 2011-10-12 11:53:01 +02:00 committed by Qt by Nokia
parent 472028c1d4
commit bb22b49650

View File

@ -62,6 +62,7 @@
#ifdef XCB_USE_XLIB #ifdef XCB_USE_XLIB
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xlib-xcb.h> #include <X11/Xlib-xcb.h>
#include <X11/Xlibint.h>
#endif #endif
#ifdef XCB_USE_RENDER #ifdef XCB_USE_RENDER
@ -542,6 +543,19 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
} }
} }
#ifdef XCB_USE_XLIB
if (!handled) {
// Check if a custom XEvent constructor was registered in xlib for this event type, and call it discarding the constructed XEvent if any.
// XESetWireToEvent might be used by libraries to intercept messages from the X server e.g. the OpenGL lib waiting for DRI2 events.
Bool (*proc)(Display*, XEvent*, xEvent*) = XESetWireToEvent((Display*)m_xlib_display, response_type, 0);
if (proc) {
XESetWireToEvent((Display*)m_xlib_display, response_type, proc);
XEvent dummy;
proc((Display*)m_xlib_display, &dummy, (xEvent*)event);
}
}
#endif
if (handled) if (handled)
printXcbEvent("Handled XCB event", event); printXcbEvent("Handled XCB event", event);
else else