diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index d92b509392..15fc1063f0 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -159,6 +159,7 @@ void PointerInputTest::testWarpingUpdatesFocus() Cursor::setPos(QPoint(25, 25)); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.count(), 1); + QCOMPARE(enteredSpy.first().at(1).toPointF(), QPointF(25, 25)); // window should have focus QCOMPARE(pointer->enteredSurface(), surface); // also on the server @@ -201,15 +202,12 @@ void PointerInputTest::testWarpingGeneratesPointerMotion() // enter kwinApp()->platform()->pointerMotion(QPointF(25, 25), 1); QVERIFY(enteredSpy.wait()); - // we get a move event together with the enter, that's actually wrong but also shouldn't harm - QVERIFY(movedSpy.wait()); - QCOMPARE(movedSpy.count(), 1); - QCOMPARE(movedSpy.first().first().toPointF(), QPointF(25, 25)); + QCOMPARE(enteredSpy.first().at(1).toPointF(), QPointF(25, 25)); // now warp Cursor::setPos(QPoint(26, 26)); QVERIFY(movedSpy.wait()); - QCOMPARE(movedSpy.count(), 2); + QCOMPARE(movedSpy.count(), 1); QCOMPARE(movedSpy.last().first().toPointF(), QPointF(26, 26)); } diff --git a/pointer_input.cpp b/pointer_input.cpp index 7a8bfac172..ee33624130 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -281,6 +281,9 @@ void PointerInputRedirection::update() } if (t && t->surface()) { m_window = QPointer(t); + // TODO: add convenient API to update global pos together with updating focused surface + seat->setFocusedPointerSurface(nullptr); + seat->setPointerPos(m_pos.toPoint()); seat->setFocusedPointerSurface(t->surface(), t->inputTransformation()); m_windowGeometryConnection = connect(t, &Toplevel::geometryChanged, this, [this] {