Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwaylandcursor_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWAYLANDCURSOR_H
5#define QWAYLANDCURSOR_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qpa/qplatformcursor.h>
19#include <QtCore/QMap>
20#include <QtWaylandClient/qtwaylandclientglobal.h>
21#include <QtWaylandClient/private/qwayland-cursor-shape-v1.h>
22#include <QtCore/private/qglobal_p.h>
23
24#if QT_CONFIG(cursor)
25
26#include <memory>
27
28struct wl_cursor;
29struct wl_cursor_image;
30struct wl_cursor_theme;
31
33
34namespace QtWaylandClient {
35
36class QWaylandBuffer;
37class QWaylandDisplay;
38class QWaylandScreen;
39class QWaylandShm;
40
41class Q_WAYLANDCLIENT_EXPORT QWaylandCursorTheme
42{
43public:
44 static std::unique_ptr<QWaylandCursorTheme> create(QWaylandShm *shm, int size, const QString &themeName);
45 ~QWaylandCursorTheme();
46 ::wl_cursor *cursor(Qt::CursorShape shape);
47
48protected:
49 enum WaylandCursor {
72 // The following are used for cursors that don't have equivalents in Qt
73 ResizeNorthCursor = Qt::CustomCursor + 1,
74 ResizeSouthCursor,
75 ResizeEastCursor,
76 ResizeWestCursor,
77 ResizeNorthWestCursor,
78 ResizeSouthEastCursor,
79 ResizeNorthEastCursor,
80 ResizeSouthWestCursor,
81
82 NumWaylandCursors
83 };
84
85 explicit QWaylandCursorTheme(struct ::wl_cursor_theme *theme) : m_theme(theme) {}
86 struct ::wl_cursor *requestCursor(WaylandCursor shape);
87 struct ::wl_cursor_theme *m_theme = nullptr;
88 wl_cursor *m_cursors[NumWaylandCursors] = {};
89};
90
91class Q_WAYLANDCLIENT_EXPORT QWaylandCursorShape : public QtWayland::wp_cursor_shape_device_v1
92{
93public:
94 QWaylandCursorShape(struct ::wp_cursor_shape_device_v1 *object);
95 ~QWaylandCursorShape();
96 void setShape(uint32_t serial, Qt::CursorShape shape);
97};
98
99class Q_WAYLANDCLIENT_EXPORT QWaylandCursor : public QPlatformCursor
100{
101public:
102 explicit QWaylandCursor(QWaylandDisplay *display);
103
104 void changeCursor(QCursor *cursor, QWindow *window) override;
105 void pointerEvent(const QMouseEvent &event) override;
106 QPoint pos() const override;
107 void setPos(const QPoint &pos) override;
108
109 QSize size() const override;
110
111 static QSharedPointer<QWaylandBuffer> cursorBitmapBuffer(QWaylandDisplay *display, const QCursor *cursor);
112
113protected:
114 QWaylandDisplay *mDisplay = nullptr;
115 QPoint mLastPos;
116};
117
118}
119
121
122#endif // cursor
123#endif // QWAYLANDCURSOR_H
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:45
\inmodule QtGui
Definition qevent.h:196
The QPlatformCursor class provides information about pointer device events (movement,...
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtGui
Definition qwindow.h:63
QCursor cursor
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
CursorShape
@ BlankCursor
@ CrossCursor
@ DragCopyCursor
@ PointingHandCursor
@ SizeHorCursor
@ SizeAllCursor
@ CustomCursor
@ WaitCursor
@ SizeVerCursor
@ DragLinkCursor
@ OpenHandCursor
@ SizeFDiagCursor
@ WhatsThisCursor
@ ArrowCursor
@ SplitVCursor
@ UpArrowCursor
@ ClosedHandCursor
@ DragMoveCursor
@ IBeamCursor
@ SizeBDiagCursor
@ ForbiddenCursor
@ BusyCursor
@ SplitHCursor
static QString themeName()
GLenum GLuint GLintptr GLsizeiptr size
[1]
struct _cl_event * event
rect setPos(100, 100)
aWidget window() -> setWindowTitle("New Window Title")
[2]
view create()