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] = {};
92 Q_DISABLE_COPY(QWaylandCursorTheme)
95class Q_WAYLANDCLIENT_EXPORT QWaylandCursorShape :
public QtWayland::wp_cursor_shape_device_v1
98 QWaylandCursorShape(
struct ::wp_cursor_shape_device_v1 *object);
99 ~QWaylandCursorShape();
100 void setShape(uint32_t serial, Qt::CursorShape shape);
103 Q_DISABLE_COPY(QWaylandCursorShape)
106class Q_WAYLANDCLIENT_EXPORT QWaylandCursor :
public QPlatformCursor
109 explicit QWaylandCursor(QWaylandDisplay *display);
111 void changeCursor(QCursor *cursor, QWindow *window) override;
112 void pointerEvent(
const QMouseEvent &event) override;
113 QPoint pos()
const override;
114 void setPos(
const QPoint &pos) override;
115 void setPosFromEnterEvent(
const QPoint &pos);
117 QSize size()
const override;
119 static QSharedPointer<QWaylandBuffer> cursorBitmapBuffer(QWaylandDisplay *display,
const QCursor *cursor);
122 QWaylandDisplay *mDisplay =
nullptr;
static QtWayland::wp_cursor_shape_device_v1::shape qtCursorShapeToWaylandShape(Qt::CursorShape cursorShape)