diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2011-04-11 10:37:36 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-04-11 11:59:00 (GMT) |
commit | 15d84435d0b41b866da77367e41ebc523409ce95 (patch) | |
tree | 65fd49f2490831f024499ef5b93a2fdbd9ab7f28 /src/plugins | |
parent | f067aa05c030fd02d46f10ab2023059978b4f816 (diff) | |
download | Qt-15d84435d0b41b866da77367e41ebc523409ce95.zip Qt-15d84435d0b41b866da77367e41ebc523409ce95.tar.gz Qt-15d84435d0b41b866da77367e41ebc523409ce95.tar.bz2 |
Wayland: compile fix after making the event handling
single threaded
Diffstat (limited to 'src/plugins')
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<QWaylandXCompositeGLXContext *>(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 |