Debian Codegraph @

wayland/qtwayland-dev/5.11.3/QtWaylandClient/private/qwaylandcursor_p.h

raw symbols SCIP
1 // Copyright (C) 2019 The Qt Company Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5 #ifndef QWAYLANDCURSOR_H
6 #define QWAYLANDCURSOR_H
7
8 //
9 // W A R N I N G
10 // -------------
11 //
12 // This file is not part of the Qt API. It exists purely as an
13 // implementation detail. This header file may change from version to
14 // version without notice, or even be removed.
15 //
16 // We mean it.
17 //
18
19 #include <qpa/qplatformcursor.h>
20 #include <QtCore/QMap>
21 #include <QtWaylandClient/qtwaylandclientglobal.h>
22
23 #if QT_CONFIG(cursor)
24
25 struct wl_cursor;
26 struct wl_cursor_image;
27 struct wl_cursor_theme;
28
29 QT_BEGIN_NAMESPACE
30
31 namespace QtWaylandClient {
32
33 class QWaylandBuffer;
34 class QWaylandDisplay;
35 class QWaylandScreen;
36 class QWaylandShm;
37
38 class Q_WAYLAND_CLIENT_EXPORT QWaylandCursorTheme
39 {
40 public:
41 static QWaylandCursorTheme *create(QWaylandShm *shm, int size);
42 static QWaylandCursorTheme *create(QWaylandShm *shm, int size, const QString &themeName);
43 ~QWaylandCursorTheme();
44 struct wl_cursor_image *cursorImage(Qt::CursorShape shape);
45
46 private:
47 enum WaylandCursor {
48 ArrowCursor = Qt::ArrowCursor,
49 UpArrowCursor,
50 CrossCursor,
51 WaitCursor,
52 IBeamCursor,
53 SizeVerCursor,
54 SizeHorCursor,
55 SizeBDiagCursor,
56 SizeFDiagCursor,
57 SizeAllCursor,
58 BlankCursor,
59 SplitVCursor,
60 SplitHCursor,
61 PointingHandCursor,
62 ForbiddenCursor,
63 WhatsThisCursor,
64 BusyCursor,
65 OpenHandCursor,
66 ClosedHandCursor,
67 DragCopyCursor,
68 DragMoveCursor,
69 DragLinkCursor,
70 // The following are used for cursors that don't have equivalents in Qt
71 ResizeNorthCursor = Qt::CustomCursor + 1,
72 ResizeSouthCursor,
73 ResizeEastCursor,
74 ResizeWestCursor,
75 ResizeNorthWestCursor,
76 ResizeSouthEastCursor,
77 ResizeNorthEastCursor,
78 ResizeSouthWestCursor
79 };
80
81 explicit QWaylandCursorTheme(struct ::wl_cursor_theme *theme) : m_theme(theme) {}
82 struct ::wl_cursor *requestCursor(WaylandCursor shape);
83 struct ::wl_cursor_theme *m_theme = nullptr;
84 QMap<WaylandCursor, wl_cursor *> m_cursors;
85 };
86
87 class Q_WAYLAND_CLIENT_EXPORT QWaylandCursor : public QPlatformCursor
88 {
89 public:
90 QWaylandCursor(QWaylandScreen *screen);
91
92 void changeCursor(QCursor *cursor, QWindow *window) override;
93 void pointerEvent(const QMouseEvent &event) override;
94 QPoint pos() const override;
95 void setPos(const QPoint &pos) override;
96
97 QSharedPointer<QWaylandBuffer> cursorBitmapImage(const QCursor *cursor);
98 struct wl_cursor_image *cursorImage(Qt::CursorShape shape);
99
100 private:
101 QWaylandDisplay *mDisplay = nullptr;
102 QWaylandCursorTheme *mCursorTheme = nullptr;
103 QPoint mLastPos;
104 };
105
106 }
107
108 QT_END_NAMESPACE
109
110 #endif // cursor
111 #endif // QWAYLANDCURSOR_H