diff --git a/src/input.cpp b/src/input.cpp index 70ef4b26bf..6f838d1d39 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -334,7 +334,7 @@ public: auto seat = waylandServer()->seat(); seat->setTimestamp(time); if (touchSurfaceAllowed()) { - input()->touch()->insertId(id, seat->touchDown(pos)); + seat->touchDown(id, pos); } return true; } @@ -345,10 +345,7 @@ public: auto seat = waylandServer()->seat(); seat->setTimestamp(time); if (touchSurfaceAllowed()) { - const qint32 kwaylandId = input()->touch()->mappedId(id); - if (kwaylandId != -1) { - seat->touchMove(kwaylandId, pos); - } + seat->touchMove(id, pos); } return true; } @@ -359,11 +356,7 @@ public: auto seat = waylandServer()->seat(); seat->setTimestamp(time); if (touchSurfaceAllowed()) { - const qint32 kwaylandId = input()->touch()->mappedId(id); - if (kwaylandId != -1) { - seat->touchUp(kwaylandId); - input()->touch()->removeId(id); - } + seat->touchUp(id); } return true; } @@ -1444,7 +1437,7 @@ public: } auto seat = waylandServer()->seat(); seat->setTimestamp(time); - input()->touch()->insertId(id, seat->touchDown(pos)); + seat->touchDown(id, pos); return true; } bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override { @@ -1453,10 +1446,7 @@ public: } auto seat = waylandServer()->seat(); seat->setTimestamp(time); - const qint32 kwaylandId = input()->touch()->mappedId(id); - if (kwaylandId != -1) { - seat->touchMove(kwaylandId, pos); - } + seat->touchMove(id, pos); return true; } bool touchUp(qint32 id, quint32 time) override { @@ -1465,11 +1455,7 @@ public: } auto seat = waylandServer()->seat(); seat->setTimestamp(time); - const qint32 kwaylandId = input()->touch()->mappedId(id); - if (kwaylandId != -1) { - seat->touchUp(kwaylandId); - input()->touch()->removeId(id); - } + seat->touchUp(id); return true; } bool pinchGestureBegin(int fingerCount, quint32 time) override { @@ -1946,7 +1932,7 @@ public: return true; } seat->setTimestamp(time); - input()->touch()->insertId(id, seat->touchDown(pos)); + seat->touchDown(id, pos); return true; } bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override { @@ -1967,12 +1953,7 @@ public: return true; } seat->setTimestamp(time); - const qint32 kwaylandId = input()->touch()->mappedId(id); - if (kwaylandId == -1) { - return true; - } - - seat->touchMove(kwaylandId, pos); + seat->touchMove(id, pos); if (Toplevel *t = input()->findToplevel(pos.toPoint())) { // TODO: consider decorations @@ -1994,11 +1975,7 @@ public: return false; } seat->setTimestamp(time); - const qint32 kwaylandId = input()->touch()->mappedId(id); - if (kwaylandId != -1) { - seat->touchUp(kwaylandId); - input()->touch()->removeId(id); - } + seat->touchUp(id); if (m_touchId == id) { m_touchId = -1; } diff --git a/src/libinput/events.cpp b/src/libinput/events.cpp index bbd83b2ff6..6845debaf7 100644 --- a/src/libinput/events.cpp +++ b/src/libinput/events.cpp @@ -261,11 +261,9 @@ QPointF TouchEvent::absolutePos(const QSize &size) const qint32 TouchEvent::id() const { - Q_ASSERT(type() != LIBINPUT_EVENT_TOUCH_CANCEL && type() != LIBINPUT_EVENT_TOUCH_FRAME); + Q_ASSERT(type() != LIBINPUT_EVENT_TOUCH_FRAME); - const qint32 slot = libinput_event_touch_get_seat_slot(m_touchEvent); - - return slot == -1 ? 0 : slot; + return libinput_event_touch_get_seat_slot(m_touchEvent); } GestureEvent::GestureEvent(libinput_event *event, libinput_event_type type) diff --git a/src/touch_input.cpp b/src/touch_input.cpp index 75ee7a8f9e..715d052931 100644 --- a/src/touch_input.cpp +++ b/src/touch_input.cpp @@ -136,25 +136,6 @@ void TouchInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl *o // nothing to do } -void TouchInputRedirection::insertId(qint32 internalId, qint32 kwaylandId) -{ - m_idMapper.insert(internalId, kwaylandId); -} - -qint32 TouchInputRedirection::mappedId(qint32 internalId) -{ - auto it = m_idMapper.constFind(internalId); - if (it != m_idMapper.constEnd()) { - return it.value(); - } - return -1; -} - -void TouchInputRedirection::removeId(qint32 internalId) -{ - m_idMapper.remove(internalId); -} - void TouchInputRedirection::processDown(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device) { Q_UNUSED(device) @@ -213,7 +194,6 @@ void TouchInputRedirection::cancel() return; } waylandServer()->seat()->cancelTouchSequence(); - m_idMapper.clear(); } void TouchInputRedirection::frame() diff --git a/src/touch_input.h b/src/touch_input.h index bc30aade88..0dcb4f08cb 100644 --- a/src/touch_input.h +++ b/src/touch_input.h @@ -50,10 +50,6 @@ public: void cancel(); void frame(); - void insertId(qint32 internalId, qint32 kwaylandId); - void removeId(qint32 internalId); - qint32 mappedId(qint32 internalId); - void setDecorationPressId(qint32 id) { m_decorationId = id; } @@ -84,10 +80,6 @@ private: bool m_inited = false; qint32 m_decorationId = -1; qint32 m_internalId = -1; - /** - * external/kwayland - */ - QHash m_idMapper; QMetaObject::Connection m_focusGeometryConnection; bool m_windowUpdatedInCycle = false; QPointF m_lastPosition;