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
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 <QtGui/QPointingDevice>
26#include <QtGui/QInputDevice>
27
29
30namespace QtWaylandClient {
31
32class QWaylandDisplay;
33class QWaylandInputDevice;
34class QWaylandSurface;
35
36class QWaylandTabletSeatV2;
37class QWaylandTabletV2;
38class QWaylandTabletToolV2;
39class QWaylandTabletPadV2;
40
41class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tablet_manager_v2
42{
43public:
45 ~QWaylandTabletManagerV2() override;
46 QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat);
47};
48
49class Q_WAYLANDCLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2
50{
52public:
54 ~QWaylandTabletSeatV2() override;
55
56 QWaylandInputDevice *seat() const { return m_seat; }
57
58protected:
59 void zwp_tablet_seat_v2_tablet_added(struct ::zwp_tablet_v2 *id) override;
60 void zwp_tablet_seat_v2_tool_added(struct ::zwp_tablet_tool_v2 *id) override;
61 void zwp_tablet_seat_v2_pad_added(struct ::zwp_tablet_pad_v2 *id) override;
62
63private:
64 QWaylandInputDevice *m_seat;
65 QList<QWaylandTabletV2 *> m_tablets;
66 QList<QWaylandTabletToolV2 *> m_tools;
67 QList<QWaylandTabletPadV2 *> m_pads;
68};
69
70class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QObject, public QtWayland::zwp_tablet_v2
71{
73public:
74 explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet);
75
76protected:
77// void zwp_tablet_v2_name(const QString &name) override;
78// void zwp_tablet_v2_id(uint32_t vid, uint32_t pid) override;
79// void zwp_tablet_v2_path(const QString &path) override;
80// void zwp_tablet_v2_done() override;
81 void zwp_tablet_v2_removed() override;
82};
83
84class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QObject, public QtWayland::zwp_tablet_tool_v2
85{
87public:
88 QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool);
89
90protected:
91 void zwp_tablet_tool_v2_type(uint32_t tool_type) override;
92 void zwp_tablet_tool_v2_hardware_serial(uint32_t hardware_serial_hi, uint32_t hardware_serial_lo) override;
93// void zwp_tablet_tool_v2_hardware_id_wacom(uint32_t hardware_id_hi, uint32_t hardware_id_lo) override;
94 void zwp_tablet_tool_v2_capability(uint32_t capability) override;
95 void zwp_tablet_tool_v2_done() override;
96 void zwp_tablet_tool_v2_removed() override;
97 void zwp_tablet_tool_v2_proximity_in(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
98 void zwp_tablet_tool_v2_proximity_out() override;
99 void zwp_tablet_tool_v2_down(uint32_t serial) override;
100 void zwp_tablet_tool_v2_up() override;
101 void zwp_tablet_tool_v2_motion(wl_fixed_t x, wl_fixed_t y) override;
102 void zwp_tablet_tool_v2_pressure(uint32_t pressure) override;
103 void zwp_tablet_tool_v2_distance(uint32_t distance) override;
104 void zwp_tablet_tool_v2_tilt(wl_fixed_t tilt_x, wl_fixed_t tilt_y) override;
105 void zwp_tablet_tool_v2_rotation(wl_fixed_t degrees) override;
106 void zwp_tablet_tool_v2_slider(int32_t position) override;
107// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override;
108 void zwp_tablet_tool_v2_button(uint32_t serial, uint32_t button, uint32_t state) override;
109 void zwp_tablet_tool_v2_frame(uint32_t time) override;
110
111private:
112 QWaylandTabletSeatV2 *m_tabletSeat;
113
114 // Static state (sent before done event)
117 type m_toolType = type_pen;
118 bool m_hasRotation = false;
119 quint64 m_uid = 0;
120
121 // Accumulated state (applied on frame event)
122 struct State {
123 bool down = false;
124 QPointer<QWaylandSurface> proximitySurface;
125 bool enteredSurface = false; // Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event
126 QPointF surfacePosition;
127 uint distance = 0;
128 qreal pressure = 0;
129 qreal rotation = 0;
130 qreal xTilt = 0;
131 qreal yTilt = 0;
132 qreal slider = 0;
133 Qt::MouseButtons buttons = Qt::MouseButton::NoButton; // Actual buttons, down state -> left mouse is mapped inside the frame handler
134 //auto operator<=>(const Point&) const = default; // TODO: use this when upgrading to C++20
135 bool operator==(const State &o) const;
136 } m_pending, m_applied;
137};
138
139// We don't actually use this, but need to handle the "removed" event to comply with the protocol
140class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QObject, public QtWayland::zwp_tablet_pad_v2
141{
143public:
144 explicit QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad);
145
146protected:
147// void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override;
148// void zwp_tablet_pad_v2_path(const QString &path) override;
149// void zwp_tablet_pad_v2_buttons(uint32_t buttons) override;
150// void zwp_tablet_pad_v2_done() override;
151// void zwp_tablet_pad_v2_button(uint32_t time, uint32_t button, uint32_t state) override;
152// void zwp_tablet_pad_v2_enter(uint32_t serial, struct ::zwp_tablet_v2 *tablet, struct ::wl_surface *surface) override;
153// void zwp_tablet_pad_v2_leave(uint32_t serial, struct ::wl_surface *surface) override;
154 void zwp_tablet_pad_v2_removed() override;
155};
156
157} // namespace QtWaylandClient
158
160
161#endif // QWAYLANDTABLETV2_P_H
DeviceType
This enum represents the type of device that generated a QPointerEvent.
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
PointerType
This enum represents what is interacting with the pointing device.
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
QWaylandInputDevice * seat() const
QPushButton * button
[2]
else opt state
[0]
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
@ NoButton
Definition qnamespace.h:57
GLint GLint GLint GLint GLint x
[0]
GLsizei GLsizei GLfloat distance
GLenum type
GLint y
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define Q_OBJECT
unsigned long long quint64
Definition qtypes.h:61
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
QNetworkAccessManager manager