summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2011-02-25 11:56:28 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2011-02-25 11:56:28 (GMT)
commit2a9680ffcaf85f233323a0d41bea776a519e747a (patch)
treebc365db2d38de49c07385bbf650c9e38a8b100ac /src/plugins/platforms
parent1f50a3aa50b934a181cd0d18c260f2533ab63d43 (diff)
downloadQt-2a9680ffcaf85f233323a0d41bea776a519e747a.zip
Qt-2a9680ffcaf85f233323a0d41bea776a519e747a.tar.gz
Qt-2a9680ffcaf85f233323a0d41bea776a519e747a.tar.bz2
Avoid flicker
Don't start a new paint until we get an ack from the compositor Reviewed-by: Samuel
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/wayland/qwaylandshmsurface.cpp16
-rw-r--r--src/plugins/platforms/wayland/qwaylandshmsurface.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp
index 9bcae26..b1cba71 100644
--- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp
+++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp
@@ -95,6 +95,7 @@ QWaylandShmWindowSurface::QWaylandShmWindowSurface(QWidget *window)
: QWindowSurface(window)
, mBuffer(0)
, mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display())
+ , mWaitingForFrameSync(false)
{
}
@@ -107,6 +108,19 @@ QPaintDevice *QWaylandShmWindowSurface::paintDevice()
return mBuffer->image();
}
+void QWaylandShmWindowSurface::beginPaint(const QRegion &)
+{
+ while (mWaitingForFrameSync) {
+ mDisplay->eventDispatcher();
+ }
+}
+
+void QWaylandShmWindowSurface::frameCallback(void *data, uint32_t time)
+{
+ QWaylandShmWindowSurface *self = static_cast<QWaylandShmWindowSurface*>(data);
+ self->mWaitingForFrameSync = false;
+}
+
void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
{
Q_UNUSED(widget);
@@ -118,6 +132,8 @@ void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion &region, con
for (int i = 0; i < rects.size(); i++) {
waylandWindow->damage(rects.at(i));
}
+ mWaitingForFrameSync = true;
+ mDisplay->frameCallback(QWaylandShmWindowSurface::frameCallback, this);
}
void QWaylandShmWindowSurface::resize(const QSize &size)
diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.h b/src/plugins/platforms/wayland/qwaylandshmsurface.h
index 266b290..615d944 100644
--- a/src/plugins/platforms/wayland/qwaylandshmsurface.h
+++ b/src/plugins/platforms/wayland/qwaylandshmsurface.h
@@ -71,10 +71,14 @@ public:
QPaintDevice *paintDevice();
void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
void resize(const QSize &size);
+ void beginPaint(const QRegion &);
private:
+ static void frameCallback(void *data, uint32_t time);\
+
QWaylandShmBuffer *mBuffer;
QWaylandDisplay *mDisplay;
+ bool mWaitingForFrameSync;
};
QT_END_NAMESPACE