// XXX: this is a mess! void QMultiScreenCursor::move(int x, int y) { const int oldIndex = qt_screen->subScreenIndexAt(pos); QScreenCursor::move(x, y); // updates pos const int newIndex = qt_screen->subScreenIndexAt(pos); if (!currentCursor && oldIndex != -1) setCurrentCursor(cursors.at(oldIndex)); QScreenCursor *oldCursor = currentCursor; if (oldIndex != -1) { const QScreen *oldScreen = qt_screen->subScreens().at(oldIndex); if (newIndex == -1 || oldScreen->region().contains(pos)) { oldCursor->move(x, y); return; } } if (newIndex != -1) { QScreenCursor *newCursor = cursors.at(newIndex); newCursor->set(cursor, hotspot.x(), hotspot.y()); if (oldCursor) { if (oldCursor->isVisible()) newCursor->show(); oldCursor->hide(); } newCursor->move(x, y); setCurrentCursor(newCursor); } }
void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window) { Q_UNUSED(window); const QRect oldCursorRect = cursorRect(); if (setCurrentCursor(cursor)) update(oldCursorRect | cursorRect()); }
QT_BEGIN_NAMESPACE QEglFSCursor::QEglFSCursor(QEglFSScreen *screen) : m_screen(screen), m_program(0), m_vertexCoordEntry(0), m_textureCoordEntry(0), m_textureEntry(0) { initCursorAtlas(); // initialize the cursor #ifndef QT_NO_CURSOR QCursor cursor(Qt::ArrowCursor); setCurrentCursor(&cursor); #endif }
QT_BEGIN_NAMESPACE /*! \class QEGLPlatformCursor \brief Mouse cursor implementation using OpenGL. \since 5.2 \internal \ingroup qpa */ QEGLPlatformCursor::QEGLPlatformCursor(QPlatformScreen *screen) : m_visible(true), m_screen(static_cast<QEGLPlatformScreen *>(screen)), m_program(0), m_vertexCoordEntry(0), m_textureCoordEntry(0), m_textureEntry(0), m_deviceListener(0), m_updateRequested(false) { QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); if (!hideCursorVal.isEmpty()) m_visible = hideCursorVal.toInt() == 0; if (!m_visible) return; // Try to load the cursor atlas. If this fails, m_visible is set to false and // paintOnScreen() and setCurrentCursor() become no-ops. initCursorAtlas(); // initialize the cursor #ifndef QT_NO_CURSOR QCursor cursor(Qt::ArrowCursor); setCurrentCursor(&cursor); #endif m_deviceListener = new QEGLPlatformCursorDeviceListener(this); connect(QGuiApplicationPrivate::inputDeviceManager(), &QInputDeviceManager::deviceListChanged, m_deviceListener, &QEGLPlatformCursorDeviceListener::onDeviceListChanged); updateMouseStatus(); }