diff --git a/autotests/client/test_wayland_surface.cpp b/autotests/client/test_wayland_surface.cpp --- a/autotests/client/test_wayland_surface.cpp +++ b/autotests/client/test_wayland_surface.cpp @@ -271,6 +271,7 @@ QVERIFY(serverSurface->parentResource()); QVERIFY(!serverSurface->isMapped()); + QSignalSpy committedSpy(serverSurface, SIGNAL(committed())); QSignalSpy damageSpy(serverSurface, SIGNAL(damaged(QRegion))); QVERIFY(damageSpy.isValid()); @@ -282,6 +283,7 @@ QCoreApplication::processEvents(); QVERIFY(damageSpy.isEmpty()); QVERIFY(!serverSurface->isMapped()); + QCOMPARE(committedSpy.count(), 1); QImage img(QSize(10, 10), QImage::Format_ARGB32_Premultiplied); img.fill(Qt::black); @@ -293,6 +295,7 @@ QCOMPARE(serverSurface->damage(), QRegion(0, 0, 10, 10)); QCOMPARE(damageSpy.first().first().value(), QRegion(0, 0, 10, 10)); QVERIFY(serverSurface->isMapped()); + QCOMPARE(committedSpy.count(), 2); // damage multiple times QRegion testRegion(5, 8, 3, 6); @@ -308,6 +311,7 @@ QCOMPARE(serverSurface->damage(), testRegion); QCOMPARE(damageSpy.first().first().value(), testRegion); QVERIFY(serverSurface->isMapped()); + QCOMPARE(committedSpy.count(), 3); } void TestWaylandSurface::testFrameCallback() diff --git a/src/server/surface_interface.h b/src/server/surface_interface.h --- a/src/server/surface_interface.h +++ b/src/server/surface_interface.h @@ -354,6 +354,15 @@ **/ void inhibitsIdleChanged(); + /** + * Emitted when the Surface has been committed. + * + * This signal is emitted after all the relevant damage and xyzChanged signals + * for this commit are emitted. + * @since 5.54 + **/ + void committed(); + private: friend class CompositorInterface; friend class SubSurfaceInterface; diff --git a/src/server/surface_interface.cpp b/src/server/surface_interface.cpp --- a/src/server/surface_interface.cpp +++ b/src/server/surface_interface.cpp @@ -487,6 +487,7 @@ void SurfaceInterface::Private::commit() { + Q_Q(SurfaceInterface); if (!subSurface.isNull() && subSurface->isSynchronized()) { swapStates(&pending, &subSurfacePending, false); } else { @@ -504,6 +505,7 @@ subSurface->d_func()->commit(); } } + emit q->committed(); } void SurfaceInterface::Private::commitSubSurface()