diff --git a/autotests/wayland/pointer_input.cpp b/autotests/wayland/pointer_input.cpp index 9516d7974f..cb9abeb524 100644 --- a/autotests/wayland/pointer_input.cpp +++ b/autotests/wayland/pointer_input.cpp @@ -302,15 +302,11 @@ void PointerInputTest::testUpdateFocusAfterScreenChange() QCOMPARE(screens()->count(), 1); // this should have warped the cursor - QEXPECT_FAIL("", "Doesn't work yet, requires libinput", Continue); QCOMPARE(Cursor::pos(), QPoint(639, 511)); - QEXPECT_FAIL("", "Doesn't work yet, requires libinput", Continue); QVERIFY(window->geometry().contains(Cursor::pos())); // and we should get an enter event - QEXPECT_FAIL("", "Not yet passed through", Continue); QVERIFY(enteredSpy.wait()); - QEXPECT_FAIL("", "Not yet passed through", Continue); QCOMPARE(enteredSpy.count(), 1); } diff --git a/input.cpp b/input.cpp index 0451a87e2d..53106fe6d5 100644 --- a/input.cpp +++ b/input.cpp @@ -915,6 +915,7 @@ void InputRedirection::setupWorkspace() } ); connect(workspace(), &Workspace::configChanged, this, &InputRedirection::reconfigure); + connect(screens(), &Screens::changed, this, &InputRedirection::updatePointerAfterScreenChange); connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &InputRedirection::updatePointerWindow); connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &InputRedirection::updateKeyboardWindow); @@ -1071,7 +1072,6 @@ void InputRedirection::setupLibInputWithScreens() } ); // set pos to center of all screens - connect(screens(), &Screens::changed, this, &InputRedirection::updatePointerAfterScreenChange); m_globalPointer = screens()->geometry().center(); emit globalPointerChanged(m_globalPointer); // sanitize @@ -1686,8 +1686,13 @@ void InputRedirection::updatePointerAfterScreenChange() return; } // pointer no longer on a screen, reposition to closes screen - m_globalPointer = screens()->geometry(screens()->number(m_globalPointer.toPoint())).center(); - emit globalPointerChanged(m_globalPointer); + const QPointF pos = screens()->geometry(screens()->number(m_globalPointer.toPoint())).center(); + quint32 timestamp = 0; + if (auto seat = findSeat()) { + timestamp = seat->timestamp(); + } + // TODO: better way to get timestamps + processPointerMotion(pos, timestamp); } void InputRedirection::warpPointer(const QPointF &pos)