5#ifndef QWAYLANDCURSOR_H
6#define QWAYLANDCURSOR_H
19#include <qpa/qplatformcursor.h>
21#include <QtWaylandClient/qtwaylandclientglobal.h>
22#include <QtWaylandClient/private/qwayland-cursor-shape-v1.h>
23#include <QtCore/private/qglobal_p.h>
30struct wl_cursor_image;
31struct wl_cursor_theme;
35namespace QtWaylandClient {
42class Q_WAYLANDCLIENT_EXPORT QWaylandCursorTheme
45 static std::unique_ptr<QWaylandCursorTheme> create(QWaylandShm *shm,
int size,
const QString &themeName);
46 ~QWaylandCursorTheme();
47 ::wl_cursor *cursor(Qt::CursorShape shape);
51 ArrowCursor = Qt::ArrowCursor,
74 ResizeNorthCursor = Qt::CustomCursor + 1,
78 ResizeNorthWestCursor,
79 ResizeSouthEastCursor,
80 ResizeNorthEastCursor,
81 ResizeSouthWestCursor,
86 explicit QWaylandCursorTheme(
struct ::wl_cursor_theme *theme) : m_theme(theme) {}
87 struct ::wl_cursor *requestCursor(WaylandCursor shape);
88 struct ::wl_cursor_theme *m_theme =
nullptr;
89 wl_cursor *m_cursors[NumWaylandCursors] = {};
92class Q_WAYLANDCLIENT_EXPORT QWaylandCursorShape :
public QtWayland::wp_cursor_shape_device_v1
95 QWaylandCursorShape(
struct ::wp_cursor_shape_device_v1 *object);
96 ~QWaylandCursorShape();
97 void setShape(uint32_t serial, Qt::CursorShape shape);
100class Q_WAYLANDCLIENT_EXPORT QWaylandCursor :
public QPlatformCursor
103 explicit QWaylandCursor(QWaylandDisplay *display);
105 void changeCursor(QCursor *cursor, QWindow *window) override;
106 void pointerEvent(
const QMouseEvent &event) override;
107 QPoint pos()
const override;
108 void setPos(
const QPoint &pos) override;
109 void setPosFromEnterEvent(
const QPoint &pos);
111 QSize size()
const override;
113 static QSharedPointer<QWaylandBuffer> cursorBitmapBuffer(QWaylandDisplay *display,
const QCursor *cursor);
116 QWaylandDisplay *mDisplay =
nullptr;
static QtWayland::wp_cursor_shape_device_v1::shape qtCursorShapeToWaylandShape(Qt::CursorShape cursorShape)