From 1f8f991d7c61d046783b3f541d9121f0a47bcd23 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 21 Feb 2014 13:11:53 +0200 Subject: Make the compositor redraw when a surface gets a commit(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jørgen Lind --- examples/qwidget-compositor/main.cpp | 15 +++++---------- examples/qwindow-compositor/qwindowcompositor.cpp | 9 ++++----- examples/qwindow-compositor/qwindowcompositor.h | 4 ++-- 3 files changed, 11 insertions(+), 17 deletions(-) (limited to 'examples') diff --git a/examples/qwidget-compositor/main.cpp b/examples/qwidget-compositor/main.cpp index ed1c0a3fc..7a268fbd3 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(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 f64922db5..e0f213aa4 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(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 f8d354c36..e26a09ebc 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); -- cgit v1.2.3