summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-02-21 13:11:53 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 15:58:12 +0100
commit1f8f991d7c61d046783b3f541d9121f0a47bcd23 (patch)
tree6c9a27e7b6e7250127540a77befab97699ce5928
parent7ab464dca0f303460597d4ec3f03a0ecae352be5 (diff)
downloadqtwayland-1f8f991d7c61d046783b3f541d9121f0a47bcd23.tar.gz
qtwayland-1f8f991d7c61d046783b3f541d9121f0a47bcd23.tar.bz2
qtwayland-1f8f991d7c61d046783b3f541d9121f0a47bcd23.zip
Make the compositor redraw when a surface gets a commit().
It must redraw, even if it doesn't actually redraw anything, irrespective of the fact that a attach/damage has come or not. Just calling frame();commit() is perfectly valid. Change-Id: If298654b8a7cb7c954cfbad8618f23134731cb9f Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
-rw-r--r--examples/qwidget-compositor/main.cpp15
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.cpp9
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.h4
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h1
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.cpp2
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface.cpp2
6 files changed, 15 insertions, 18 deletions
diff --git a/examples/qwidget-compositor/main.cpp b/examples/qwidget-compositor/main.cpp
index ed1c0a3f..7a268fbd 100644
--- a/examples/qwidget-compositor/main.cpp
+++ b/examples/qwidget-compositor/main.cpp
@@ -110,27 +110,22 @@ private slots:
update();
}
- void surfaceDamaged(const QRegion &rect) {
+ void surfaceCommitted() {
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- surfaceDamaged(surface, rect);
+ surfaceCommitted(surface);
}
protected:
- void surfaceDamaged(QWaylandSurface *surface, const QRegion &rect)
+ void surfaceCommitted(QWaylandSurface *surface)
{
-#ifdef QT_COMPOSITOR_WAYLAND_GL
Q_UNUSED(surface);
- Q_UNUSED(rect);
update();
-#else
- update(rect.translated(surface->geometry().topLeft()));
-#endif
}
void surfaceCreated(QWaylandSurface *surface) {
connect(surface, SIGNAL(destroyed(QObject *)), this, SLOT(surfaceDestroyed(QObject *)));
connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped()));
- connect(surface, SIGNAL(damaged(const QRegion &)), this, SLOT(surfaceDamaged(const QRegion &)));
+ connect(surface, SIGNAL(committed()), this, SLOT(surfaceCommitted()));
update();
}
@@ -265,7 +260,7 @@ protected:
void raise(QWaylandSurface *surface) {
defaultInputDevice()->setKeyboardFocus(surface);
- surfaceDamaged(surface, QRect(QPoint(), surface->size()));
+ update();
m_surfaces.removeOne(surface);
m_surfaces.append(surface);
}
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp
index f64922db..e0f213aa 100644
--- a/examples/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/qwindow-compositor/qwindowcompositor.cpp
@@ -159,10 +159,10 @@ void QWindowCompositor::surfaceUnmapped()
ensureKeyboardFocusSurface(surface);
}
-void QWindowCompositor::surfaceDamaged(const QRegion &rect)
+void QWindowCompositor::surfaceCommitted()
{
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- surfaceDamaged(surface, rect);
+ surfaceCommitted(surface);
}
void QWindowCompositor::surfacePosChanged()
@@ -170,10 +170,9 @@ void QWindowCompositor::surfacePosChanged()
m_renderScheduler.start(0);
}
-void QWindowCompositor::surfaceDamaged(QWaylandSurface *surface, const QRegion &rect)
+void QWindowCompositor::surfaceCommitted(QWaylandSurface *surface)
{
Q_UNUSED(surface)
- Q_UNUSED(rect)
m_renderScheduler.start(0);
}
@@ -182,7 +181,7 @@ void QWindowCompositor::surfaceCreated(QWaylandSurface *surface)
connect(surface, SIGNAL(destroyed(QObject *)), this, SLOT(surfaceDestroyed(QObject *)));
connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped()));
connect(surface, SIGNAL(unmapped()), this, SLOT(surfaceUnmapped()));
- connect(surface, SIGNAL(damaged(const QRegion &)), this, SLOT(surfaceDamaged(const QRegion &)));
+ connect(surface, SIGNAL(committed()), this, SLOT(surfaceCommitted()));
connect(surface, SIGNAL(extendedSurfaceReady()), this, SLOT(sendExpose()));
connect(surface, SIGNAL(posChanged()), this, SLOT(surfacePosChanged()));
m_renderScheduler.start(0);
diff --git a/examples/qwindow-compositor/qwindowcompositor.h b/examples/qwindow-compositor/qwindowcompositor.h
index f8d354c3..e26a09eb 100644
--- a/examples/qwindow-compositor/qwindowcompositor.h
+++ b/examples/qwindow-compositor/qwindowcompositor.h
@@ -61,12 +61,12 @@ private slots:
void surfaceDestroyed(QObject *object);
void surfaceMapped();
void surfaceUnmapped();
- void surfaceDamaged(const QRegion &rect);
+ void surfaceCommitted();
void surfacePosChanged();
void render();
protected:
- void surfaceDamaged(QWaylandSurface *surface, const QRegion &rect);
+ void surfaceCommitted(QWaylandSurface *surface);
void surfaceCreated(QWaylandSurface *surface);
QWaylandSurface* surfaceAt(const QPointF &point, QPointF *local = 0);
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 774464a8..03ed73e0 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -187,6 +187,7 @@ signals:
void mapped();
void unmapped();
void damaged(const QRegion &rect);
+ void committed();
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void sizeChanged();
void posChanged();
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
index b87bbb61..2c2f3cce 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
@@ -147,6 +147,7 @@ void QWaylandSurfaceItem::init(QWaylandSurface *surface)
connect(surface, &QWaylandSurface::unmapped, this, &QWaylandSurfaceItem::surfaceUnmapped);
connect(surface, &QWaylandSurface::destroyed, this, &QWaylandSurfaceItem::surfaceDestroyed);
connect(surface, &QWaylandSurface::damaged, this, &QWaylandSurfaceItem::surfaceDamaged);
+ connect(surface, &QWaylandSurface::committed, this, &QQuickItem::update);
connect(surface, &QWaylandSurface::parentChanged, this, &QWaylandSurfaceItem::parentChanged);
connect(surface, &QWaylandSurface::sizeChanged, this, &QWaylandSurfaceItem::updateSize);
connect(surface, &QWaylandSurface::posChanged, this, &QWaylandSurfaceItem::updatePosition);
@@ -309,7 +310,6 @@ void QWaylandSurfaceItem::surfaceDamaged(const QRegion &)
}
}
emit textureChanged();
- update();
}
void QWaylandSurfaceItem::parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent)
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index cd532067..86f34279 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -483,6 +483,8 @@ void Surface::surface_commit(Resource *)
m_frameCallbacks << m_pendingFrameCallbacks;
m_pendingFrameCallbacks.clear();
+
+ emit m_waylandSurface->committed();
}
void Surface::frameStarted()