diff options
author | Gunnar Sletta <gunnar@sletta.org> | 2014-09-30 13:21:13 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar@sletta.org> | 2014-10-09 10:59:40 +0200 |
commit | b3d2c867ed14cd6337d5e32b8750f198b5b7d331 (patch) | |
tree | 3be94109ebe2d6cfbd24a70dfaf88e97cb092af2 /src/gui/kernel/qplatformwindow.cpp | |
parent | 264fcd4eefef34cd764ac8be99feb3b31bc03004 (diff) |
Introducing QWindow::requestUpdate().
Change-Id: I0e2a09b53459a56d90dcd9043e694b19e2d77a9e
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index bd5e21c485..976d89b30a 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -593,6 +593,36 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, } /*! + Requests an QEvent::UpdateRequest event. The event will be + delivered to the QWindow. + + QPlatformWindow subclasses can re-implement this function to + provide display refresh synchronized updates. The event + should be delivered using QWindowPrivate::deliverUpdateRequest() + to not get out of sync with the the internal state of QWindow. + + The default implementation posts an UpdateRequest event to the + window after 5 ms. The additional time is there to give the event + loop a bit of idle time to gather system events. + +*/ +void QPlatformWindow::requestUpdate() +{ + static int timeout = -1; + if (timeout == -1) { + bool ok = false; + timeout = qEnvironmentVariableIntValue("QT_QPA_UPDATE_IDLE_TIME", &ok); + if (!ok) + timeout = 5; + } + + QWindow *w = window(); + QWindowPrivate *wp = (QWindowPrivate *) QObjectPrivate::get(w); + Q_ASSERT(wp->updateTimer == 0); + wp->updateTimer = w->startTimer(timeout, Qt::PreciseTimer); +} + +/*! \class QPlatformWindow \since 4.8 \internal |