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
This commit is contained in:
parent
9e25fd0468
commit
62637c1a92
1 changed files with 15 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue