diff --git a/input.cpp b/input.cpp --- a/input.cpp +++ b/input.cpp @@ -1502,6 +1502,9 @@ public: bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override { auto seat = waylandServer()->seat(); + if (seat->isDragTouch()) { + return true; + } if (!seat->isDragPointer()) { return false; } @@ -1536,6 +1539,61 @@ // TODO: should we pass through effects? return true; } + bool touchDown(quint32 id, const QPointF &pos, quint32 time) override { + auto seat = waylandServer()->seat(); + if (seat->isDragPointer()) { + return true; + } + if (!seat->isDragTouch()) { + return false; + } + seat->setTimestamp(time); + input()->touch()->insertId(id, seat->touchDown(pos)); + return true; + } + bool touchMotion(quint32 id, const QPointF &pos, quint32 time) override { + auto seat = waylandServer()->seat(); + if (seat->isDragPointer()) { + return true; + } + if (!seat->isDragTouch()) { + return false; + } + seat->setTimestamp(time); + const qint32 kwaylandId = input()->touch()->mappedId(id); + if (kwaylandId == -1) { + return true; + } + + seat->touchMove(kwaylandId, pos); + + if (Toplevel *t = input()->findToplevel(pos.toPoint())) { + // TODO: consider decorations + if (t->surface() != seat->dragSurface()) { + if (AbstractClient *c = qobject_cast(t)) { + workspace()->activateClient(c); + } + seat->setDragTarget(t->surface(), pos, t->inputTransformation()); + } + } else { + // no window at that place, if we have a surface we need to reset + seat->setDragTarget(nullptr); + } + return true; + } + bool touchUp(quint32 id, quint32 time) override { + auto seat = waylandServer()->seat(); + if (!seat->isDragTouch()) { + return false; + } + seat->setTimestamp(time); + const qint32 kwaylandId = input()->touch()->mappedId(id); + if (kwaylandId != -1) { + seat->touchUp(kwaylandId); + input()->touch()->removeId(id); + } + return true; + } }; KWIN_SINGLETON_FACTORY(InputRedirection)