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
4#ifndef QWAYLANDTABLETV2_P_H
5#define QWAYLANDTABLETV2_P_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 <QtWaylandClient/private/qwayland-tablet-unstable-v2.h>
19
20#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
21
22#include <QtCore/QObject>
23#include <QtCore/QPointer>
24#include <QtCore/QPointF>
25#include <QtCore/QTimer>
26#include <QtGui/QPointingDevice>
27#include <QtGui/QInputDevice>
28
29QT_BEGIN_NAMESPACE
30
31namespace QtWaylandClient {
32
33class QWaylandDisplay;
34class QWaylandInputDevice;
35class QWaylandSurface;
36
37class QWaylandTabletSeatV2;
38class QWaylandTabletV2;
39class QWaylandTabletToolV2;
40class QWaylandTabletPadV2;
41
42#if QT_CONFIG(cursor)
45template <typename T>
46class CursorSurface;
47#endif
48
55
80
81class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public QtWayland::zwp_tablet_v2
82{
84public:
87
88protected:
89 // callbacks which act as setters
95};
96
97class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, public QtWayland::zwp_tablet_tool_v2
98{
100public:
103
105
106protected:
123// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override;
126
127private:
128#if QT_CONFIG(cursor)
129 int idealCursorScale() const;
130 void updateCursorTheme();
131 void cursorTimerCallback();
132 void cursorFrameCallback();
134#endif
135
137
138 // Static state (sent before done event)
142 bool m_hasRotation = false;
143 quint64 m_uid = 0;
144
146#if QT_CONFIG(cursor)
147 struct
148 {
150 QWaylandCursorTheme *theme = nullptr;
151 int themeBufferScale = 0;
154 bool gotFrameCallback = false;
155 bool gotTimerCallback = false;
156 } mCursor;
157#endif
158
159 // Accumulated state (applied on frame event)
160 struct State {
161 bool down = false;
163 bool enteredSurface = false; // Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event
165 uint distance = 0;
166 qreal pressure = 0;
167 qreal rotation = 0;
168 qreal xTilt = 0;
169 qreal yTilt = 0;
170 qreal slider = 0;
171 Qt::MouseButtons buttons = Qt::MouseButton::NoButton; // Actual buttons, down state -> left mouse is mapped inside the frame handler
172 //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20
173 bool operator==(const State &o) const;
175
176 template <typename T>
177 friend class CursorSurface;
178};
179
180class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, public QtWayland::zwp_tablet_pad_v2
181{
183public:
186
187protected:
192// void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override;
193// void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
194// void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
196};
197
198} // namespace QtWaylandClient
199
200QT_END_NAMESPACE
201
202#endif // QWAYLANDTABLETV2_P_H
static Qt::MouseButton mouseButtonFromTablet(uint button)