Commit a9f7072f authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

seat: Do not assert on corner touch cases

Consider the cases where we get a touch move or touch up but we never
received a touch down before.

In the case of move, we'll simulate a touchDown right there and move on
with reality.
In the case of touch up, we'll just ignore the event as simulating could
just be more confusing.

BUG: 450338


(cherry picked from commit 073058c9)
parent e3ac8172
Pipeline #140557 passed with stage
in 5 minutes and 3 seconds
......@@ -1072,7 +1072,12 @@ void SeatInterface::notifyTouchMotion(qint32 id, const QPointF &globalPosition)
if (!d->touch) {
return;
}
Q_ASSERT(d->globalTouch.ids.contains(id));
auto itTouch = d->globalTouch.ids.constFind(id);
if (itTouch == d->globalTouch.ids.constEnd()) {
// This can happen in cases where the interaction started while the device was asleep
qCWarning(KWAYLAND_SERVER) << "Detected a touch move that never has been down, discarding";
return;
}
const auto pos = globalPosition - d->globalTouch.focus.offset;
if (isDragTouch()) {
......@@ -1093,7 +1098,7 @@ void SeatInterface::notifyTouchMotion(qint32 id, const QPointF &globalPosition)
}
}
}
Q_EMIT touchMoved(id, d->globalTouch.ids[id], globalPosition);
Q_EMIT touchMoved(id, *itTouch, globalPosition);
}
void SeatInterface::notifyTouchUp(qint32 id)
......@@ -1101,7 +1106,13 @@ void SeatInterface::notifyTouchUp(qint32 id)
if (!d->touch) {
return;
}
Q_ASSERT(d->globalTouch.ids.contains(id));
auto itTouch = d->globalTouch.ids.find(id);
if (itTouch == d->globalTouch.ids.end()) {
// This can happen in cases where the interaction started while the device was asleep
qCWarning(KWAYLAND_SERVER) << "Detected a touch that never started, discarding";
return;
}
const qint32 serial = d->display->nextSerial();
if (d->drag.mode == SeatInterfacePrivate::Drag::Mode::Touch && d->drag.dragImplicitGrabSerial == d->globalTouch.ids.value(id)) {
// the implicitly grabbing touch point has been upped
......@@ -1119,7 +1130,7 @@ void SeatInterface::notifyTouchUp(qint32 id)
}
}
d->globalTouch.ids.remove(id);
d->globalTouch.ids.erase(itTouch);
}
void SeatInterface::notifyTouchFrame()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment