18 const auto seats =
display->inputDevices();
19 for (
auto *seat : seats)
41 for (
auto *tablet : m_tablets)
43 for (
auto *tool : m_tools)
45 for (
auto *pad : m_pads)
56 m_tablets.push_back(tablet);
63 m_tools.push_back(tool);
70 m_pads.push_back(pad);
87 , m_tabletSeat(tabletSeat)
93 m_toolType =
type(tool_type);
98 m_uid = (
quint64(hardware_serial_hi) << 32) + hardware_serial_lo;
103 if (capability == capability_rotation)
104 m_hasRotation =
true;
109 switch (m_toolType) {
110 case type::type_airbrush:
111 case type::type_brush:
112 case type::type_pencil:
116 case type::type_eraser:
119 case type::type_mouse:
120 case type::type_lens:
123 case type::type_finger:
127 switch (m_toolType) {
128 case type::type_airbrush:
131 case type::type_brush:
132 case type::type_pencil:
134 case type::type_eraser:
137 case type::type_lens:
140 case type::type_mouse:
141 case type::type_finger:
158 qCDebug(lcQpaWayland) <<
"Ignoring zwp_tablet_tool_v2_proximity_v2 with no surface";
161 m_pending.enteredSurface =
true;
167 m_pending.enteredSurface =
false;
168 m_pending.proximitySurface =
nullptr;
173 m_pending.down =
true;
175 if (m_pending.proximitySurface) {
185 m_pending.down =
false;
190 m_pending.surfacePosition =
QPointF(wl_fixed_to_double(
x), wl_fixed_to_double(
y));
195 const int maxPressure = 65535;
196 m_pending.pressure =
qreal(pressure)/maxPressure;
206 m_pending.xTilt = wl_fixed_to_double(tilt_x);
207 m_pending.yTilt = wl_fixed_to_double(tilt_y);
212 m_pending.rotation = wl_fixed_to_double(degrees);
235 if (
state == button_state_pressed)
236 m_pending.buttons |= mouseButton;
238 m_pending.buttons &= ~mouseButton;
243 if (m_pending.proximitySurface && !m_applied.proximitySurface) {
245 m_applied.proximitySurface = m_pending.proximitySurface;
248 if (!(m_pending == m_applied) && m_pending.proximitySurface) {
249 if (!m_pending.proximitySurface) {
250 qCWarning(lcQpaWayland) <<
"Can't send tablet event with no proximity surface, ignoring";
260 globalPosition += delta;
263 buttons |= m_pending.buttons;
264 qreal pressure = m_pending.pressure;
265 int xTilt = int(m_pending.xTilt);
266 int yTilt = int(m_pending.yTilt);
267 qreal tangentialPressure = m_pending.slider;
268 qreal rotation = m_pending.rotation;
269 int z = int(m_pending.distance);
271 int(m_tabletDevice),
int(m_pointerType), buttons, pressure,
272 xTilt, yTilt, tangentialPressure, rotation,
z, m_uid);
275 if (!m_pending.proximitySurface && m_applied.enteredSurface) {
280 m_applied = m_pending;
284bool QWaylandTabletToolV2::State::operator==(
const QWaylandTabletToolV2::State &
o)
const {
287 proximitySurface.
data() ==
o.proximitySurface.data() &&
288 enteredSurface ==
o.enteredSurface &&
289 surfacePosition ==
o.surfacePosition &&
291 pressure ==
o.pressure &&
292 rotation ==
o.rotation &&
295 slider ==
o.slider &&
296 buttons ==
o.buttons;
314#include "moc_qwaylandtabletv2_p.cpp"
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
\inmodule QtCore\reentrant
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
T * data() const noexcept
static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, const QPointF &local, const QPointF &global, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
static bool handleTabletLeaveProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
static bool handleTabletEnterProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
void setLastInputDevice(QWaylandInputDevice *device, uint32_t serial, QWaylandWindow *window)
static QWaylandSurface * fromWlSurface(::wl_surface *surface)
QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version)
QWaylandTabletSeatV2 * createTabletSeat(QWaylandInputDevice *seat)
~QWaylandTabletManagerV2() override
void zwp_tablet_pad_v2_removed() override
QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad)
QWaylandInputDevice * seat() const
~QWaylandTabletSeatV2() override
void zwp_tablet_seat_v2_pad_added(struct ::zwp_tablet_pad_v2 *id) override
QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat)
void zwp_tablet_seat_v2_tool_added(struct ::zwp_tablet_tool_v2 *id) override
void zwp_tablet_seat_v2_tablet_added(struct ::zwp_tablet_v2 *id) override
QWaylandTabletV2(::zwp_tablet_v2 *tablet)
void zwp_tablet_v2_removed() override
QPointF mapFromWlSurface(const QPointF &surfacePosition) const
Converts from wl_surface coordinates to Qt window coordinates.
static QWaylandWindow * fromWlSurface(::wl_surface *surface)
qDeleteAll(list.begin(), list.end())
struct wl_display * display
Combined button and popup list for selecting options.
static Qt::MouseButton mouseButtonFromTablet(uint button)
#define qCWarning(category,...)
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLsizei GLsizei GLfloat distance
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
unsigned long long quint64
QNetworkAccessManager manager