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