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