diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-02-20 19:39:11 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-21 08:23:37 +0100 |
commit | cf53bf9ae6716613c120cc4a0202c69bd59eba1e (patch) | |
tree | c8d24a705913bd0c79ca51f807d0b49845cb975f | |
parent | 8c8404f8153508106f65efb43110ba85c05e73bc (diff) |
Make sure exposeEvents trigger a render pass
We needs this on non-compositing window managers to trigger
repaints on partial updates.
Change-Id: Ied5f3e854173c5e00ad7e1222aeb66eb9c96158c
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 24 |
3 files changed, 29 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 83e8d3f17a..85ef549397 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -305,8 +305,10 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) void QSGGuiThreadRenderLoop::exposureChanged(QQuickWindow *window) { - if (window->isExposed()) + if (window->isExposed()) { + m_windows[window].updatePending = true; renderWindow(window); + } } QImage QSGGuiThreadRenderLoop::grab(QQuickWindow *window) diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index eebcad72d7..fb26f543c3 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -372,6 +372,8 @@ bool QSGRenderThread::event(QEvent *e) RLDEBUG1(" Render: WM_Expose"); WMExposeEvent *se = static_cast<WMExposeEvent *>(e); + pendingUpdate |= RepaintRequest; + if (windowFor(m_windows, se->window)) { RLDEBUG1(" Render: - window already added..."); return true; diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 858653a613..b2e07e4c13 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -320,6 +320,8 @@ private slots: void showHideAnimate(); + void testExpose(); + #ifndef QT_NO_CURSOR void cursor(); #endif @@ -1375,6 +1377,28 @@ void tst_qquickwindow::showHideAnimate() QTRY_VERIFY(created->opacity() < 0.5); } +void tst_qquickwindow::testExpose() +{ + QQuickWindow window; + window.setGeometry(100, 100, 300, 200); + + window.show(); + QTRY_VERIFY(window.isExposed()); + + QSignalSpy swapSpy(&window, SIGNAL(frameSwapped())); + + // exhaust pending exposes, as some platforms send us plenty + // while showing the first time + QTest::qWait(1000); + while (swapSpy.size() != 0) { + swapSpy.clear(); + QTest::qWait(100); + } + + QWindowSystemInterface::handleExposeEvent(&window, QRegion(10, 10, 20, 20)); + QTRY_COMPARE(swapSpy.size(), 1); +} + QTEST_MAIN(tst_qquickwindow) #include "tst_qquickwindow.moc" |