@ -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 < KWaylandServer : : ShmClientBuffer * > ( 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 < KWaylandServer : : ShmClientBuffer * > ( 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 ) ;
}
}