diff options
Diffstat (limited to 'src/plugins/platforms/directfb/qdirectfbcursor.cpp')
-rw-r--r-- | src/plugins/platforms/directfb/qdirectfbcursor.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp new file mode 100644 index 0000000..f2c9f35 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -0,0 +1,39 @@ +#include "qdirectfbcursor.h" +#include "qdirectfbconvenience.h" + + +QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) : + QPlatformCursor(screen), surface(0) +{ + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); + image = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); +} + +void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) +{ + Q_UNUSED(widget); + int xSpot; + int ySpot; + QPixmap map; + + if (cursor->shape() != Qt::BitmapCursor) { + image->set(cursor->shape()); + xSpot = image->hotspot().x(); + ySpot = image->hotspot().y(); + QImage *i = image->image(); + map = QPixmap::fromImage(*i); + } else { + QPoint point = cursor->hotSpot(); + xSpot = point.x(); + ySpot = point.y(); + map = cursor->pixmap(); + } + + IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); + + if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { + return; + } + m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); + m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); +} |