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.
This commit is contained in:
Martin Gräßlin 2016-02-11 12:56:26 +01:00
parent 3aeec88449
commit 5b5a966e48
2 changed files with 4 additions and 10 deletions

View file

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

View file

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