summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandinputdevice.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-03-22 19:05:17 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-03-22 19:05:17 +0100
commit573fbed837e2b7281c7a828cdcda141fbbcac030 (patch)
tree8535b043edd0a06c4b01f63bbfb0ae0953cff9df /src/client/qwaylandinputdevice.cpp
parent6341bf99c981aa3cfbb01589e499aa4b3f6dca21 (diff)
parent3fcb77996b3e6c076d50db9ccf9da3aefd24f159 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/compositor/compositor_api/qwaylandcompositor.h src/compositor/compositor_api/qwaylandquickcompositor.h src/compositor/compositor_api/qwaylandsurfaceitem.h src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration_p.h Change-Id: I094128be314d2c3d4fe350fa7a162e37da34ae10
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 e6d142396..44bafcba3 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>
@@ -335,9 +336,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)
@@ -347,13 +365,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: