From 15d84435d0b41b866da77367e41ebc523409ce95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 11 Apr 2011 12:37:36 +0200 Subject: Wayland: compile fix after making the event handling single threaded --- .../qwaylandxcompositeglxcontext.cpp | 24 ++++++++++++++-------- .../xcomposite_glx/qwaylandxcompositeglxcontext.h | 3 ++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp index c108fbd..caf5117 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp @@ -56,6 +56,7 @@ QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(QWaylandXCompositeGLX , mBuffer(0) , mXWindow(0) , mConfig(qglx_findConfig(glxIntegration->xDisplay(),glxIntegration->screen(),window->widget()->platformWindowFormat())) + , mWaitingForSyncCallback(false) { XVisualInfo *visualInfo = glXGetVisualFromFBConfig(glxIntegration->xDisplay(),mConfig); mContext = glXCreateContext(glxIntegration->xDisplay(),visualInfo,0,TRUE); @@ -97,7 +98,20 @@ QPlatformWindowFormat QWaylandXCompositeGLXContext::platformWindowFormat() const void QWaylandXCompositeGLXContext::sync_function(void *data) { QWaylandXCompositeGLXContext *that = static_cast(data); - that->mWaitCondition.wakeAll(); + that->mWaitingForSyncCallback = false; +} + +void QWaylandXCompositeGLXContext::waitForSync() +{ + wl_display_sync_callback(mGlxIntegration->waylandDisplay()->wl_display(), + QWaylandXCompositeGLXContext::sync_function, + this); + mWaitingForSyncCallback = true; + wl_display_sync(mGlxIntegration->waylandDisplay()->wl_display(),0); + mGlxIntegration->waylandDisplay()->flushRequests(); + while (mWaitingForSyncCallback) { + mGlxIntegration->waylandDisplay()->readEvents(); + } } void QWaylandXCompositeGLXContext::geometryChanged() @@ -132,11 +146,5 @@ void QWaylandXCompositeGLXContext::geometryChanged() size, mGlxIntegration->waylandDisplay()->argbVisual()); mWindow->attach(mBuffer); - wl_display_sync_callback(mGlxIntegration->waylandDisplay()->wl_display(), - QWaylandXCompositeGLXContext::sync_function, - this); - QMutex lock; - lock.lock(); - wl_display_sync(mGlxIntegration->waylandDisplay()->wl_display(),0); - mWaitCondition.wait(&lock); + waitForSync(); } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h index b45ec3f..eb2e5a5 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h @@ -78,7 +78,8 @@ private: GLXContext mContext; static void sync_function(void *data); - QWaitCondition mWaitCondition; + void waitForSync(); + bool mWaitingForSyncCallback; }; #endif // QWAYLANDXCOMPOSITEGLXCONTEXT_H -- cgit v0.12