Process pointer warped positions like normal updates

If the pointer is warped the position change should be treated like
a change coming from the input device. Our normal processing should
take place.

A problem in this case is the timestamp to pass to the wayland server.
Normally our timestamps come from the backend/libinput and we don't
know the next one. As an intermediate solution we just use the last
timestamp on the seat. In future a solution could be to not use the
backend's timestamp at all, but have our own timestamp handling.
master
Martin Gräßlin 9 years ago
parent 3aeec88449
commit 5b5a966e48

@ -208,22 +208,16 @@ void PointerInputTest::testWarpingUpdatesFocus()
// enter
Cursor::setPos(QPoint(25, 25));
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QVERIFY(enteredSpy.wait());
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QCOMPARE(enteredSpy.count(), 1);
// window should have focus
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QCOMPARE(pointer->enteredSurface(), surface);
// also on the server
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface());
// and out again
Cursor::setPos(QPoint(250, 250));;
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QVERIFY(leftSpy.wait());
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QCOMPARE(leftSpy.count(), 1);
// there should not be a focused pointer surface anymore
QVERIFY(!waylandServer()->seat()->focusedPointerSurface());
@ -265,11 +259,8 @@ void PointerInputTest::testWarpingGeneratesPointerMotion()
// now warp
Cursor::setPos(QPoint(26, 26));
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QVERIFY(movedSpy.wait());
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QCOMPARE(movedSpy.count(), 2);
QEXPECT_FAIL("", "Not yet imlemented", Continue);
QCOMPARE(movedSpy.last().first().toPointF(), QPointF(26, 26));
}

@ -1693,10 +1693,13 @@ void InputRedirection::updatePointerAfterScreenChange()
void InputRedirection::warpPointer(const QPointF &pos)
{
if (supportsPointerWarping()) {
quint32 timestamp = 0;
if (waylandServer()) {
waylandServer()->backend()->warpPointer(pos);
timestamp = waylandServer()->seat()->timestamp();
}
updatePointerPosition(pos);
// TODO: better way to get timestamps
processPointerMotion(pos, timestamp);
}
}

Loading…
Cancel
Save