diff --git a/src/cursorsource.cpp b/src/cursorsource.cpp index eee083236a..50dcc8fc1b 100644 --- a/src/cursorsource.cpp +++ b/src/cursorsource.cpp @@ -6,7 +6,6 @@ #include "cursorsource.h" #include "cursor.h" -#include "wayland/shmclientbuffer.h" #include "wayland/surface_interface.h" namespace KWin @@ -17,11 +16,6 @@ CursorSource::CursorSource(QObject *parent) { } -QImage CursorSource::image() const -{ - return m_image; -} - QSizeF CursorSource::size() const { return m_size; @@ -39,6 +33,11 @@ ShapeCursorSource::ShapeCursorSource(QObject *parent) connect(&m_delayTimer, &QTimer::timeout, this, &ShapeCursorSource::selectNextSprite); } +QImage ShapeCursorSource::image() const +{ + return m_image; +} + QByteArray ShapeCursorSource::shape() const { return m_shape; @@ -124,13 +123,6 @@ KWaylandServer::SurfaceInterface *SurfaceCursorSource::surface() const void SurfaceCursorSource::refresh() { - auto buffer = qobject_cast(m_surface->buffer()); - if (buffer) { - m_image = buffer->data().copy(); - m_image.setDevicePixelRatio(m_surface->bufferScale()); - } else { - m_image = QImage(); - } m_size = m_surface->size(); Q_EMIT changed(); } @@ -154,18 +146,10 @@ void SurfaceCursorSource::update(KWaylandServer::SurfaceInterface *surface, cons m_surface = surface; if (m_surface) { - auto buffer = qobject_cast(surface->buffer()); - if (buffer) { - m_image = buffer->data().copy(); - m_image.setDevicePixelRatio(surface->bufferScale()); - } else { - m_image = QImage(); - } m_size = surface->size(); connect(m_surface, &KWaylandServer::SurfaceInterface::committed, this, &SurfaceCursorSource::refresh); } else { - m_image = QImage(); m_size = QSizeF(0, 0); } } diff --git a/src/cursorsource.h b/src/cursorsource.h index 063fb6c18a..81deabd833 100644 --- a/src/cursorsource.h +++ b/src/cursorsource.h @@ -32,7 +32,6 @@ class KWIN_EXPORT CursorSource : public QObject public: explicit CursorSource(QObject *parent = nullptr); - QImage image() const; QSizeF size() const; QPointF hotspot() const; @@ -40,7 +39,6 @@ Q_SIGNALS: void changed(); protected: - QImage m_image; QSizeF m_size = QSizeF(0, 0); QPointF m_hotspot; }; @@ -55,6 +53,8 @@ class KWIN_EXPORT ShapeCursorSource : public CursorSource public: explicit ShapeCursorSource(QObject *parent = nullptr); + QImage image() const; + QByteArray shape() const; void setShape(const QByteArray &shape); void setShape(Qt::CursorShape shape); @@ -71,6 +71,7 @@ private: QByteArray m_shape; QVector m_sprites; QTimer m_delayTimer; + QImage m_image; int m_currentSprite = -1; };