summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandinputdevice.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-03-29 10:26:12 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-03-29 10:26:12 +0000
commitf3913dddee41b4a2c52518e720ac1945fde3bbab (patch)
tree9254a98a96329ce10d253e049910e054e263e993 /src/client/qwaylandinputdevice.cpp
parent6942edb5a7cd58cf16bd244bfb9f1efc3b8f91c0 (diff)
parent573fbed837e2b7281c7a828cdcda141fbbcac030 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/client/qwaylandinputdevice.cpp')
-rw-r--r--src/client/qwaylandinputdevice.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 99c54238a..46c473e70 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -48,6 +48,7 @@
#include "qwaylandscreen_p.h"
#include "qwaylandcursor_p.h"
#include "qwaylanddisplay_p.h"
+#include "qwaylandshmbackingstore_p.h"
#include "../shared/qwaylandxkb.h"
#include <QtGui/private/qpixmap_raster_p.h>
@@ -337,9 +338,26 @@ void QWaylandInputDevice::setCursor(Qt::CursorShape newShape, QWaylandScreen *sc
setCursor(buffer, image);
}
+void QWaylandInputDevice::setCursor(const QCursor &cursor, QWaylandScreen *screen)
+{
+ if (cursor.shape() == Qt::BitmapCursor) {
+ setCursor(screen->waylandCursor()->cursorBitmapImage(&cursor), cursor.hotSpot());
+ return;
+ }
+ setCursor(cursor.shape(), screen);
+}
+
void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_image *image)
{
+ setCursor(buffer,
+ image ? QPoint(image->hotspot_x, image->hotspot_y) : QPoint(),
+ image ? QSize(image->width, image->height) : QSize());
+}
+
+void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotSpot, const QSize &size)
+{
if (mCaps & WL_SEAT_CAPABILITY_POINTER) {
+ mPixmapCursor.clear();
mPointer->mCursorSerial = mPointer->mEnterSerial;
/* Hide cursor */
if (!buffer)
@@ -349,13 +367,19 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, struct wl_cursor_i
}
mPointer->set_cursor(mPointer->mEnterSerial, pointerSurface,
- image->hotspot_x, image->hotspot_y);
+ hotSpot.x(), hotSpot.y());
wl_surface_attach(pointerSurface, buffer, 0, 0);
- wl_surface_damage(pointerSurface, 0, 0, image->width, image->height);
+ wl_surface_damage(pointerSurface, 0, 0, size.width(), size.height());
wl_surface_commit(pointerSurface);
}
}
+void QWaylandInputDevice::setCursor(const QSharedPointer<QWaylandBuffer> &buffer, const QPoint &hotSpot)
+{
+ setCursor(buffer->buffer(), hotSpot, buffer->size());
+ mPixmapCursor = buffer;
+}
+
class EnterEvent : public QWaylandPointerEvent
{
public: