From f71ee59a372e149ceaa1ad613bfb3394ee252f1a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 9 Feb 2023 15:07:56 +0200 Subject: [PATCH] Port away from Cursor::setPos() Use input device specific apis to change the position of the cursor. The main reason to do so is to break the assumption that Cursor position is the same as pointer position, which I would like to rely on later to merge tablet and pointer cursors. --- autotests/integration/activation_test.cpp | 4 +- autotests/integration/activities_test.cpp | 4 +- .../integration/decoration_input_test.cpp | 8 +- .../integration/desktop_window_x11_test.cpp | 4 +- .../dont_crash_aurorae_destroy_deco.cpp | 4 +- .../integration/dont_crash_empty_deco.cpp | 4 +- .../integration/dont_crash_no_border.cpp | 4 +- .../dont_crash_useractions_menu.cpp | 4 +- .../integration/effects/translucency_test.cpp | 4 +- .../integration/fractional_scaling_test.cpp | 3 +- .../integration/globalshortcuts_test.cpp | 4 +- .../integration/input_stacking_order.cpp | 4 +- autotests/integration/inputmethod_test.cpp | 11 +-- autotests/integration/internal_window.cpp | 8 +- autotests/integration/kwinbindings_test.cpp | 4 +- .../integration/layershellv1window_test.cpp | 3 +- autotests/integration/lockscreen.cpp | 4 +- autotests/integration/maximize_test.cpp | 4 +- .../modifier_only_shortcut_test.cpp | 4 +- .../integration/move_resize_window_test.cpp | 9 +- .../integration/no_global_shortcuts_test.cpp | 4 +- autotests/integration/outputchanges_test.cpp | 4 +- autotests/integration/placement_test.cpp | 6 +- autotests/integration/plasma_surface_test.cpp | 6 +- autotests/integration/plasmawindow_test.cpp | 4 +- .../integration/pointer_constraints_test.cpp | 24 +++--- autotests/integration/pointer_input.cpp | 82 +++++++++---------- autotests/integration/quick_tiling_test.cpp | 3 +- autotests/integration/screen_changes_test.cpp | 4 +- .../screenedge_client_show_test.cpp | 10 +-- autotests/integration/screenedges_test.cpp | 3 +- autotests/integration/screens_test.cpp | 6 +- .../integration/scripting/screenedge_test.cpp | 16 ++-- autotests/integration/shade_test.cpp | 4 +- autotests/integration/struts_test.cpp | 6 +- autotests/integration/tabbox_test.cpp | 4 +- autotests/integration/tiles_test.cpp | 8 +- autotests/integration/touch_input_test.cpp | 4 +- autotests/integration/transient_placement.cpp | 4 +- autotests/integration/window_rules_test.cpp | 4 +- .../integration/window_selection_test.cpp | 11 ++- autotests/integration/xdgshellwindow_test.cpp | 4 +- autotests/integration/xwayland_input_test.cpp | 12 +-- 43 files changed, 167 insertions(+), 164 deletions(-) diff --git a/autotests/integration/activation_test.cpp b/autotests/integration/activation_test.cpp index 9c1e78d39c..9ce98b9ffe 100644 --- a/autotests/integration/activation_test.cpp +++ b/autotests/integration/activation_test.cpp @@ -11,7 +11,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" @@ -65,7 +65,7 @@ void ActivationTest::init() QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void ActivationTest::cleanup() diff --git a/autotests/integration/activities_test.cpp b/autotests/integration/activities_test.cpp index 689312b546..4544b340a5 100644 --- a/autotests/integration/activities_test.cpp +++ b/autotests/integration/activities_test.cpp @@ -11,8 +11,8 @@ #include "activities.h" #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" +#include "pointer_input.h" #include "utils/xcbutils.h" #include "wayland_server.h" #include "workspace.h" @@ -75,7 +75,7 @@ void ActivitiesTest::cleanupTestCase() void ActivitiesTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void ActivitiesTest::cleanup() diff --git a/autotests/integration/decoration_input_test.cpp b/autotests/integration/decoration_input_test.cpp index d49a5943f6..7be7da1d9f 100644 --- a/autotests/integration/decoration_input_test.cpp +++ b/autotests/integration/decoration_input_test.cpp @@ -148,7 +148,7 @@ void DecorationInputTest::init() QVERIFY(Test::waitForWaylandPointer()); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void DecorationInputTest::cleanup() @@ -593,7 +593,7 @@ void DecorationInputTest::testModifierClickUnrestrictedMove() QVERIFY(!window->noBorder()); window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2)); // move cursor on window - Cursors::self()->mouse()->setPos(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0)); + input()->pointer()->warp(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0)); // simulate modifier+click quint32 timestamp = 1; @@ -655,7 +655,7 @@ void DecorationInputTest::testModifierScrollOpacity() QVERIFY(!window->noBorder()); window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2)); // move cursor on window - Cursors::self()->mouse()->setPos(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0)); + input()->pointer()->warp(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0)); // set the opacity to 0.5 window->setOpacity(0.5); QCOMPARE(window->opacity(), 0.5); @@ -733,7 +733,7 @@ void DecorationInputTest::testTouchEvents() QCOMPARE(window->isInteractiveMove(), false); // let's check that a hover motion is sent if the pointer is on deco, when touch release - Cursors::self()->mouse()->setPos(tapPoint); + input()->pointer()->warp(tapPoint); QCOMPARE(hoverMoveSpy.count(), 2); Test::touchDown(0, tapPoint, timestamp++); QCOMPARE(hoverMoveSpy.count(), 3); diff --git a/autotests/integration/desktop_window_x11_test.cpp b/autotests/integration/desktop_window_x11_test.cpp index ab0c9f45bf..31cb09bfef 100644 --- a/autotests/integration/desktop_window_x11_test.cpp +++ b/autotests/integration/desktop_window_x11_test.cpp @@ -10,8 +10,8 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" +#include "pointer_input.h" #include "utils/xcbutils.h" #include "wayland_server.h" #include "window.h" @@ -59,7 +59,7 @@ void X11DesktopWindowTest::initTestCase() void X11DesktopWindowTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void X11DesktopWindowTest::cleanup() diff --git a/autotests/integration/dont_crash_aurorae_destroy_deco.cpp b/autotests/integration/dont_crash_aurorae_destroy_deco.cpp index 1c3019befc..07b861f801 100644 --- a/autotests/integration/dont_crash_aurorae_destroy_deco.cpp +++ b/autotests/integration/dont_crash_aurorae_destroy_deco.cpp @@ -12,7 +12,7 @@ #include "core/output.h" #include "core/outputbackend.h" #include "core/renderbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "workspace.h" #include "x11window.h" @@ -67,7 +67,7 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase() void DontCrashAuroraeDestroyDecoTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows() diff --git a/autotests/integration/dont_crash_empty_deco.cpp b/autotests/integration/dont_crash_empty_deco.cpp index df80f1d5b0..7b72440dc0 100644 --- a/autotests/integration/dont_crash_empty_deco.cpp +++ b/autotests/integration/dont_crash_empty_deco.cpp @@ -12,7 +12,7 @@ #include "core/output.h" #include "core/outputbackend.h" #include "core/renderbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "workspace.h" #include "x11window.h" @@ -59,7 +59,7 @@ void DontCrashEmptyDecorationTest::initTestCase() void DontCrashEmptyDecorationTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void DontCrashEmptyDecorationTest::testBug361551() diff --git a/autotests/integration/dont_crash_no_border.cpp b/autotests/integration/dont_crash_no_border.cpp index 18cd911b74..89789bab7d 100644 --- a/autotests/integration/dont_crash_no_border.cpp +++ b/autotests/integration/dont_crash_no_border.cpp @@ -13,7 +13,7 @@ #include "core/output.h" #include "core/outputbackend.h" #include "core/renderbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "workspace.h" #include "x11window.h" @@ -70,7 +70,7 @@ void DontCrashNoBorder::init() QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1)); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void DontCrashNoBorder::cleanup() diff --git a/autotests/integration/dont_crash_useractions_menu.cpp b/autotests/integration/dont_crash_useractions_menu.cpp index ab55a57937..7726287757 100644 --- a/autotests/integration/dont_crash_useractions_menu.cpp +++ b/autotests/integration/dont_crash_useractions_menu.cpp @@ -10,8 +10,6 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" -#include "keyboard_input.h" #include "pointer_input.h" #include "useractions.h" #include "wayland_server.h" @@ -66,7 +64,7 @@ void TestDontCrashUseractionsMenu::init() QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TestDontCrashUseractionsMenu::cleanup() diff --git a/autotests/integration/effects/translucency_test.cpp b/autotests/integration/effects/translucency_test.cpp index 9d6267c32a..9a0fc7fea4 100644 --- a/autotests/integration/effects/translucency_test.cpp +++ b/autotests/integration/effects/translucency_test.cpp @@ -10,9 +10,9 @@ #include "composite.h" #include "core/outputbackend.h" -#include "cursor.h" #include "effectloader.h" #include "effects.h" +#include "pointer_input.h" #include "wayland_server.h" #include "workspace.h" #include "x11window.h" @@ -138,7 +138,7 @@ void TranslucencyTest::testMoveAfterDesktopChange() workspace()->sendWindowToDesktop(window, 2, false); effects->setCurrentDesktop(2); QVERIFY(!m_translucencyEffect->isActive()); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); workspace()->performWindowOperation(window, Options::MoveOp); QVERIFY(m_translucencyEffect->isActive()); QTest::qWait(200); diff --git a/autotests/integration/fractional_scaling_test.cpp b/autotests/integration/fractional_scaling_test.cpp index 9d153da537..d296b563a7 100644 --- a/autotests/integration/fractional_scaling_test.cpp +++ b/autotests/integration/fractional_scaling_test.cpp @@ -10,6 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" +#include "pointer_input.h" #include "wayland/clientconnection.h" #include "wayland/display.h" #include "wayland_server.h" @@ -75,7 +76,7 @@ void TestFractionalScale::init() workspace()->setActiveOutput(QPoint(640, 512)); // put mouse in the middle of screen one - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TestFractionalScale::cleanup() diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index 626473ef68..f14c4b80ef 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -9,10 +9,10 @@ #include "kwin_wayland_test.h" #include "core/outputbackend.h" -#include "cursor.h" #include "input.h" #include "internalwindow.h" #include "keyboard_input.h" +#include "pointer_input.h" #include "useractions.h" #include "wayland/keyboard_interface.h" #include "wayland/seat_interface.h" @@ -76,7 +76,7 @@ void GlobalShortcutsTest::init() { QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); auto xkb = input()->keyboard()->xkb(); xkb->switchToLayout(0); diff --git a/autotests/integration/input_stacking_order.cpp b/autotests/integration/input_stacking_order.cpp index 7857b0c16b..488ee2ad4d 100644 --- a/autotests/integration/input_stacking_order.cpp +++ b/autotests/integration/input_stacking_order.cpp @@ -10,8 +10,8 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" +#include "pointer_input.h" #include "wayland/seat_interface.h" #include "wayland_server.h" #include "window.h" @@ -68,7 +68,7 @@ void InputStackingOrderTest::init() QVERIFY(Test::waitForWaylandPointer()); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void InputStackingOrderTest::cleanup() diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index 0e8d9e3eeb..80506fa248 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -10,11 +10,11 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" #include "effects.h" #include "inputmethod.h" #include "keyboard_input.h" +#include "pointer_input.h" #include "qwayland-input-method-unstable-v1.h" #include "qwayland-text-input-unstable-v3.h" #include "virtualkeyboard_dbus.h" @@ -98,11 +98,12 @@ void InputMethodTest::initTestCase() void InputMethodTest::init() { - touchNow(); - QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::TextInputManagerV2 | Test::AdditionalWaylandInterface::InputMethodV1 | Test::AdditionalWaylandInterface::TextInputManagerV3)); - workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); + + touchNow(); + + QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::TextInputManagerV2 | Test::AdditionalWaylandInterface::InputMethodV1 | Test::AdditionalWaylandInterface::TextInputManagerV3)); kwinApp()->inputMethod()->setEnabled(true); } diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp index fb4544d3b2..1987ca88e5 100644 --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -10,10 +10,10 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" #include "effects.h" #include "internalwindow.h" +#include "pointer_input.h" #include "wayland/surface_interface.h" #include "wayland_server.h" #include "workspace.h" @@ -188,7 +188,7 @@ void InternalWindowTest::initTestCase() void InternalWindowTest::init() { - Cursors::self()->mouse()->setPos(QPoint(512, 512)); + input()->pointer()->warp(QPoint(512, 512)); QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat)); QVERIFY(Test::waitForWaylandKeyboard()); } @@ -572,7 +572,7 @@ void InternalWindowTest::testModifierClickUnrestrictedMove() QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); // move cursor on window - Cursors::self()->mouse()->setPos(internalWindow->frameGeometry().center()); + input()->pointer()->warp(internalWindow->frameGeometry().center()); // simulate modifier+click quint32 timestamp = 1; @@ -607,7 +607,7 @@ void InternalWindowTest::testModifierScroll() workspace()->slotReconfigure(); // move cursor on window - Cursors::self()->mouse()->setPos(internalWindow->frameGeometry().center()); + input()->pointer()->warp(internalWindow->frameGeometry().center()); // set the opacity to 0.5 internalWindow->setOpacity(0.5); diff --git a/autotests/integration/kwinbindings_test.cpp b/autotests/integration/kwinbindings_test.cpp index 5a4440bcd2..b868e7189a 100644 --- a/autotests/integration/kwinbindings_test.cpp +++ b/autotests/integration/kwinbindings_test.cpp @@ -9,8 +9,8 @@ #include "kwin_wayland_test.h" #include "core/outputbackend.h" -#include "cursor.h" #include "input.h" +#include "pointer_input.h" #include "scripting/scripting.h" #include "useractions.h" #include "virtualdesktops.h" @@ -59,7 +59,7 @@ void KWinBindingsTest::init() { QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void KWinBindingsTest::cleanup() diff --git a/autotests/integration/layershellv1window_test.cpp b/autotests/integration/layershellv1window_test.cpp index 8d247b371d..c0bf314c12 100644 --- a/autotests/integration/layershellv1window_test.cpp +++ b/autotests/integration/layershellv1window_test.cpp @@ -9,6 +9,7 @@ #include "core/output.h" #include "core/outputbackend.h" #include "main.h" +#include "pointer_input.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" @@ -70,7 +71,7 @@ void LayerShellV1WindowTest::init() QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::LayerShellV1)); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void LayerShellV1WindowTest::cleanup() diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp index 38ee875f60..856f396b75 100644 --- a/autotests/integration/lockscreen.cpp +++ b/autotests/integration/lockscreen.cpp @@ -12,7 +12,7 @@ #include "core/output.h" #include "core/outputbackend.h" #include "core/renderbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "screenedge.h" #include "wayland/keyboard_interface.h" #include "wayland/seat_interface.h" @@ -203,7 +203,7 @@ void LockScreenTest::init() m_seat = Test::waylandSeat(); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void LockScreenTest::cleanup() diff --git a/autotests/integration/maximize_test.cpp b/autotests/integration/maximize_test.cpp index 6db9f8252c..475e057e6b 100644 --- a/autotests/integration/maximize_test.cpp +++ b/autotests/integration/maximize_test.cpp @@ -10,9 +10,9 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "decorations/decorationbridge.h" #include "decorations/settings.h" +#include "pointer_input.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" @@ -66,7 +66,7 @@ void TestMaximized::init() QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1 | Test::AdditionalWaylandInterface::PlasmaShell)); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TestMaximized::cleanup() diff --git a/autotests/integration/modifier_only_shortcut_test.cpp b/autotests/integration/modifier_only_shortcut_test.cpp index 7823aee588..a0260e2458 100644 --- a/autotests/integration/modifier_only_shortcut_test.cpp +++ b/autotests/integration/modifier_only_shortcut_test.cpp @@ -11,9 +11,9 @@ #include "kwin_wayland_test.h" #include "core/outputbackend.h" -#include "cursor.h" #include "input.h" #include "keyboard_input.h" +#include "pointer_input.h" #include "wayland_server.h" #include "workspace.h" #include "xkb.h" @@ -96,7 +96,7 @@ void ModifierOnlyShortcutTest::initTestCase() void ModifierOnlyShortcutTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void ModifierOnlyShortcutTest::cleanup() diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index e522a1df11..405eb9ed61 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -16,6 +16,7 @@ #include "deleted.h" #include "effects.h" #include "placement.h" +#include "pointer_input.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" @@ -510,7 +511,7 @@ void MoveResizeWindowTest::testPointerMoveEnd() } void MoveResizeWindowTest::testClientSideMove() { - Cursors::self()->mouse()->setPos(640, 512); + input()->pointer()->warp(QPointF(640, 512)); std::unique_ptr pointer(Test::waylandSeat()->createPointer()); QSignalSpy pointerEnteredSpy(pointer.get(), &KWayland::Client::Pointer::entered); QSignalSpy pointerLeftSpy(pointer.get(), &KWayland::Client::Pointer::left); @@ -523,7 +524,7 @@ void MoveResizeWindowTest::testClientSideMove() // move pointer into center of geometry const QRectF startGeometry = window->frameGeometry(); - Cursors::self()->mouse()->setPos(startGeometry.center()); + input()->pointer()->warp(startGeometry.center()); QVERIFY(pointerEnteredSpy.wait()); QCOMPARE(pointerEnteredSpy.first().last().toPoint(), QPoint(50, 25)); // simulate press @@ -619,7 +620,7 @@ void MoveResizeWindowTest::testNetMove() const QRectF origGeo = window->frameGeometry(); // let's move the cursor outside the window - Cursors::self()->mouse()->setPos(workspace()->activeOutput()->geometry().center()); + input()->pointer()->warp(workspace()->activeOutput()->geometry().center()); QVERIFY(!origGeo.contains(Cursors::self()->mouse()->pos())); QSignalSpy moveStartSpy(window, &X11Window::clientStartUserMovedResized); @@ -639,7 +640,7 @@ void MoveResizeWindowTest::testNetMove() QCOMPARE(Cursors::self()->mouse()->pos(), origGeo.center()); // let's move a step - Cursors::self()->mouse()->setPos(Cursors::self()->mouse()->pos() + QPoint(10, 10)); + input()->pointer()->warp(Cursors::self()->mouse()->pos() + QPoint(10, 10)); QCOMPARE(moveStepSpy.count(), 1); QCOMPARE(moveStepSpy.first().last(), origGeo.translated(10, 10)); diff --git a/autotests/integration/no_global_shortcuts_test.cpp b/autotests/integration/no_global_shortcuts_test.cpp index 9905a7c9d6..29b68a9d53 100644 --- a/autotests/integration/no_global_shortcuts_test.cpp +++ b/autotests/integration/no_global_shortcuts_test.cpp @@ -9,9 +9,9 @@ #include "kwin_wayland_test.h" #include "core/outputbackend.h" -#include "cursor.h" #include "input.h" #include "keyboard_input.h" +#include "pointer_input.h" #include "screenedge.h" #include "wayland_server.h" #include "workspace.h" @@ -104,7 +104,7 @@ void NoGlobalShortcutsTest::initTestCase() void NoGlobalShortcutsTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void NoGlobalShortcutsTest::cleanup() diff --git a/autotests/integration/outputchanges_test.cpp b/autotests/integration/outputchanges_test.cpp index 9ba023607c..fb9b4a5424 100644 --- a/autotests/integration/outputchanges_test.cpp +++ b/autotests/integration/outputchanges_test.cpp @@ -9,7 +9,7 @@ #include "core/output.h" #include "core/outputbackend.h" #include "core/outputconfiguration.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" @@ -67,7 +67,7 @@ void OutputChangesTest::init() QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void OutputChangesTest::cleanup() diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp index 1b4f1cd757..e34aadf08d 100644 --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -11,8 +11,8 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "placement.h" +#include "pointer_input.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" @@ -66,7 +66,7 @@ void TestPlacement::init() QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::PlasmaShell)); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TestPlacement::cleanup() @@ -240,7 +240,7 @@ void TestPlacement::testPlaceUnderMouse() group.sync(); workspace()->slotReconfigure(); - KWin::Cursors::self()->mouse()->setPos(QPoint(200, 300)); + KWin::input()->pointer()->warp(QPoint(200, 300)); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), QPoint(200, 300)); std::unique_ptr surface(Test::createSurface()); diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp index b70564b9f9..c9345e08e0 100644 --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "virtualdesktops.h" #include "wayland_server.h" #include "window.h" @@ -73,7 +73,7 @@ void PlasmaSurfaceTest::init() m_compositor = Test::waylandCompositor(); m_plasmaShell = Test::waylandPlasmaShell(); - KWin::Cursors::self()->mouse()->setPos(640, 512); + KWin::input()->pointer()->warp(QPointF(640, 512)); } void PlasmaSurfaceTest::cleanup() @@ -350,7 +350,7 @@ void PlasmaSurfaceTest::testPanelWindowsCanCover() QSignalSpy stackingOrderChangedSpy(workspace(), &Workspace::stackingOrderChanged); // trigger screenedge QFETCH(QPoint, triggerPoint); - KWin::Cursors::self()->mouse()->setPos(triggerPoint); + KWin::input()->pointer()->warp(triggerPoint); QVERIFY(stackingOrderChangedSpy.wait()); QCOMPARE(stackingOrderChangedSpy.count(), 1); stackingOrder = workspace()->stackingOrder(); diff --git a/autotests/integration/plasmawindow_test.cpp b/autotests/integration/plasmawindow_test.cpp index 0b93b91970..45f189d77c 100644 --- a/autotests/integration/plasmawindow_test.cpp +++ b/autotests/integration/plasmawindow_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland/seat_interface.h" #include "wayland_server.h" #include "workspace.h" @@ -78,7 +78,7 @@ void PlasmaWindowTest::init() m_compositor = Test::waylandCompositor(); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void PlasmaWindowTest::cleanup() diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp index f9cd920d2b..4cc62b6292 100644 --- a/autotests/integration/pointer_constraints_test.cpp +++ b/autotests/integration/pointer_constraints_test.cpp @@ -83,7 +83,7 @@ void TestPointerConstraints::init() QVERIFY(Test::waitForWaylandPointer()); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TestPointerConstraints::cleanup() @@ -136,30 +136,30 @@ void TestPointerConstraints::testConfinedPointer() // now let's confine QCOMPARE(input()->pointer()->isConstrained(), false); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(input()->pointer()->isConstrained(), true); QVERIFY(confinedSpy.wait()); // picking a position outside the window geometry should not move pointer QSignalSpy pointerPositionChangedSpy(input(), &InputRedirection::globalPointerChanged); - KWin::Cursors::self()->mouse()->setPos(QPoint(512, 512)); + KWin::input()->pointer()->warp(QPoint(512, 512)); QVERIFY(pointerPositionChangedSpy.isEmpty()); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), window->frameGeometry().center()); // TODO: test relative motion QFETCH(PointerFunc, positionFunction); const QPointF position = positionFunction(window->frameGeometry()); - KWin::Cursors::self()->mouse()->setPos(position); + KWin::input()->pointer()->warp(position); QCOMPARE(pointerPositionChangedSpy.count(), 1); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), position); // moving one to right should not be possible QFETCH(int, xOffset); - KWin::Cursors::self()->mouse()->setPos(position + QPoint(xOffset, 0)); + KWin::input()->pointer()->warp(position + QPoint(xOffset, 0)); QCOMPARE(pointerPositionChangedSpy.count(), 1); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), position); // moving one to bottom should not be possible QFETCH(int, yOffset); - KWin::Cursors::self()->mouse()->setPos(position + QPoint(0, yOffset)); + KWin::input()->pointer()->warp(position + QPoint(0, yOffset)); QCOMPARE(pointerPositionChangedSpy.count(), 1); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), position); @@ -285,14 +285,14 @@ void TestPointerConstraints::testLockedPointer() // now let's lock QCOMPARE(input()->pointer()->isConstrained(), false); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), window->frameGeometry().center()); QCOMPARE(input()->pointer()->isConstrained(), true); QVERIFY(lockedSpy.wait()); // try to move the pointer // TODO: add relative pointer - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center() + QPoint(1, 1)); + KWin::input()->pointer()->warp(window->frameGeometry().center() + QPoint(1, 1)); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), window->frameGeometry().center()); // deactivate the window, this should unlock @@ -301,7 +301,7 @@ void TestPointerConstraints::testLockedPointer() QVERIFY(unlockedSpy.wait()); // moving cursor should be allowed again - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center() + QPoint(1, 1)); + KWin::input()->pointer()->warp(window->frameGeometry().center() + QPoint(1, 1)); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), window->frameGeometry().center() + QPoint(1, 1)); lockedPointer.reset(Test::waylandPointerConstraints()->lockPointer(surface.get(), pointer.get(), nullptr, KWayland::Client::PointerConstraints::LifeTime::Persistent)); @@ -314,7 +314,7 @@ void TestPointerConstraints::testLockedPointer() // try to move the pointer QCOMPARE(input()->pointer()->isConstrained(), true); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), window->frameGeometry().center() + QPoint(1, 1)); // delete pointer lock @@ -326,7 +326,7 @@ void TestPointerConstraints::testLockedPointer() // moving cursor should be allowed again QCOMPARE(input()->pointer()->isConstrained(), false); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), window->frameGeometry().center()); } @@ -347,7 +347,7 @@ void TestPointerConstraints::testCloseWindowWithLockedPointer() // now let's lock QCOMPARE(input()->pointer()->isConstrained(), false); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(KWin::Cursors::self()->mouse()->pos(), window->frameGeometry().center()); QCOMPARE(input()->pointer()->isConstrained(), true); QVERIFY(lockedSpy.wait()); diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index ed376c13c6..53398fbf49 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -166,7 +166,7 @@ void PointerInputTest::init() m_seat = Test::waylandSeat(); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void PointerInputTest::cleanup() @@ -207,7 +207,7 @@ void PointerInputTest::testWarpingUpdatesFocus() QVERIFY(!pointer->enteredSurface()); // enter - Cursors::self()->mouse()->setPos(QPoint(25, 25)); + input()->pointer()->warp(QPoint(25, 25)); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.count(), 1); QCOMPARE(enteredSpy.first().at(1).toPointF(), QPointF(25, 25)); @@ -217,7 +217,7 @@ void PointerInputTest::testWarpingUpdatesFocus() QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface()); // and out again - Cursors::self()->mouse()->setPos(QPoint(250, 250)); + input()->pointer()->warp(QPoint(250, 250)); QVERIFY(leftSpy.wait()); QCOMPARE(leftSpy.count(), 1); // there should not be a focused pointer surface anymore @@ -253,7 +253,7 @@ void PointerInputTest::testWarpingGeneratesPointerMotion() QCOMPARE(enteredSpy.first().at(1).toPointF(), QPointF(25, 25)); // now warp - Cursors::self()->mouse()->setPos(QPoint(26, 26)); + input()->pointer()->warp(QPoint(26, 26)); QVERIFY(movedSpy.wait()); QCOMPARE(movedSpy.count(), 1); QCOMPARE(movedSpy.last().first().toPointF(), QPointF(26, 26)); @@ -271,7 +271,7 @@ void PointerInputTest::testWarpingDuringFilter() QSignalSpy movedSpy(pointer, &KWayland::Client::Pointer::motion); // warp cursor into expected geometry - Cursors::self()->mouse()->setPos(10, 10); + input()->pointer()->warp(QPointF(10, 10)); // create a window QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded); @@ -370,7 +370,7 @@ void PointerInputTest::testUpdateFocusAfterScreenChange() QCOMPARE(enteredSpy.count(), 1); // move the cursor to the second screen - Cursors::self()->mouse()->setPos(1500, 300); + input()->pointer()->warp(QPointF(1500, 300)); QVERIFY(!window->frameGeometry().contains(Cursors::self()->mouse()->pos())); QVERIFY(leftSpy.wait()); @@ -554,7 +554,7 @@ void PointerInputTest::testModifierClickUnrestrictedMove() QVERIFY(window); // move cursor on window - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); // simulate modifier+click quint32 timestamp = 1; @@ -619,7 +619,7 @@ void PointerInputTest::testModifierClickUnrestrictedFullscreenMove() QVERIFY(window->isFullScreen()); // move cursor on window - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); // simulate modifier+click quint32 timestamp = 1; @@ -675,7 +675,7 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled( QVERIFY(workspace()->globalShortcutsDisabled()); // move cursor on window - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); // simulate modifier+click quint32 timestamp = 1; @@ -744,7 +744,7 @@ void PointerInputTest::testModifierScrollOpacity() QCOMPARE(window->opacity(), 0.5); // move cursor on window - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); // simulate modifier+wheel quint32 timestamp = 1; @@ -801,7 +801,7 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled() QCOMPARE(window->opacity(), 0.5); // move cursor on window - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); // disable global shortcuts QVERIFY(!workspace()->globalShortcutsDisabled()); @@ -854,7 +854,7 @@ void PointerInputTest::testScrollAction() QVERIFY(window1 != window2); // move cursor to the inactive window - Cursors::self()->mouse()->setPos(window1->frameGeometry().center()); + input()->pointer()->warp(window1->frameGeometry().center()); quint32 timestamp = 1; QVERIFY(!window1->isActive()); @@ -872,7 +872,7 @@ void PointerInputTest::testFocusFollowsMouse() QVERIFY(pointer); QVERIFY(pointer->isValid()); // move cursor out of the way of first window to be created - Cursors::self()->mouse()->setPos(900, 900); + input()->pointer()->warp(QPointF(900, 900)); // first modify the config for this run KConfigGroup group = kwinApp()->config()->group("Windows"); @@ -921,18 +921,18 @@ void PointerInputTest::testFocusFollowsMouse() // move on top of first window QVERIFY(window1->frameGeometry().contains(10, 10)); QVERIFY(!window2->frameGeometry().contains(10, 10)); - Cursors::self()->mouse()->setPos(10, 10); + input()->pointer()->warp(QPointF(10, 10)); QVERIFY(stackingOrderChangedSpy.wait()); QCOMPARE(stackingOrderChangedSpy.count(), 1); QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window1); QTRY_VERIFY(window1->isActive()); // move on second window, but move away before active window change delay hits - Cursors::self()->mouse()->setPos(810, 810); + input()->pointer()->warp(QPointF(810, 810)); QVERIFY(stackingOrderChangedSpy.wait()); QCOMPARE(stackingOrderChangedSpy.count(), 2); QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window2); - Cursors::self()->mouse()->setPos(10, 10); + input()->pointer()->warp(QPointF(10, 10)); QVERIFY(!activeWindowChangedSpy.wait(250)); QVERIFY(window1->isActive()); QCOMPARE(workspace()->topWindowOnDesktop(VirtualDesktopManager::self()->currentDesktop()), window1); @@ -940,8 +940,8 @@ void PointerInputTest::testFocusFollowsMouse() QCOMPARE(stackingOrderChangedSpy.count(), 3); // quickly move on window 2 and back on window 1 should not raise window 2 - Cursors::self()->mouse()->setPos(810, 810); - Cursors::self()->mouse()->setPos(10, 10); + input()->pointer()->warp(QPointF(810, 810)); + input()->pointer()->warp(QPointF(10, 10)); QVERIFY(!stackingOrderChangedSpy.wait(250)); } @@ -1003,7 +1003,7 @@ void PointerInputTest::testMouseActionInactiveWindow() // move on top of first window QVERIFY(window1->frameGeometry().contains(10, 10)); QVERIFY(!window2->frameGeometry().contains(10, 10)); - Cursors::self()->mouse()->setPos(10, 10); + input()->pointer()->warp(QPointF(10, 10)); // no focus follows mouse QVERIFY(!stackingOrderChangedSpy.wait(200)); QVERIFY(stackingOrderChangedSpy.isEmpty()); @@ -1090,7 +1090,7 @@ void PointerInputTest::testMouseActionActiveWindow() // move on top of second window QVERIFY(!window1->frameGeometry().contains(900, 900)); QVERIFY(window2->frameGeometry().contains(900, 900)); - Cursors::self()->mouse()->setPos(900, 900); + input()->pointer()->warp(QPointF(900, 900)); // and click quint32 timestamp = 1; @@ -1127,7 +1127,7 @@ void PointerInputTest::testCursorImage() // move cursor somewhere the new window won't open auto cursor = Cursors::self()->mouse(); - cursor->setPos(800, 800); + input()->pointer()->warp(QPointF(800, 800)); auto p = input()->pointer(); // at the moment it should be the fallback cursor const QImage fallbackCursor = cursor->image(); @@ -1145,7 +1145,7 @@ void PointerInputTest::testCursorImage() QVERIFY(window); // move cursor to center of window, this should first set a null pointer, so we still show old cursor - cursor->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(p->focus(), window); QCOMPARE(cursor->image(), fallbackCursor); QVERIFY(enteredSpy.wait()); @@ -1199,7 +1199,7 @@ void PointerInputTest::testCursorImage() QTRY_VERIFY(cursor->image().isNull()); // move cursor somewhere else, should reset to fallback cursor - Cursors::self()->mouse()->setPos(window->frameGeometry().bottomLeft() + QPoint(20, 20)); + input()->pointer()->warp(window->frameGeometry().bottomLeft() + QPoint(20, 20)); QVERIFY(!p->focus()); QVERIFY(!cursor->image().isNull()); QCOMPARE(cursor->image(), fallbackCursor); @@ -1229,7 +1229,7 @@ void PointerInputTest::testEffectOverrideCursorImage() QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered); QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left); // move cursor somewhere the new window won't open - cursor->setPos(800, 800); + input()->pointer()->warp(QPointF(800, 800)); // here we should have the fallback cursor const QImage fallback = cursor->image(); QVERIFY(!fallback.isNull()); @@ -1247,7 +1247,7 @@ void PointerInputTest::testEffectOverrideCursorImage() // and move cursor to the window QVERIFY(!window->frameGeometry().contains(QPoint(800, 800))); - cursor->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); QVERIFY(enteredSpy.wait()); // cursor image should still be fallback QCOMPARE(cursor->image(), fallback); @@ -1269,7 +1269,7 @@ void PointerInputTest::testEffectOverrideCursorImage() QCOMPARE(cursor->image(), sizeAll); // move cursor outside the window area - Cursors::self()->mouse()->setPos(800, 800); + input()->pointer()->warp(QPointF(800, 800)); // and end the override, which should switch to fallback effects->stopMouseInterception(effect.get()); QCOMPARE(cursor->image(), fallback); @@ -1279,7 +1279,7 @@ void PointerInputTest::testEffectOverrideCursorImage() QCOMPARE(cursor->image(), sizeAll); // move cursor to area of window - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); // this should not result in an enter event QVERIFY(!enteredSpy.wait(100)); @@ -1303,7 +1303,7 @@ void PointerInputTest::testPopup() QSignalSpy buttonStateChangedSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged); QSignalSpy motionSpy(pointer, &KWayland::Client::Pointer::motion); - Cursors::self()->mouse()->setPos(800, 800); + input()->pointer()->warp(QPointF(800, 800)); QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded); std::unique_ptr surface = Test::createSurface(); @@ -1317,7 +1317,7 @@ void PointerInputTest::testPopup() QCOMPARE(window->hasPopupGrab(), false); // move pointer into window QVERIFY(!window->frameGeometry().contains(QPoint(800, 800))); - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); QVERIFY(enteredSpy.wait()); // click inside window to create serial quint32 timestamp = 0; @@ -1348,7 +1348,7 @@ void PointerInputTest::testPopup() QCOMPARE(popupWindow->hasPopupGrab(), true); // let's move the pointer into the center of the window - Cursors::self()->mouse()->setPos(popupWindow->frameGeometry().center()); + input()->pointer()->warp(popupWindow->frameGeometry().center()); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.count(), 2); QCOMPARE(leftSpy.count(), 1); @@ -1356,7 +1356,7 @@ void PointerInputTest::testPopup() // let's move the pointer outside of the popup window // this should not really change anything, it gets a leave event - Cursors::self()->mouse()->setPos(popupWindow->frameGeometry().bottomRight() + QPoint(2, 2)); + input()->pointer()->warp(popupWindow->frameGeometry().bottomRight() + QPoint(2, 2)); QVERIFY(leftSpy.wait()); QCOMPARE(leftSpy.count(), 2); QVERIFY(doneReceivedSpy.isEmpty()); @@ -1380,7 +1380,7 @@ void PointerInputTest::testDecoCancelsPopup() QSignalSpy buttonStateChangedSpy(pointer, &KWayland::Client::Pointer::buttonStateChanged); QSignalSpy motionSpy(pointer, &KWayland::Client::Pointer::motion); - Cursors::self()->mouse()->setPos(800, 800); + input()->pointer()->warp(QPointF(800, 800)); // create a decorated window std::unique_ptr surface(Test::createSurface()); @@ -1398,7 +1398,7 @@ void PointerInputTest::testDecoCancelsPopup() // move pointer into window QVERIFY(!window->frameGeometry().contains(QPoint(800, 800))); - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); QVERIFY(enteredSpy.wait()); // click inside window to create serial quint32 timestamp = 0; @@ -1427,7 +1427,7 @@ void PointerInputTest::testDecoCancelsPopup() QCOMPARE(popupWindow->hasPopupGrab(), true); // let's move the pointer into the center of the deco - Cursors::self()->mouse()->setPos(window->frameGeometry().center().x(), window->y() + (window->height() - window->clientSize().height()) / 2); + input()->pointer()->warp(QPointF(window->frameGeometry().center().x(), window->y() + (window->height() - window->clientSize().height()) / 2)); Test::pointerButtonPressed(BTN_RIGHT, timestamp++); QVERIFY(doneReceivedSpy.wait()); @@ -1447,7 +1447,7 @@ void PointerInputTest::testWindowUnderCursorWhileButtonPressed() QSignalSpy enteredSpy(pointer, &KWayland::Client::Pointer::entered); QSignalSpy leftSpy(pointer, &KWayland::Client::Pointer::left); - Cursors::self()->mouse()->setPos(800, 800); + input()->pointer()->warp(QPointF(800, 800)); QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded); std::unique_ptr surface = Test::createSurface(); QVERIFY(surface); @@ -1460,7 +1460,7 @@ void PointerInputTest::testWindowUnderCursorWhileButtonPressed() // move cursor over window QVERIFY(!window->frameGeometry().contains(QPoint(800, 800))); - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); QVERIFY(enteredSpy.wait()); // click inside window quint32 timestamp = 0; @@ -1570,7 +1570,7 @@ void PointerInputTest::testConfineToScreenGeometry() // move pointer to initial position QFETCH(QPoint, startPos); - Cursors::self()->mouse()->setPos(startPos); + input()->pointer()->warp(startPos); QCOMPARE(Cursors::self()->mouse()->pos(), startPos); // perform movement @@ -1649,7 +1649,7 @@ void PointerInputTest::testResizeCursor() cursorPos.setY(window->frameGeometry().center().y()); } - Cursors::self()->mouse()->setPos(cursorPos); + input()->pointer()->warp(cursorPos); // wait for the enter event and set the cursor QVERIFY(enteredSpy.wait()); @@ -1717,7 +1717,7 @@ void PointerInputTest::testMoveCursor() QVERIFY(window); // move cursor to the test position - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); // wait for the enter event and set the cursor QVERIFY(enteredSpy.wait()); @@ -1788,7 +1788,7 @@ void PointerInputTest::testDefaultInputRegion() QVERIFY(window); // Move the point to the center of the surface. - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface()); // Destroy the test window. @@ -1811,7 +1811,7 @@ void PointerInputTest::testEmptyInputRegion() QVERIFY(window); // Move the point to the center of the surface. - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center()); QVERIFY(!waylandServer()->seat()->focusedPointerSurface()); // Destroy the test window. diff --git a/autotests/integration/quick_tiling_test.cpp b/autotests/integration/quick_tiling_test.cpp index e8990ea11f..594a5e6d38 100644 --- a/autotests/integration/quick_tiling_test.cpp +++ b/autotests/integration/quick_tiling_test.cpp @@ -13,6 +13,7 @@ #include "cursor.h" #include "decorations/decorationbridge.h" #include "decorations/settings.h" +#include "pointer_input.h" #include "scripting/scripting.h" #include "utils/common.h" #include "wayland_server.h" @@ -113,7 +114,7 @@ void QuickTilingTest::init() m_compositor = Test::waylandCompositor(); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void QuickTilingTest::cleanup() diff --git a/autotests/integration/screen_changes_test.cpp b/autotests/integration/screen_changes_test.cpp index 652bcb4298..7d9beb6a61 100644 --- a/autotests/integration/screen_changes_test.cpp +++ b/autotests/integration/screen_changes_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "workspace.h" @@ -49,7 +49,7 @@ void ScreenChangesTest::init() QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void ScreenChangesTest::cleanup() diff --git a/autotests/integration/screenedge_client_show_test.cpp b/autotests/integration/screenedge_client_show_test.cpp index 55e47190da..ebd0b42c15 100644 --- a/autotests/integration/screenedge_client_show_test.cpp +++ b/autotests/integration/screenedge_client_show_test.cpp @@ -10,8 +10,8 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" +#include "pointer_input.h" #include "screenedge.h" #include "wayland_server.h" #include "workspace.h" @@ -66,7 +66,7 @@ void ScreenEdgeClientShowTest::initTestCase() void ScreenEdgeClientShowTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); QVERIFY(waylandServer()->windows().isEmpty()); } @@ -140,7 +140,7 @@ void ScreenEdgeClientShowTest::testScreenEdgeShowHideX11() // now trigger the edge QSignalSpy effectsWindowShownSpy(effects, &EffectsHandler::windowShown); QFETCH(QPoint, triggerPos); - Cursors::self()->mouse()->setPos(triggerPos); + input()->pointer()->warp(triggerPos); QVERIFY(!window->isHiddenInternal()); QCOMPARE(effectsWindowShownSpy.count(), 1); @@ -148,7 +148,7 @@ void ScreenEdgeClientShowTest::testScreenEdgeShowHideX11() QTest::qWait(1); // hide window again - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); xcb_change_property(c.get(), XCB_PROP_MODE_REPLACE, windowId, atom, XCB_ATOM_CARDINAL, 32, 1, &location); xcb_flush(c.get()); QVERIFY(clientHiddenSpy.wait()); @@ -157,7 +157,7 @@ void ScreenEdgeClientShowTest::testScreenEdgeShowHideX11() // resizewhile hidden window->moveResize(resizedWindowGeometry); // triggerPos shouldn't be valid anymore - Cursors::self()->mouse()->setPos(triggerPos); + input()->pointer()->warp(triggerPos); QVERIFY(window->isHiddenInternal()); // destroy window again diff --git a/autotests/integration/screenedges_test.cpp b/autotests/integration/screenedges_test.cpp index 9e59154fbd..6949908ed1 100644 --- a/autotests/integration/screenedges_test.cpp +++ b/autotests/integration/screenedges_test.cpp @@ -14,6 +14,7 @@ #include "cursor.h" #include "effectloader.h" #include "main.h" +#include "pointer_input.h" #include "screenedge.h" #include "wayland_server.h" #include "window.h" @@ -92,7 +93,7 @@ void ScreenEdgesTest::init() { workspace()->screenEdges()->recreateEdges(); Workspace::self()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); QVERIFY(Test::setupWaylandConnection()); } diff --git a/autotests/integration/screens_test.cpp b/autotests/integration/screens_test.cpp index 57e99907ee..3ec4ec6de2 100644 --- a/autotests/integration/screens_test.cpp +++ b/autotests/integration/screens_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" @@ -59,7 +59,7 @@ void ScreensTest::initTestCase() void ScreensTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); QVERIFY(Test::setupWaylandConnection()); } @@ -134,7 +134,7 @@ void ScreensTest::testCurrentWithFollowsMouse() QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, geometries)); QFETCH(QPoint, cursorPos); - KWin::Cursors::self()->mouse()->setPos(cursorPos); + KWin::input()->pointer()->warp(cursorPos); QFETCH(int, expectedId); Output *expected = workspace()->outputs().at(expectedId); diff --git a/autotests/integration/scripting/screenedge_test.cpp b/autotests/integration/scripting/screenedge_test.cpp index 5f1c28dd6a..bcc2b4d6ba 100644 --- a/autotests/integration/scripting/screenedge_test.cpp +++ b/autotests/integration/scripting/screenedge_test.cpp @@ -9,8 +9,8 @@ #include "kwin_wayland_test.h" #include "core/outputbackend.h" -#include "cursor.h" #include "effectloader.h" +#include "pointer_input.h" #include "scripting/scripting.h" #include "wayland_server.h" #include "workspace.h" @@ -79,7 +79,7 @@ void ScreenEdgeTest::initTestCase() void ScreenEdgeTest::init() { - KWin::Cursors::self()->mouse()->setPos(640, 512); + KWin::input()->pointer()->warp(QPointF(640, 512)); if (workspace()->showingDesktop()) { workspace()->slotToggleShowDesktop(); } @@ -145,7 +145,7 @@ void ScreenEdgeTest::testEdge() // trigger the edge QFETCH(QPoint, triggerPos); - KWin::Cursors::self()->mouse()->setPos(triggerPos); + KWin::input()->pointer()->warp(triggerPos); QCOMPARE(showDesktopSpy.count(), 1); QVERIFY(workspace()->showingDesktop()); } @@ -226,27 +226,27 @@ void ScreenEdgeTest::testEdgeUnregister() QSignalSpy showDesktopSpy(workspace(), &Workspace::showingDesktopChanged); // trigger the edge - KWin::Cursors::self()->mouse()->setPos(triggerPos); + KWin::input()->pointer()->warp(triggerPos); QCOMPARE(showDesktopSpy.count(), 1); // reset - KWin::Cursors::self()->mouse()->setPos(500, 500); + KWin::input()->pointer()->warp(QPointF(500, 500)); workspace()->slotToggleShowDesktop(); showDesktopSpy.clear(); // trigger again, to show that retriggering works - KWin::Cursors::self()->mouse()->setPos(triggerPos); + KWin::input()->pointer()->warp(triggerPos); QCOMPARE(showDesktopSpy.count(), 1); // reset - KWin::Cursors::self()->mouse()->setPos(500, 500); + KWin::input()->pointer()->warp(QPointF(500, 500)); workspace()->slotToggleShowDesktop(); showDesktopSpy.clear(); // make the script unregister the edge configGroup.writeEntry("mode", "unregister"); triggerConfigReload(); - KWin::Cursors::self()->mouse()->setPos(triggerPos); + KWin::input()->pointer()->warp(triggerPos); QCOMPARE(showDesktopSpy.count(), 0); // not triggered // force the script to unregister a non-registered edge to prove it doesn't explode diff --git a/autotests/integration/shade_test.cpp b/autotests/integration/shade_test.cpp index 3029b5de57..9dea639596 100644 --- a/autotests/integration/shade_test.cpp +++ b/autotests/integration/shade_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland_server.h" #include "workspace.h" #include "x11window.h" @@ -54,7 +54,7 @@ void ShadeTest::initTestCase() void ShadeTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void ShadeTest::testShadeGeometry() diff --git a/autotests/integration/struts_test.cpp b/autotests/integration/struts_test.cpp index 6c25b2eafe..018d5a7799 100644 --- a/autotests/integration/struts_test.cpp +++ b/autotests/integration/struts_test.cpp @@ -10,8 +10,8 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" +#include "pointer_input.h" #include "screenedge.h" #include "virtualdesktops.h" #include "wayland_server.h" @@ -89,7 +89,7 @@ void StrutsTest::init() m_plasmaShell = Test::waylandPlasmaShell(); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); QVERIFY(waylandServer()->windows().isEmpty()); } @@ -955,7 +955,7 @@ void StrutsTest::testWindowMoveWithPanelBetweenScreens() QCOMPARE(window2->pos(), QPoint(1500, 400)); const QRectF origGeo = window2->frameGeometry(); - Cursors::self()->mouse()->setPos(origGeo.center()); + input()->pointer()->warp(origGeo.center()); workspace()->performWindowOperation(window2, Options::MoveOp); QTRY_COMPARE(workspace()->moveResizeWindow(), window2); QVERIFY(window2->isInteractiveMove()); diff --git a/autotests/integration/tabbox_test.cpp b/autotests/integration/tabbox_test.cpp index de54759170..8b8b652dd9 100644 --- a/autotests/integration/tabbox_test.cpp +++ b/autotests/integration/tabbox_test.cpp @@ -9,8 +9,8 @@ #include "kwin_wayland_test.h" #include "core/outputbackend.h" -#include "cursor.h" #include "input.h" +#include "pointer_input.h" #include "tabbox/tabbox.h" #include "wayland_server.h" #include "window.h" @@ -59,7 +59,7 @@ void TabBoxTest::init() { QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TabBoxTest::cleanup() diff --git a/autotests/integration/tiles_test.cpp b/autotests/integration/tiles_test.cpp index 082272c4a1..733376c61d 100644 --- a/autotests/integration/tiles_test.cpp +++ b/autotests/integration/tiles_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "tiles/tilemanager.h" #include "wayland/seat_interface.h" #include "wayland/surface_interface.h" @@ -68,7 +68,7 @@ void TilesTest::init() QVERIFY(Test::waitForWaylandPointer()); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); m_output = workspace()->activeOutput(); m_tileManager = workspace()->tileManager(m_output); m_rootTile = m_tileManager->rootTile(); @@ -342,7 +342,7 @@ void TilesTest::resizeTileFromWindow() QVERIFY(states.testFlag(Test::XdgToplevel::State::Resizing)); // Trigger a change. QPoint cursorPos = window->frameGeometry().bottomRight().toPoint(); - Cursors::self()->mouse()->setPos(cursorPos + QPoint(8, 0)); + input()->pointer()->warp(cursorPos + QPoint(8, 0)); window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos()); QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0)); @@ -384,7 +384,7 @@ void TilesTest::resizeTileFromWindow() // Trigger a change. cursorPos = window->frameGeometry().bottomRight().toPoint(); - Cursors::self()->mouse()->setPos(cursorPos + QPoint(0, 8)); + input()->pointer()->warp(cursorPos + QPoint(0, 8)); window->updateInteractiveMoveResize(Cursors::self()->mouse()->pos()); QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(0, 8)); diff --git a/autotests/integration/touch_input_test.cpp b/autotests/integration/touch_input_test.cpp index 2b7192231d..c0d2843b2d 100644 --- a/autotests/integration/touch_input_test.cpp +++ b/autotests/integration/touch_input_test.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "touch_input.h" #include "wayland_server.h" #include "window.h" @@ -74,7 +74,7 @@ void TouchInputTest::init() QVERIFY(m_touch->isValid()); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void TouchInputTest::cleanup() diff --git a/autotests/integration/transient_placement.cpp b/autotests/integration/transient_placement.cpp index 2309173793..189296c3b8 100644 --- a/autotests/integration/transient_placement.cpp +++ b/autotests/integration/transient_placement.cpp @@ -10,7 +10,7 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" +#include "pointer_input.h" #include "wayland/seat_interface.h" #include "wayland/surface_interface.h" #include "wayland_server.h" @@ -79,7 +79,7 @@ void TransientPlacementTest::init() QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration | Test::AdditionalWaylandInterface::PlasmaShell)); workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); } void TransientPlacementTest::cleanup() diff --git a/autotests/integration/window_rules_test.cpp b/autotests/integration/window_rules_test.cpp index 40921d9afb..aca701b7c8 100644 --- a/autotests/integration/window_rules_test.cpp +++ b/autotests/integration/window_rules_test.cpp @@ -11,8 +11,8 @@ #include "atoms.h" #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" +#include "pointer_input.h" #include "rules.h" #include "wayland_server.h" #include "workspace.h" @@ -58,7 +58,7 @@ void WindowRuleTest::initTestCase() void WindowRuleTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); QVERIFY(waylandServer()->windows().isEmpty()); } diff --git a/autotests/integration/window_selection_test.cpp b/autotests/integration/window_selection_test.cpp index 05846b064d..0392820d17 100644 --- a/autotests/integration/window_selection_test.cpp +++ b/autotests/integration/window_selection_test.cpp @@ -10,7 +10,6 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "keyboard_input.h" #include "pointer_input.h" #include "wayland_server.h" @@ -72,7 +71,7 @@ void TestWindowSelection::init() QVERIFY(Test::waitForWaylandPointer()); workspace()->setActiveOutput(QPoint(640, 512)); - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TestWindowSelection::cleanup() @@ -95,7 +94,7 @@ void TestWindowSelection::testSelectOnWindowPointer() auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue); QVERIFY(window); QVERIFY(keyboardEnteredSpy.wait()); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(input()->pointer()->focus(), window); QVERIFY(pointerEnteredSpy.wait()); @@ -306,7 +305,7 @@ void TestWindowSelection::testCancelOnWindowPointer() auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue); QVERIFY(window); QVERIFY(keyboardEnteredSpy.wait()); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(input()->pointer()->focus(), window); QVERIFY(pointerEnteredSpy.wait()); @@ -361,7 +360,7 @@ void TestWindowSelection::testCancelOnWindowKeyboard() auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue); QVERIFY(window); QVERIFY(keyboardEnteredSpy.wait()); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(input()->pointer()->focus(), window); QVERIFY(pointerEnteredSpy.wait()); @@ -416,7 +415,7 @@ void TestWindowSelection::testSelectPointPointer() auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue); QVERIFY(window); QVERIFY(keyboardEnteredSpy.wait()); - KWin::Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + KWin::input()->pointer()->warp(window->frameGeometry().center()); QCOMPARE(input()->pointer()->focus(), window); QVERIFY(pointerEnteredSpy.wait()); diff --git a/autotests/integration/xdgshellwindow_test.cpp b/autotests/integration/xdgshellwindow_test.cpp index 70716e4943..8099863c6b 100644 --- a/autotests/integration/xdgshellwindow_test.cpp +++ b/autotests/integration/xdgshellwindow_test.cpp @@ -11,11 +11,11 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "decorations/decorationbridge.h" #include "decorations/settings.h" #include "deleted.h" #include "effects.h" +#include "pointer_input.h" #include "virtualdesktops.h" #include "wayland/clientconnection.h" #include "wayland/display.h" @@ -184,7 +184,7 @@ void TestXdgShellWindow::init() workspace()->setActiveOutput(QPoint(640, 512)); // put mouse in the middle of screen one - KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512)); + KWin::input()->pointer()->warp(QPoint(640, 512)); } void TestXdgShellWindow::cleanup() diff --git a/autotests/integration/xwayland_input_test.cpp b/autotests/integration/xwayland_input_test.cpp index 8f0f0e7b60..f36acece0c 100644 --- a/autotests/integration/xwayland_input_test.cpp +++ b/autotests/integration/xwayland_input_test.cpp @@ -10,8 +10,8 @@ #include "core/output.h" #include "core/outputbackend.h" -#include "cursor.h" #include "deleted.h" +#include "pointer_input.h" #include "wayland/seat_interface.h" #include "wayland_server.h" #include "workspace.h" @@ -57,7 +57,7 @@ void XWaylandInputTest::initTestCase() void XWaylandInputTest::init() { workspace()->setActiveOutput(QPoint(640, 512)); - Cursors::self()->mouse()->setPos(QPoint(640, 512)); + input()->pointer()->warp(QPoint(640, 512)); QVERIFY(waylandServer()->windows().isEmpty()); } @@ -165,13 +165,13 @@ void XWaylandInputTest::testPointerEnterLeaveSsd() // move pointer into the window, should trigger an enter QVERIFY(!window->frameGeometry().contains(Cursors::self()->mouse()->pos())); QVERIFY(enteredSpy.isEmpty()); - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center().toPoint()); QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface()); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.last().first().toPoint(), (window->frameGeometry().center() - QPointF(window->frameMargins().left(), window->frameMargins().top())).toPoint()); // move out of window - Cursors::self()->mouse()->setPos(window->frameGeometry().bottomRight() + QPointF(10, 10)); + input()->pointer()->warp(window->frameGeometry().bottomRight() + QPointF(10, 10)); QVERIFY(leftSpy.wait()); QCOMPARE(leftSpy.last().first().toPoint(), (window->frameGeometry().center() - QPointF(window->frameMargins().left(), window->frameMargins().top())).toPoint()); @@ -253,14 +253,14 @@ void XWaylandInputTest::testPointerEventLeaveCsd() // Move pointer into the window, should trigger an enter. QVERIFY(!window->frameGeometry().contains(Cursors::self()->mouse()->pos())); QVERIFY(enteredSpy.isEmpty()); - Cursors::self()->mouse()->setPos(window->frameGeometry().center()); + input()->pointer()->warp(window->frameGeometry().center().toPoint()); QCOMPARE(waylandServer()->seat()->focusedPointerSurface(), window->surface()); QVERIFY(enteredSpy.wait()); QCOMPARE(enteredSpy.last().first().toPoint(), QPoint(60, 105)); // Move out of the window, should trigger a leave. QVERIFY(leftSpy.isEmpty()); - Cursors::self()->mouse()->setPos(window->frameGeometry().bottomRight() + QPoint(100, 100)); + input()->pointer()->warp(window->frameGeometry().bottomRight() + QPoint(100, 100)); QVERIFY(leftSpy.wait()); QCOMPARE(leftSpy.last().first().toPoint(), QPoint(60, 105));