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
32
QT_BEGIN_NAMESPACE
33
34
namespace
QtWaylandClient
{
35
36
class
QWaylandDisplay;
37
class
QWaylandInputDevice;
38
class
QWaylandSurface
;
39
40
class
QWaylandTabletSeatV2;
41
class
QWaylandTabletV2;
42
class
QWaylandTabletToolV2;
43
class
QWaylandTabletPadV2;
44
45
#
if
QT_CONFIG
(
cursor
)
46
class
QWaylandCursorTheme
;
47
class
QWaylandCursorShape
;
48
template
<
typename
T
>
49
class
CursorSurface
;
50
#
endif
51
52
class
Q_WAYLANDCLIENT_EXPORT
QWaylandTabletManagerV2
:
public
QtWayland
::
zwp_tablet_manager_v2
53
{
54
public
:
55
explicit
QWaylandTabletManagerV2
(
QWaylandDisplay
*
display
,
uint
id
,
uint
version
);
56
~
QWaylandTabletManagerV2
()
override
;
57
58
private
:
59
Q_DISABLE_COPY
(
QWaylandTabletManagerV2
)
60
};
61
62
class
Q_WAYLANDCLIENT_EXPORT
QWaylandTabletSeatV2
:
public
QObject
,
public
QtWayland
::
zwp_tablet_seat_v2
63
{
64
Q_OBJECT
65
public
:
66
explicit
QWaylandTabletSeatV2
(
QWaylandTabletManagerV2
*
manager
,
QWaylandInputDevice
*
seat
,
QObject
*
parent
=
nullptr
);
67
~
QWaylandTabletSeatV2
()
override
;
68
69
QWaylandInputDevice
*
seat
()
const
{
return
m_seat
; }
70
71
void
updateCursor
();
72
void
toolRemoved
(
QWaylandTabletToolV2
*
tool
);
73
74
protected
:
75
void
zwp_tablet_seat_v2_tablet_added
(
struct
::
zwp_tablet_v2
*
id
)
override
;
76
void
zwp_tablet_seat_v2_tool_added
(
struct
::
zwp_tablet_tool_v2
*
id
)
override
;
77
void
zwp_tablet_seat_v2_pad_added
(
struct
::
zwp_tablet_pad_v2
*
id
)
override
;
78
79
private
:
80
Q_DISABLE_COPY
(
QWaylandTabletSeatV2
)
81
82
QWaylandInputDevice
*
m_seat
;
83
QList
<
QWaylandTabletV2
*>
m_tablets
;
84
QList
<
QWaylandTabletToolV2
*>
m_tools
;
85
QList
<
QWaylandTabletToolV2
*>
m_deadTools
;
86
QList
<
QWaylandTabletPadV2
*>
m_pads
;
87
};
88
89
class
Q_WAYLANDCLIENT_EXPORT
QWaylandTabletV2
:
public
QPointingDevice
,
public
QtWayland
::
zwp_tablet_v2
90
{
91
Q_OBJECT
92
public
:
93
explicit
QWaylandTabletV2
(::
zwp_tablet_v2
*
tablet
,
const
QString
&
seatName
,
QObject
*
parent
=
nullptr
);
94
~
QWaylandTabletV2
();
95
96
protected
:
97
// callbacks which act as setters
98
void
zwp_tablet_v2_name
(
const
QString
&
name
)
override
;
99
void
zwp_tablet_v2_id
(
uint32_t
vid
,
uint32_t
pid
)
override
;
100
void
zwp_tablet_v2_path
(
const
QString
&
path
)
override
;
101
void
zwp_tablet_v2_done
()
override
;
102
void
zwp_tablet_v2_removed
()
override
;
103
104
private
:
105
Q_DISABLE_COPY
(
QWaylandTabletV2
)
106
};
107
108
class
Q_WAYLANDCLIENT_EXPORT
QWaylandTabletToolV2
:
public
QPointingDevice
,
public
QtWayland
::
zwp_tablet_tool_v2
109
{
110
Q_OBJECT
111
public
:
112
QWaylandTabletToolV2
(
QWaylandTabletSeatV2
*
tabletSeat
, ::
zwp_tablet_tool_v2
*
tool
,
QObject
*
parent
=
nullptr
);
113
~
QWaylandTabletToolV2
();
114
115
void
updateCursor
();
116
117
protected
:
118
void
zwp_tablet_tool_v2_type
(
uint32_t
tool_type
)
override
;
119
void
zwp_tablet_tool_v2_hardware_serial
(
uint32_t
hardware_serial_hi
,
uint32_t
hardware_serial_lo
)
override
;
120
void
zwp_tablet_tool_v2_hardware_id_wacom
(
uint32_t
hardware_id_hi
,
uint32_t
hardware_id_lo
)
override
;
121
void
zwp_tablet_tool_v2_capability
(
uint32_t
capability
)
override
;
122
void
zwp_tablet_tool_v2_done
()
override
;
123
void
zwp_tablet_tool_v2_removed
()
override
;
124
void
zwp_tablet_tool_v2_proximity_in
(
uint32_t
serial
,
struct
::
zwp_tablet_v2
*
tablet
,
struct
::
wl_surface
*
surface
)
override
;
125
void
zwp_tablet_tool_v2_proximity_out
()
override
;
126
void
zwp_tablet_tool_v2_down
(
uint32_t
serial
)
override
;
127
void
zwp_tablet_tool_v2_up
()
override
;
128
void
zwp_tablet_tool_v2_motion
(
wl_fixed_t
x
,
wl_fixed_t
y
)
override
;
129
void
zwp_tablet_tool_v2_pressure
(
uint32_t
pressure
)
override
;
130
void
zwp_tablet_tool_v2_distance
(
uint32_t
distance
)
override
;
131
void
zwp_tablet_tool_v2_tilt
(
wl_fixed_t
tilt_x
,
wl_fixed_t
tilt_y
)
override
;
132
void
zwp_tablet_tool_v2_rotation
(
wl_fixed_t
degrees
)
override
;
133
void
zwp_tablet_tool_v2_slider
(
int32_t
position
)
override
;
134
// void zwp_tablet_tool_v2_wheel(wl_fixed_t degrees, int32_t clicks) override;
135
void
zwp_tablet_tool_v2_button
(
uint32_t
serial
,
uint32_t
button
,
uint32_t
state
)
override
;
136
void
zwp_tablet_tool_v2_frame
(
uint32_t
time
)
override
;
137
138
private
:
139
Q_DISABLE_COPY
(
QWaylandTabletToolV2
)
140
141
#
if
QT_CONFIG
(
cursor
)
142
int
idealCursorScale
()
const
;
143
void
updateCursorTheme
();
144
void
cursorTimerCallback
();
145
void
cursorFrameCallback
();
146
CursorSurface
<
QWaylandTabletToolV2
> *
getOrCreateCursorSurface
();
147
#
endif
148
149
QWaylandTabletSeatV2
*
m_tabletSeat
;
150
151
// Static state (sent before done event)
152
QPointingDevice
::
PointerType
m_pointerType
=
QPointingDevice
::
PointerType
::
Unknown
;
153
QInputDevice
::
DeviceType
m_tabletDevice
=
QInputDevice
::
DeviceType
::
Unknown
;
154
zwp_tablet_tool_v2
::
type
m_toolType
=
type_pen
;
155
bool
m_hasRotation
=
false
;
156
quint64
m_uid
= 0;
157
158
uint32_t
mEnterSerial
= 0;
159
#
if
QT_CONFIG
(
cursor
)
160
struct
161
{
162
std
::
unique_ptr
<
QWaylandCursorShape
>
shape
;
163
QWaylandCursorTheme
*
theme
=
nullptr
;
164
int
themeBufferScale
= 0;
165
std
::
unique_ptr
<
CursorSurface
<
QWaylandTabletToolV2
>>
surface
;
166
QTimer
frameTimer
;
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
;
175
QPointer
<
QWaylandSurface
>
proximitySurface
;
176
bool
enteredSurface
=
false
;
// Not enough with just proximitySurface, if the surface is deleted, we still want to send a leave event
177
QPointF
surfacePosition
;
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
;
187
}
m_pending
,
m_applied
;
188
189
template
<
typename
T
>
190
friend
class
CursorSurface
;
191
};
192
193
class
Q_WAYLANDCLIENT_EXPORT
QWaylandTabletPadV2
:
public
QPointingDevice
,
public
QtWayland
::
zwp_tablet_pad_v2
194
{
195
Q_OBJECT
196
public
:
197
explicit
QWaylandTabletPadV2
(::
zwp_tablet_pad_v2
*
pad
,
QObject
*
parent
=
nullptr
);
198
~
QWaylandTabletPadV2
();
199
200
protected
:
201
void
zwp_tablet_pad_v2_group
(
struct
::
zwp_tablet_pad_group_v2
*
pad_group
)
override
;
202
void
zwp_tablet_pad_v2_path
(
const
QString
&
path
)
override
;
203
void
zwp_tablet_pad_v2_buttons
(
uint32_t
buttons
)
override
;
204
void
zwp_tablet_pad_v2_done
()
override
;
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;
208
void
zwp_tablet_pad_v2_removed
()
override
;
209
210
private
:
211
Q_DISABLE_COPY
(
QWaylandTabletPadV2
)
212
};
213
214
}
// namespace QtWaylandClient
215
216
QT_END_NAMESPACE
217
218
#
endif
// QWAYLANDTABLETV2_P_H
QtWaylandClient::QWaylandSurface
Definition
qwaylandsurface_p.h:33
QtWaylandClient::QWaylandTabletManagerV2
Definition
qwaylandtabletv2_p.h:53
QtWaylandClient::QWaylandTabletPadV2
Definition
qwaylandtabletv2_p.h:194
QtWaylandClient::QWaylandTabletSeatV2
Definition
qwaylandtabletv2_p.h:63
QtWaylandClient::QWaylandTabletToolV2
Definition
qwaylandtabletv2_p.h:109
QtWaylandClient::QWaylandTabletV2
Definition
qwaylandtabletv2_p.h:90
QtWaylandClient
Definition
qwaylandclientextension.h:16
QtWaylandClient::mouseButtonFromTablet
static Qt::MouseButton mouseButtonFromTablet(uint button)
Definition
qwaylandtabletv2.cpp:499
qtbase
src
plugins
platforms
wayland
qwaylandtabletv2_p.h
Generated on
for Qt by
1.16.1