Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandtabletv2_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// Qt-Security score:significant reason:default
4
5#ifndef QWAYLANDTABLETV2_P_H
6#define QWAYLANDTABLETV2_P_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 <QtWaylandClient/private/qwayland-tablet-unstable-v2.h>
20
21#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
22
23#include <QtCore/QObject>
24#include <QtCore/QPointer>
25#include <QtCore/QPointF>
26#include <QtCore/QTimer>
27#include <QtGui/QPointingDevice>
28#include <QtGui/QInputDevice>
29
30#include <memory>
31
32QT_BEGIN_NAMESPACE
33
34namespace QtWaylandClient {
35
36class QWaylandDisplay;
37class QWaylandInputDevice;
38class QWaylandSurface;
39
40class QWaylandTabletSeatV2;
41class QWaylandTabletV2;
42class QWaylandTabletToolV2;
43class QWaylandTabletPadV2;
44
45#if QT_CONFIG(cursor)
48template <typename T>
49class CursorSurface;
50#endif
51
61
88
89class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public QtWayland::zwp_tablet_v2
90{
92public:
93 explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatName, QObject *parent = nullptr);
95
96protected:
97 // callbacks which act as setters
103
104private:
106};
107
108class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, public QtWayland::zwp_tablet_tool_v2
109{
111public:
114
116
117protected:
134// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override;
137
138private:
140
141#if QT_CONFIG(cursor)
142 int idealCursorScale() const;
143 void updateCursorTheme();
144 void cursorTimerCallback();
145 void cursorFrameCallback();
147#endif
148
150
151 // Static state (sent before done event)
155 bool m_hasRotation = false;
156 quint64 m_uid = 0;
157
159#if QT_CONFIG(cursor)
160 struct
161 {
163 QWaylandCursorTheme *theme = nullptr;
164 int themeBufferScale = 0;
167 bool gotFrameCallback = false;
168 bool gotTimerCallback = false;
169 } mCursor;
170#endif
171
172 // Accumulated state (applied on frame event)
173 struct State {
174 bool down = false;
176 bool enteredSurface = false; // Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event
178 uint distance = 0;
179 qreal pressure = 0;
180 qreal rotation = 0;
181 qreal xTilt = 0;
182 qreal yTilt = 0;
183 qreal slider = 0;
184 Qt::MouseButtons buttons = Qt::MouseButton::NoButton; // Actual buttons, down state -> left mouse is mapped inside the frame handler
185 //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20
186 bool operator==(const State &o) const;
188
189 template <typename T>
190 friend class CursorSurface;
191};
192
193class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, public QtWayland::zwp_tablet_pad_v2
194{
196public:
197 explicit QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad, QObject *parent = nullptr);
199
200protected:
205// void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override;
206// void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
207// void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
209
210private:
212};
213
214} // namespace QtWaylandClient
215
216QT_END_NAMESPACE
217
218#endif // QWAYLANDTABLETV2_P_H
static Qt::MouseButton mouseButtonFromTablet(uint button)