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.
This commit is contained in:
Vlad Zahorodnii 2023-02-09 15:07:56 +02:00
parent 160cc98597
commit f71ee59a37
43 changed files with 167 additions and 164 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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);

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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);

View file

@ -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()

View file

@ -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);

View file

@ -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()

View file

@ -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);
}

View file

@ -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);

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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()

View file

@ -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<KWayland::Client::Pointer> 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));

View file

@ -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()

View file

@ -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()

View file

@ -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<KWayland::Client::Surface> surface(Test::createSurface());

View file

@ -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();

View file

@ -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()

View file

@ -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());

View file

@ -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<KWayland::Client::Surface> 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<KWayland::Client::Surface> 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<KWayland::Client::Surface> 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.

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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());
}

View file

@ -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<QRect>, geometries));
QFETCH(QPoint, cursorPos);
KWin::Cursors::self()->mouse()->setPos(cursorPos);
KWin::input()->pointer()->warp(cursorPos);
QFETCH(int, expectedId);
Output *expected = workspace()->outputs().at(expectedId);

View file

@ -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

View file

@ -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()

View file

@ -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());

View file

@ -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()

View file

@ -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));

View file

@ -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()

View file

@ -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()

View file

@ -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());
}

View file

@ -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());

View file

@ -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()

View file

@ -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));