diff options
Diffstat (limited to 'src/platformsupport/eglconvenience/qeglplatformcursor.cpp')
-rw-r--r-- | src/platformsupport/eglconvenience/qeglplatformcursor.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp index 70e7c4e4db..e99581183e 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp @@ -69,7 +69,8 @@ QEGLPlatformCursor::QEGLPlatformCursor(QPlatformScreen *screen) m_vertexCoordEntry(0), m_textureCoordEntry(0), m_textureEntry(0), - m_deviceListener(0) + m_deviceListener(0), + m_updater(screen) { QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); if (!hideCursorVal.isEmpty()) @@ -270,12 +271,32 @@ bool QEGLPlatformCursor::setCurrentCursor(QCursor *cursor) } #endif -void QEGLPlatformCursor::update(const QRegion &rgn) +void QEGLPlatformCursorUpdater::update(const QPoint &pos, const QRegion &rgn) { - QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(m_cursor.pos), rgn); + m_active = false; + QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(pos), rgn); QWindowSystemInterface::flushWindowSystemEvents(); } +void QEGLPlatformCursorUpdater::scheduleUpdate(const QPoint &pos, const QRegion &rgn) +{ + if (m_active) + return; + + m_active = true; + + // Must not flush the window system events directly from here since we are likely to + // be a called directly from QGuiApplication's processMouseEvents. Flushing events + // could cause reentering by dispatching more queued mouse events. + QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection, + Q_ARG(QPoint, pos), Q_ARG(QRegion, rgn)); +} + +void QEGLPlatformCursor::update(const QRegion &rgn) +{ + m_updater.scheduleUpdate(m_cursor.pos, rgn); +} + QRect QEGLPlatformCursor::cursorRect() const { return QRect(m_cursor.pos - m_cursor.hotSpot, m_cursor.size); |