diff --git a/src/input.cpp b/src/input.cpp index eda4d1ec99..8024ab060a 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -2143,6 +2143,8 @@ public: bool tabletToolEvent(TabletEvent *event) override { + using namespace KWaylandServer; + if (!workspace()) { return false; } @@ -2205,7 +2207,17 @@ public: break; } const quint32 MAX_VAL = 65535; - tool->sendPressure(MAX_VAL * event->pressure()); + + if (tool->hasCapability(TabletToolV2Interface::Pressure)) { + tool->sendPressure(MAX_VAL * event->pressure()); + } + if (tool->hasCapability(TabletToolV2Interface::Tilt)) { + tool->sendTilt(event->xTilt(), event->yTilt()); + } + if (tool->hasCapability(TabletToolV2Interface::Rotation)) { + tool->sendRotation(event->rotation()); + } + tool->sendFrame(event->timestamp()); return true; } diff --git a/src/wayland/tablet_v2_interface.cpp b/src/wayland/tablet_v2_interface.cpp index e9630acabe..0f93fdbf16 100644 --- a/src/wayland/tablet_v2_interface.cpp +++ b/src/wayland/tablet_v2_interface.cpp @@ -222,6 +222,11 @@ TabletToolV2Interface::~TabletToolV2Interface() } } +bool TabletToolV2Interface::hasCapability(Capability capability) const +{ + return d->m_capabilities.contains(capability); +} + void TabletToolV2Interface::setCurrentSurface(SurfaceInterface *surface) { if (d->m_surface == surface) diff --git a/src/wayland/tablet_v2_interface.h b/src/wayland/tablet_v2_interface.h index 47fd21a120..a4e5a73b6d 100644 --- a/src/wayland/tablet_v2_interface.h +++ b/src/wayland/tablet_v2_interface.h @@ -83,6 +83,8 @@ public: }; Q_ENUM(Capability) + bool hasCapability(Capability capability) const; + /** * Sets the surface the events will be sent to. *