Commit 6abd23ed authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Make it possible to have a separate cursor for the tablet

Summary:
As is KWin only had 1 Cursor which was a singleton. This made it impossible for
us to properly implement the tablet (as in drawing tablets) support and show where
we're drawing.
This patch makes it possible to have different Cursors in KWin, it makes all the
current code still follow the mouse but the tablet can still render a cursor.

Test Plan: Tests pass, been using it and works as well as before but with beautiful tablet cursors.

Reviewers: #kwin, cblack, davidedmundson

Reviewed By: #kwin, cblack, davidedmundson

Subscribers: davidedmundson, cblack, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28155
parent 08a21ae7
...@@ -1430,14 +1430,14 @@ void AbstractClient::setupWindowManagementInterface() ...@@ -1430,14 +1430,14 @@ void AbstractClient::setupWindowManagementInterface()
connect(w, &PlasmaWindowInterface::closeRequested, this, [this] { closeWindow(); }); connect(w, &PlasmaWindowInterface::closeRequested, this, [this] { closeWindow(); });
connect(w, &PlasmaWindowInterface::moveRequested, this, connect(w, &PlasmaWindowInterface::moveRequested, this,
[this] { [this] {
Cursor::setPos(frameGeometry().center()); Cursors::self()->mouse()->setPos(frameGeometry().center());
performMouseCommand(Options::MouseMove, Cursor::pos()); performMouseCommand(Options::MouseMove, Cursors::self()->mouse()->pos());
} }
); );
connect(w, &PlasmaWindowInterface::resizeRequested, this, connect(w, &PlasmaWindowInterface::resizeRequested, this,
[this] { [this] {
Cursor::setPos(frameGeometry().bottomRight()); Cursors::self()->mouse()->setPos(frameGeometry().bottomRight());
performMouseCommand(Options::MouseResize, Cursor::pos()); performMouseCommand(Options::MouseResize, Cursors::self()->mouse()->pos());
} }
); );
connect(w, &PlasmaWindowInterface::virtualDesktopRequested, this, connect(w, &PlasmaWindowInterface::virtualDesktopRequested, this,
...@@ -2060,7 +2060,7 @@ void AbstractClient::keyPressEvent(uint key_code) ...@@ -2060,7 +2060,7 @@ void AbstractClient::keyPressEvent(uint key_code)
bool is_alt = key_code & Qt::ALT; bool is_alt = key_code & Qt::ALT;
key_code = key_code & ~Qt::KeyboardModifierMask; key_code = key_code & ~Qt::KeyboardModifierMask;
int delta = is_control ? 1 : is_alt ? 32 : 8; int delta = is_control ? 1 : is_alt ? 32 : 8;
QPoint pos = Cursor::pos(); QPoint pos = Cursors::self()->mouse()->pos();
switch(key_code) { switch(key_code) {
case Qt::Key_Left: case Qt::Key_Left:
pos.rx() -= delta; pos.rx() -= delta;
...@@ -2089,7 +2089,7 @@ void AbstractClient::keyPressEvent(uint key_code) ...@@ -2089,7 +2089,7 @@ void AbstractClient::keyPressEvent(uint key_code)
default: default:
return; return;
} }
Cursor::setPos(pos); Cursors::self()->mouse()->setPos(pos);
} }
QSize AbstractClient::resizeIncrements() const QSize AbstractClient::resizeIncrements() const
...@@ -2659,7 +2659,7 @@ void AbstractClient::setElectricBorderMaximizing(bool maximizing) ...@@ -2659,7 +2659,7 @@ void AbstractClient::setElectricBorderMaximizing(bool maximizing)
{ {
m_electricMaximizing = maximizing; m_electricMaximizing = maximizing;
if (maximizing) if (maximizing)
outline()->show(electricBorderMaximizeGeometry(Cursor::pos(), desktop()), moveResizeGeometry()); outline()->show(electricBorderMaximizeGeometry(Cursors::self()->mouse()->pos(), desktop()), moveResizeGeometry());
else else
outline()->hide(); outline()->hide();
elevate(maximizing); elevate(maximizing);
...@@ -2694,7 +2694,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard) ...@@ -2694,7 +2694,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard)
return; return;
} }
workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event workspace()->updateFocusMousePosition(Cursors::self()->mouse()->pos()); // may cause leave event
GeometryUpdatesBlocker blocker(this); GeometryUpdatesBlocker blocker(this);
...@@ -2736,7 +2736,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard) ...@@ -2736,7 +2736,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard)
setMaximize(false, false); setMaximize(false, false);
setFrameGeometry(electricBorderMaximizeGeometry(keyboard ? frameGeometry().center() : Cursor::pos(), desktop()), geom_mode); setFrameGeometry(electricBorderMaximizeGeometry(keyboard ? frameGeometry().center() : Cursors::self()->mouse()->pos(), desktop()), geom_mode);
// Store the mode change // Store the mode change
m_quickTileMode = mode; m_quickTileMode = mode;
} else { } else {
...@@ -2750,7 +2750,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard) ...@@ -2750,7 +2750,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard)
} }
if (mode != QuickTileMode(QuickTileFlag::None)) { if (mode != QuickTileMode(QuickTileFlag::None)) {
QPoint whichScreen = keyboard ? frameGeometry().center() : Cursor::pos(); QPoint whichScreen = keyboard ? frameGeometry().center() : Cursors::self()->mouse()->pos();
// If trying to tile to the side that the window is already tiled to move the window to the next // If trying to tile to the side that the window is already tiled to move the window to the next
// screen if it exists, otherwise toggle the mode (set QuickTileFlag::None) // screen if it exists, otherwise toggle the mode (set QuickTileFlag::None)
......
...@@ -238,7 +238,7 @@ void Workspace::setActiveClient(AbstractClient* c) ...@@ -238,7 +238,7 @@ void Workspace::setActiveClient(AbstractClient* c)
} }
StackingUpdatesBlocker blocker(this); StackingUpdatesBlocker blocker(this);
++set_active_client_recursion; ++set_active_client_recursion;
updateFocusMousePosition(Cursor::pos()); updateFocusMousePosition(Cursors::self()->mouse()->pos());
if (active_client != nullptr) { if (active_client != nullptr) {
// note that this may call setActiveClient( NULL ), therefore the recursion counter // note that this may call setActiveClient( NULL ), therefore the recursion counter
active_client->setActive(false); active_client->setActive(false);
...@@ -430,7 +430,7 @@ AbstractClient *Workspace::clientUnderMouse(int screen) const ...@@ -430,7 +430,7 @@ AbstractClient *Workspace::clientUnderMouse(int screen) const
client->isOnCurrentActivity() && client->isOnScreen(screen))) client->isOnCurrentActivity() && client->isOnScreen(screen)))
continue; continue;
if (client->frameGeometry().contains(Cursor::pos())) { if (client->frameGeometry().contains(Cursors::self()->mouse()->pos())) {
return client; return client;
} }
} }
......
...@@ -167,6 +167,7 @@ ecm_mark_as_test(testBuiltInEffectLoader) ...@@ -167,6 +167,7 @@ ecm_mark_as_test(testBuiltInEffectLoader)
include_directories(${KWin_SOURCE_DIR}) include_directories(${KWin_SOURCE_DIR})
set(testScriptedEffectLoader_SRCS set(testScriptedEffectLoader_SRCS
../effectloader.cpp ../effectloader.cpp
../cursor.cpp
../screens.cpp ../screens.cpp
../scripting/scriptedeffect.cpp ../scripting/scriptedeffect.cpp
../scripting/scripting_logging.cpp ../scripting/scripting_logging.cpp
...@@ -244,6 +245,7 @@ target_link_libraries(effectversionplugin kwineffects) ...@@ -244,6 +245,7 @@ target_link_libraries(effectversionplugin kwineffects)
######################################################## ########################################################
set(testScreens_SRCS set(testScreens_SRCS
../screens.cpp ../screens.cpp
../cursor.cpp
../x11eventfilter.cpp ../x11eventfilter.cpp
mock_abstract_client.cpp mock_abstract_client.cpp
mock_screens.cpp mock_screens.cpp
...@@ -282,6 +284,7 @@ set(testScreenEdges_SRCS ...@@ -282,6 +284,7 @@ set(testScreenEdges_SRCS
../screenedge.cpp ../screenedge.cpp
../screens.cpp ../screens.cpp
../virtualdesktops.cpp ../virtualdesktops.cpp
../cursor.cpp
../xcbutils.cpp # init of extensions ../xcbutils.cpp # init of extensions
mock_abstract_client.cpp mock_abstract_client.cpp
mock_screens.cpp mock_screens.cpp
......
...@@ -78,7 +78,7 @@ void ActivationTest::init() ...@@ -78,7 +78,7 @@ void ActivationTest::init()
QVERIFY(Test::setupWaylandConnection()); QVERIFY(Test::setupWaylandConnection());
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void ActivationTest::cleanup() void ActivationTest::cleanup()
......
...@@ -88,7 +88,7 @@ void ActivitiesTest::cleanupTestCase() ...@@ -88,7 +88,7 @@ void ActivitiesTest::cleanupTestCase()
void ActivitiesTest::init() void ActivitiesTest::init()
{ {
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void ActivitiesTest::cleanup() void ActivitiesTest::cleanup()
......
...@@ -165,7 +165,7 @@ void DecorationInputTest::init() ...@@ -165,7 +165,7 @@ void DecorationInputTest::init()
QVERIFY(Test::waitForWaylandPointer()); QVERIFY(Test::waitForWaylandPointer());
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void DecorationInputTest::cleanup() void DecorationInputTest::cleanup()
...@@ -556,7 +556,7 @@ void DecorationInputTest::testResizeOutsideWindow() ...@@ -556,7 +556,7 @@ void DecorationInputTest::testResizeOutsideWindow()
default: default:
break; break;
} }
QVERIFY(!c->frameGeometry().contains(KWin::Cursor::pos())); QVERIFY(!c->frameGeometry().contains(KWin::Cursors::self()->mouse()->pos()));
// pressing should trigger resize // pressing should trigger resize
PRESS; PRESS;
...@@ -641,7 +641,7 @@ void DecorationInputTest::testModifierClickUnrestrictedMove() ...@@ -641,7 +641,7 @@ void DecorationInputTest::testModifierClickUnrestrictedMove()
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2));
// move cursor on window // move cursor on window
Cursor::setPos(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2)); Cursors::self()->mouse()->setPos(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2));
// simulate modifier+click // simulate modifier+click
quint32 timestamp = 1; quint32 timestamp = 1;
...@@ -711,7 +711,7 @@ void DecorationInputTest::testModifierScrollOpacity() ...@@ -711,7 +711,7 @@ void DecorationInputTest::testModifierScrollOpacity()
QVERIFY(!c->noBorder()); QVERIFY(!c->noBorder());
c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2)); c->move(screens()->geometry(0).center() - QPoint(c->width()/2, c->height()/2));
// move cursor on window // move cursor on window
Cursor::setPos(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2)); Cursors::self()->mouse()->setPos(QPoint(c->frameGeometry().center().x(), c->y() + c->clientPos().y() / 2));
// set the opacity to 0.5 // set the opacity to 0.5
c->setOpacity(0.5); c->setOpacity(0.5);
QCOMPARE(c->opacity(), 0.5); QCOMPARE(c->opacity(), 0.5);
...@@ -797,7 +797,7 @@ void DecorationInputTest::testTouchEvents() ...@@ -797,7 +797,7 @@ void DecorationInputTest::testTouchEvents()
QCOMPARE(c->isMove(), false); QCOMPARE(c->isMove(), false);
// let's check that a hover motion is sent if the pointer is on deco, when touch release // let's check that a hover motion is sent if the pointer is on deco, when touch release
Cursor::setPos(tapPoint); Cursors::self()->mouse()->setPos(tapPoint);
QCOMPARE(hoverMoveSpy.count(), 2); QCOMPARE(hoverMoveSpy.count(), 2);
kwinApp()->platform()->touchDown(0, tapPoint, timestamp++); kwinApp()->platform()->touchDown(0, tapPoint, timestamp++);
QCOMPARE(hoverMoveSpy.count(), 3); QCOMPARE(hoverMoveSpy.count(), 3);
......
...@@ -72,7 +72,7 @@ void X11DesktopWindowTest::initTestCase() ...@@ -72,7 +72,7 @@ void X11DesktopWindowTest::initTestCase()
void X11DesktopWindowTest::init() void X11DesktopWindowTest::init()
{ {
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void X11DesktopWindowTest::cleanup() void X11DesktopWindowTest::cleanup()
......
...@@ -83,7 +83,7 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase() ...@@ -83,7 +83,7 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase()
void DontCrashAuroraeDestroyDecoTest::init() void DontCrashAuroraeDestroyDecoTest::init()
{ {
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows() void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
......
...@@ -56,7 +56,7 @@ void DontCrashCursorPhysicalSizeEmpty::init() ...@@ -56,7 +56,7 @@ void DontCrashCursorPhysicalSizeEmpty::init()
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration)); QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
screens()->setCurrent(0); screens()->setCurrent(0);
KWin::Cursor::setPos(QPoint(640, 512)); KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void DontCrashCursorPhysicalSizeEmpty::cleanup() void DontCrashCursorPhysicalSizeEmpty::cleanup()
...@@ -110,9 +110,9 @@ void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco() ...@@ -110,9 +110,9 @@ void DontCrashCursorPhysicalSizeEmpty::testMoveCursorOverDeco()
auto output = display->outputs().first(); auto output = display->outputs().first();
output->setPhysicalSize(QSize(0, 0)); output->setPhysicalSize(QSize(0, 0));
// and fake a cursor theme change, so that the theme gets recreated // and fake a cursor theme change, so that the theme gets recreated
emit KWin::Cursor::self()->themeChanged(); emit KWin::Cursors::self()->mouse()->themeChanged();
KWin::Cursor::setPos(QPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2)); KWin::Cursors::self()->mouse()->setPos(QPoint(c->frameGeometry().center().x(), c->clientPos().y() / 2));
} }
WAYLANDTEST_MAIN(DontCrashCursorPhysicalSizeEmpty) WAYLANDTEST_MAIN(DontCrashCursorPhysicalSizeEmpty)
......
...@@ -74,7 +74,7 @@ void DontCrashEmptyDecorationTest::initTestCase() ...@@ -74,7 +74,7 @@ void DontCrashEmptyDecorationTest::initTestCase()
void DontCrashEmptyDecorationTest::init() void DontCrashEmptyDecorationTest::init()
{ {
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void DontCrashEmptyDecorationTest::testBug361551() void DontCrashEmptyDecorationTest::testBug361551()
......
...@@ -87,7 +87,7 @@ void DontCrashNoBorder::init() ...@@ -87,7 +87,7 @@ void DontCrashNoBorder::init()
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration)); QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Decoration));
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void DontCrashNoBorder::cleanup() void DontCrashNoBorder::cleanup()
......
...@@ -79,7 +79,7 @@ void TestDontCrashUseractionsMenu::init() ...@@ -79,7 +79,7 @@ void TestDontCrashUseractionsMenu::init()
QVERIFY(Test::setupWaylandConnection()); QVERIFY(Test::setupWaylandConnection());
screens()->setCurrent(0); screens()->setCurrent(0);
KWin::Cursor::setPos(QPoint(1280, 512)); KWin::Cursors::self()->mouse()->setPos(QPoint(1280, 512));
} }
void TestDontCrashUseractionsMenu::cleanup() void TestDontCrashUseractionsMenu::cleanup()
......
...@@ -162,7 +162,7 @@ void TranslucencyTest::testMoveAfterDesktopChange() ...@@ -162,7 +162,7 @@ void TranslucencyTest::testMoveAfterDesktopChange()
workspace()->sendClientToDesktop(client, 2, false); workspace()->sendClientToDesktop(client, 2, false);
effects->setCurrentDesktop(2); effects->setCurrentDesktop(2);
QVERIFY(!m_translucencyEffect->isActive()); QVERIFY(!m_translucencyEffect->isActive());
KWin::Cursor::setPos(client->frameGeometry().center()); KWin::Cursors::self()->mouse()->setPos(client->frameGeometry().center());
workspace()->performWindowOperation(client, Options::MoveOp); workspace()->performWindowOperation(client, Options::MoveOp);
QVERIFY(m_translucencyEffect->isActive()); QVERIFY(m_translucencyEffect->isActive());
QTest::qWait(200); QTest::qWait(200);
......
...@@ -168,19 +168,19 @@ void WobblyWindowsShadeTest::testShadeMove() ...@@ -168,19 +168,19 @@ void WobblyWindowsShadeTest::testShadeMove()
// send some key events, not going through input redirection // send some key events, not going through input redirection
client->keyPressEvent(Qt::Key_Right); client->keyPressEvent(Qt::Key_Right);
client->updateMoveResize(KWin::Cursor::pos()); client->updateMoveResize(KWin::Cursors::self()->mouse()->pos());
// wait for frame rendered // wait for frame rendered
QTest::qWait(100); QTest::qWait(100);
client->keyPressEvent(Qt::Key_Right); client->keyPressEvent(Qt::Key_Right);
client->updateMoveResize(KWin::Cursor::pos()); client->updateMoveResize(KWin::Cursors::self()->mouse()->pos());
// wait for frame rendered // wait for frame rendered
QTest::qWait(100); QTest::qWait(100);
client->keyPressEvent(Qt::Key_Down | Qt::ALT); client->keyPressEvent(Qt::Key_Down | Qt::ALT);
client->updateMoveResize(KWin::Cursor::pos()); client->updateMoveResize(KWin::Cursors::self()->mouse()->pos());
// wait for frame rendered // wait for frame rendered
QTest::qWait(100); QTest::qWait(100);
......
...@@ -82,7 +82,7 @@ void GlobalShortcutsTest::init() ...@@ -82,7 +82,7 @@ void GlobalShortcutsTest::init()
{ {
QVERIFY(Test::setupWaylandConnection()); QVERIFY(Test::setupWaylandConnection());
screens()->setCurrent(0); screens()->setCurrent(0);
KWin::Cursor::setPos(QPoint(640, 512)); KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void GlobalShortcutsTest::cleanup() void GlobalShortcutsTest::cleanup()
......
...@@ -84,7 +84,7 @@ void InputStackingOrderTest::init() ...@@ -84,7 +84,7 @@ void InputStackingOrderTest::init()
QVERIFY(Test::waitForWaylandPointer()); QVERIFY(Test::waitForWaylandPointer());
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void InputStackingOrderTest::cleanup() void InputStackingOrderTest::cleanup()
......
...@@ -201,7 +201,7 @@ void InternalWindowTest::initTestCase() ...@@ -201,7 +201,7 @@ void InternalWindowTest::initTestCase()
void InternalWindowTest::init() void InternalWindowTest::init()
{ {
Cursor::setPos(QPoint(1280, 512)); Cursors::self()->mouse()->setPos(QPoint(1280, 512));
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat)); QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat));
QVERIFY(Test::waitForWaylandKeyboard()); QVERIFY(Test::waitForWaylandKeyboard());
} }
...@@ -617,7 +617,7 @@ void InternalWindowTest::testModifierClickUnrestrictedMove() ...@@ -617,7 +617,7 @@ void InternalWindowTest::testModifierClickUnrestrictedMove()
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
// move cursor on window // move cursor on window
Cursor::setPos(internalClient->frameGeometry().center()); Cursors::self()->mouse()->setPos(internalClient->frameGeometry().center());
// simulate modifier+click // simulate modifier+click
quint32 timestamp = 1; quint32 timestamp = 1;
...@@ -653,7 +653,7 @@ void InternalWindowTest::testModifierScroll() ...@@ -653,7 +653,7 @@ void InternalWindowTest::testModifierScroll()
workspace()->slotReconfigure(); workspace()->slotReconfigure();
// move cursor on window // move cursor on window
Cursor::setPos(internalClient->frameGeometry().center()); Cursors::self()->mouse()->setPos(internalClient->frameGeometry().center());
// set the opacity to 0.5 // set the opacity to 0.5
internalClient->setOpacity(0.5); internalClient->setOpacity(0.5);
......
...@@ -74,7 +74,7 @@ void KWinBindingsTest::init() ...@@ -74,7 +74,7 @@ void KWinBindingsTest::init()
{ {
QVERIFY(Test::setupWaylandConnection()); QVERIFY(Test::setupWaylandConnection());
screens()->setCurrent(0); screens()->setCurrent(0);
KWin::Cursor::setPos(QPoint(640, 512)); KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void KWinBindingsTest::cleanup() void KWinBindingsTest::cleanup()
......
...@@ -213,7 +213,7 @@ void LockScreenTest::init() ...@@ -213,7 +213,7 @@ void LockScreenTest::init()
m_seat = Test::waylandSeat(); m_seat = Test::waylandSeat();
screens()->setCurrent(0); screens()->setCurrent(0);
Cursor::setPos(QPoint(640, 512)); Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void LockScreenTest::cleanup() void LockScreenTest::cleanup()
......
...@@ -85,7 +85,7 @@ void TestMaximized::init() ...@@ -85,7 +85,7 @@ void TestMaximized::init()
Test::AdditionalWaylandInterface::PlasmaShell)); Test::AdditionalWaylandInterface::PlasmaShell));
screens()->setCurrent(0); screens()->setCurrent(0);
KWin::Cursor::setPos(QPoint(1280, 512)); KWin::Cursors::self()->mouse()->setPos(QPoint(1280, 512));
} }
void TestMaximized::cleanup() void TestMaximized::cleanup()
......
...@@ -107,7 +107,7 @@ void ModifierOnlyShortcutTest::initTestCase() ...@@ -107,7 +107,7 @@ void ModifierOnlyShortcutTest::initTestCase()
void ModifierOnlyShortcutTest::init() void ModifierOnlyShortcutTest::init()
{ {
screens()->setCurrent(0); screens()->setCurrent(0);
KWin::Cursor::setPos(QPoint(640, 512)); KWin::Cursors::self()->mouse()->setPos(QPoint(640, 512));
} }
void ModifierOnlyShortcutTest::cleanup() void ModifierOnlyShortcutTest::cleanup()
......
...@@ -164,27 +164,27 @@ void MoveResizeWindowTest::testMove() ...@@ -164,27 +164,27 @@ void MoveResizeWindowTest::testMove()
QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50)); QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50));
// send some key events, not going through input redirection // send some key events, not going through input redirection
const QPoint cursorPos = Cursor::pos(); const QPoint cursorPos = Cursors::self()->mouse()->pos();
c->keyPressEvent(Qt::Key_Right); c->keyPressEvent(Qt::Key_Right);
c->updateMoveResize(Cursor::pos()); c->updateMoveResize(Cursors::self()->mouse()->pos());
QCOMPARE(Cursor::pos(), cursorPos + QPoint(8, 0)); QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(8, 0));
QEXPECT_FAIL("", "First event is ignored", Continue); QEXPECT_FAIL("", "First event is ignored", Continue);
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
clientStepUserMovedResizedSpy.clear(); clientStepUserMovedResizedSpy.clear();
windowStepUserMovedResizedSpy.clear(); windowStepUserMovedResizedSpy.clear();
c->keyPressEvent(Qt::Key_Right); c->keyPressEvent(Qt::Key_Right);
c->updateMoveResize(Cursor::pos()); c->updateMoveResize(Cursors::self()->mouse()->pos());
QCOMPARE(Cursor::pos(), cursorPos + QPoint(16, 0)); QCOMPARE(Cursors::self()->mouse()->pos(), cursorPos + QPoint(16, 0));
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
<