backends/wayland: Support touch input when there's multiple outputs
Makes the outputs we are emitting relative to the output position. This way if there's an esoteric setup or just more than one output, it won't just always be relative to the first output. Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
This commit is contained in:
parent
29f772cbbb
commit
d83f6e9a85
1 changed files with 12 additions and 3 deletions
|
@ -189,16 +189,25 @@ WaylandInputDevice::WaylandInputDevice(KWayland::Client::Touch *touch, WaylandSe
|
|||
Q_EMIT touchFrame(this);
|
||||
});
|
||||
connect(touch, &Touch::sequenceStarted, this, [this](TouchPoint *tp) {
|
||||
Q_EMIT touchDown(tp->id(), tp->position(), std::chrono::milliseconds(tp->time()), this);
|
||||
auto o = m_seat->backend()->findOutput(tp->surface());
|
||||
Q_ASSERT(o);
|
||||
const QPointF position = o->geometry().topLeft() + tp->position();
|
||||
Q_EMIT touchDown(tp->id(), position, std::chrono::milliseconds(tp->time()), this);
|
||||
});
|
||||
connect(touch, &Touch::pointAdded, this, [this](TouchPoint *tp) {
|
||||
Q_EMIT touchDown(tp->id(), tp->position(), std::chrono::milliseconds(tp->time()), this);
|
||||
auto o = m_seat->backend()->findOutput(tp->surface());
|
||||
Q_ASSERT(o);
|
||||
const QPointF position = o->geometry().topLeft() + tp->position();
|
||||
Q_EMIT touchDown(tp->id(), position, std::chrono::milliseconds(tp->time()), this);
|
||||
});
|
||||
connect(touch, &Touch::pointRemoved, this, [this](TouchPoint *tp) {
|
||||
Q_EMIT touchUp(tp->id(), std::chrono::milliseconds(tp->time()), this);
|
||||
});
|
||||
connect(touch, &Touch::pointMoved, this, [this](TouchPoint *tp) {
|
||||
Q_EMIT touchMotion(tp->id(), tp->position(), std::chrono::milliseconds(tp->time()), this);
|
||||
auto o = m_seat->backend()->findOutput(tp->surface());
|
||||
Q_ASSERT(o);
|
||||
const QPointF position = o->geometry().topLeft() + tp->position();
|
||||
Q_EMIT touchMotion(tp->id(), position, std::chrono::milliseconds(tp->time()), this);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue