diff --git a/src/platformsupport/fbconvenience/qfbcursor.cpp b/src/platformsupport/fbconvenience/qfbcursor.cpp index 963d315998..c727d67e72 100644 --- a/src/platformsupport/fbconvenience/qfbcursor.cpp +++ b/src/platformsupport/fbconvenience/qfbcursor.cpp @@ -81,22 +81,34 @@ QRect QFbCursor::getCurrentRect() { QRect rect = mGraphic->image()->rect().translated(-mGraphic->hotspot().x(), -mGraphic->hotspot().y()); - rect.translate(QCursor::pos()); + rect.translate(m_pos); QPoint mScreenOffset = mScreen->geometry().topLeft(); rect.translate(-mScreenOffset); // global to local translation return rect; } - -void QFbCursor::pointerEvent(const QMouseEvent & e) +QPoint QFbCursor::pos() const { - Q_UNUSED(e); - QPoint mScreenOffset = mScreen->geometry().topLeft(); + return m_pos; +} + +void QFbCursor::setPos(const QPoint &pos) +{ + QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos); + m_pos = pos; mCurrentRect = getCurrentRect(); - // global to local translation - if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreenOffset))) { + if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft()))) + setDirty(); +} + +void QFbCursor::pointerEvent(const QMouseEvent &e) +{ + if (e.type() != QEvent::MouseMove) + return; + m_pos = e.screenPos().toPoint(); + mCurrentRect = getCurrentRect(); + if (mOnScreen || mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft()))) setDirty(); - } } QRect QFbCursor::drawCursor(QPainter & painter) diff --git a/src/platformsupport/fbconvenience/qfbcursor_p.h b/src/platformsupport/fbconvenience/qfbcursor_p.h index fe3aeada4c..9c5506b455 100644 --- a/src/platformsupport/fbconvenience/qfbcursor_p.h +++ b/src/platformsupport/fbconvenience/qfbcursor_p.h @@ -81,9 +81,11 @@ public: virtual QRect drawCursor(QPainter &painter); // input methods - virtual void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE; + void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE; + QPoint pos() const Q_DECL_OVERRIDE; + void setPos(const QPoint &pos) Q_DECL_OVERRIDE; #ifndef QT_NO_CURSOR - virtual void changeCursor(QCursor *widgetCursor, QWindow *window) Q_DECL_OVERRIDE; + void changeCursor(QCursor *widgetCursor, QWindow *window) Q_DECL_OVERRIDE; #endif virtual void setDirty(); @@ -107,6 +109,7 @@ private: bool mOnScreen; QPlatformCursorImage *mGraphic; QFbCursorDeviceListener *mDeviceListener; + QPoint m_pos; }; QT_END_NAMESPACE