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
30QT_BEGIN_NAMESPACE
31
32namespace QtWaylandClient {
33
34class QWaylandDisplay;
35class QWaylandInputDevice;
36class QWaylandSurface;
37
38class QWaylandTabletSeatV2;
39class QWaylandTabletV2;
40class QWaylandTabletToolV2;
41class QWaylandTabletPadV2;
42
43#if QT_CONFIG(cursor)
46template <typename T>
47class CursorSurface;
48#endif
49
56
81
82class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public QtWayland::zwp_tablet_v2
83{
85public:
88
89protected:
90 // callbacks which act as setters
96};
97
98class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, public QtWayland::zwp_tablet_tool_v2
99{
101public:
104
106
107protected:
124// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override;
127
128private:
129#if QT_CONFIG(cursor)
130 int idealCursorScale() const;
131 void updateCursorTheme();
132 void cursorTimerCallback();
133 void cursorFrameCallback();
135#endif
136
138
139 // Static state (sent before done event)
143 bool m_hasRotation = false;
144 quint64 m_uid = 0;
145
147#if QT_CONFIG(cursor)
148 struct
149 {
151 QWaylandCursorTheme *theme = nullptr;
152 int themeBufferScale = 0;
155 bool gotFrameCallback = false;
156 bool gotTimerCallback = false;
157 } mCursor;
158#endif
159
160 // Accumulated state (applied on frame event)
161 struct State {
162 bool down = false;
164 bool enteredSurface = false; // Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event
166 uint distance = 0;
167 qreal pressure = 0;
168 qreal rotation = 0;
169 qreal xTilt = 0;
170 qreal yTilt = 0;
171 qreal slider = 0;
172 Qt::MouseButtons buttons = Qt::MouseButton::NoButton; // Actual buttons, down state -> left mouse is mapped inside the frame handler
173 //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20
174 bool operator==(const State &o) const;
176
177 template <typename T>
178 friend class CursorSurface;
179};
180
181class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, public QtWayland::zwp_tablet_pad_v2
182{
184public:
187
188protected:
193// void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override;
194// void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
195// void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
197};
198
199} // namespace QtWaylandClient
200
201QT_END_NAMESPACE
202
203#endif // QWAYLANDTABLETV2_P_H
static Qt::MouseButton mouseButtonFromTablet(uint button)