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
58
83
84class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public QtWayland::zwp_tablet_v2
85{
87public:
90
91protected:
92 // callbacks which act as setters
98};
99
100class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, public QtWayland::zwp_tablet_tool_v2
101{
103public:
106
108
109protected:
126// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override;
129
130private:
131#if QT_CONFIG(cursor)
132 int idealCursorScale() const;
133 void updateCursorTheme();
134 void cursorTimerCallback();
135 void cursorFrameCallback();
137#endif
138
140
141 // Static state (sent before done event)
145 bool m_hasRotation = false;
146 quint64 m_uid = 0;
147
149#if QT_CONFIG(cursor)
150 struct
151 {
153 QWaylandCursorTheme *theme = nullptr;
154 int themeBufferScale = 0;
157 bool gotFrameCallback = false;
158 bool gotTimerCallback = false;
159 } mCursor;
160#endif
161
162 // Accumulated state (applied on frame event)
163 struct State {
164 bool down = false;
166 bool enteredSurface = false; // Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event
168 uint distance = 0;
169 qreal pressure = 0;
170 qreal rotation = 0;
171 qreal xTilt = 0;
172 qreal yTilt = 0;
173 qreal slider = 0;
174 Qt::MouseButtons buttons = Qt::MouseButton::NoButton; // Actual buttons, down state -> left mouse is mapped inside the frame handler
175 //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20
176 bool operator==(const State &o) const;
178
179 template <typename T>
180 friend class CursorSurface;
181};
182
183class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, public QtWayland::zwp_tablet_pad_v2
184{
186public:
189
190protected:
195// void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override;
196// void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
197// void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
199};
200
201} // namespace QtWaylandClient
202
203QT_END_NAMESPACE
204
205#endif // QWAYLANDTABLETV2_P_H
static Qt::MouseButton mouseButtonFromTablet(uint button)