wayland: Port kwin to SeatInterface::touchDown() changes

This commit is contained in:
Vlad Zahorodnii 2021-02-15 19:56:31 +02:00
parent 22d386cdd8
commit 311a370d77
4 changed files with 11 additions and 64 deletions

View file

@ -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;
}

View file

@ -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)

View file

@ -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()

View file

@ -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<qint32, qint32> m_idMapper;
QMetaObject::Connection m_focusGeometryConnection;
bool m_windowUpdatedInCycle = false;
QPointF m_lastPosition;