From 5b5a966e48a2548045fd5a284c34dfaed2dd1326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 11 Feb 2016 12:56:26 +0100 Subject: [PATCH] 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. --- autotests/wayland/pointer_input.cpp | 9 --------- input.cpp | 5 ++++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/autotests/wayland/pointer_input.cpp b/autotests/wayland/pointer_input.cpp index 486b8c17f8..1afe4bc87c 100644 --- a/autotests/wayland/pointer_input.cpp +++ b/autotests/wayland/pointer_input.cpp @@ -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)); } diff --git a/input.cpp b/input.cpp index 31672192e5..0451a87e2d 100644 --- a/input.cpp +++ b/input.cpp @@ -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); } }