Client: Pass tablet input to decorations

Otherwise decoration cannot be interacted with using a stylus.

Since there is no reason for the decoration to distinguish between
stylus and mouse input reuse the existing mouse handling instead
of adding a dedicated tablet input function to the decoration API.

Fixes: QTBUG-117920
Pick-to: 6.8
Change-Id: I947e5b4f638fb3c2b15a1ca4ed01c02caf9d4812
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Nicolas Fella 2024-07-07 22:16:35 +02:00 committed by Shawn Rutledge
parent bb15139024
commit fcdef0cd5f
3 changed files with 26 additions and 4 deletions

View File

@ -382,10 +382,19 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time)
qreal rotation = m_pending.rotation;
int z = int(m_pending.distance);
QWindowSystemInterface::handleTabletEvent(window, timestamp, this, localPosition, globalPosition,
buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z,
m_tabletSeat->seat()->modifiers());
// do not use localPosition here since that is in Qt window coordinates
// but we need surface coordinates to include the decoration
bool decorationHandledEvent = waylandWindow->handleTabletEventDecoration(
m_tabletSeat->seat(), m_pending.surfacePosition,
window->mapToGlobal(m_pending.surfacePosition) + delta, buttons,
m_tabletSeat->seat()->modifiers());
if (!decorationHandledEvent) {
QWindowSystemInterface::handleTabletEvent(window, timestamp, this, localPosition, globalPosition,
buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z,
m_tabletSeat->seat()->modifiers());
}
}
m_applied = m_pending;

View File

@ -1360,6 +1360,16 @@ bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const
return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods);
}
bool QWaylandWindow::handleTabletEventDecoration(QWaylandInputDevice *inputDevice,
const QPointF &local, const QPointF &global,
Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers)
{
if (!mWindowDecorationEnabled)
return false;
return mWindowDecoration->handleMouse(inputDevice, local, global, buttons, modifiers);
}
void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e)
{
if (mMousePressedInContentArea == Qt::NoButton &&

View File

@ -180,6 +180,9 @@ public:
bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,
QEventPoint::State state, Qt::KeyboardModifiers mods);
bool handleTabletEventDecoration(QWaylandInputDevice *inputDevice, const QPointF &local,
const QPointF &global, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers);
bool createDecoration();