waylandServer()->backend() replaced by kwinApp()->platform()

icc-effect-5.14.5
Martin Gräßlin 2016-04-07 08:28:35 +02:00
parent 58b59d3e20
commit 146af48f22
25 changed files with 145 additions and 144 deletions

View File

@ -60,8 +60,8 @@ void DebugConsoleTest::initTestCase()
qRegisterMetaType<KWin::AbstractClient*>(); qRegisterMetaType<KWin::AbstractClient*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();

View File

@ -74,13 +74,13 @@ private:
}; };
#define MOTION(target) \ #define MOTION(target) \
waylandServer()->backend()->pointerMotion(target, timestamp++) kwinApp()->platform()->pointerMotion(target, timestamp++)
#define PRESS \ #define PRESS \
waylandServer()->backend()->pointerButtonPressed(BTN_LEFT, timestamp++) kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++)
#define RELEASE \ #define RELEASE \
waylandServer()->backend()->pointerButtonReleased(BTN_LEFT, timestamp++) kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++)
AbstractClient *DecorationInputTest::showWindow() AbstractClient *DecorationInputTest::showWindow()
{ {
@ -130,8 +130,8 @@ void DecorationInputTest::initTestCase()
qRegisterMetaType<KWin::AbstractClient*>(); qRegisterMetaType<KWin::AbstractClient*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
// change some options // change some options
@ -254,13 +254,13 @@ void DecorationInputTest::testAxis()
// TODO: mouse wheel direction looks wrong to me // TODO: mouse wheel direction looks wrong to me
// simulate wheel // simulate wheel
waylandServer()->backend()->pointerAxisVertical(5.0, timestamp++); kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++);
QVERIFY(c->keepBelow()); QVERIFY(c->keepBelow());
QVERIFY(!c->keepAbove()); QVERIFY(!c->keepAbove());
waylandServer()->backend()->pointerAxisVertical(-5.0, timestamp++); kwinApp()->platform()->pointerAxisVertical(-5.0, timestamp++);
QVERIFY(!c->keepBelow()); QVERIFY(!c->keepBelow());
QVERIFY(!c->keepAbove()); QVERIFY(!c->keepAbove());
waylandServer()->backend()->pointerAxisVertical(-5.0, timestamp++); kwinApp()->platform()->pointerAxisVertical(-5.0, timestamp++);
QVERIFY(!c->keepBelow()); QVERIFY(!c->keepBelow());
QVERIFY(c->keepAbove()); QVERIFY(c->keepAbove());
} }

View File

@ -71,7 +71,7 @@ void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase()
qRegisterMetaType<KWin::Deleted*>(); qRegisterMetaType<KWin::Deleted*>();
qRegisterMetaType<KWin::ShellClient*>(); qRegisterMetaType<KWin::ShellClient*>();
qRegisterMetaType<KWin::AbstractClient*>(); qRegisterMetaType<KWin::AbstractClient*>();
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
QVERIFY(Compositor::self()); QVERIFY(Compositor::self());

View File

@ -46,7 +46,7 @@ void DontCrashGlxgearsTest::initTestCase()
qRegisterMetaType<KWin::Deleted*>(); qRegisterMetaType<KWin::Deleted*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
QVERIFY(workspaceCreatedSpy.wait()); QVERIFY(workspaceCreatedSpy.wait());

View File

@ -73,8 +73,8 @@ void InputStackingOrderTest::initTestCase()
qRegisterMetaType<KWin::Deleted*>(); qRegisterMetaType<KWin::Deleted*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
@ -220,7 +220,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange()
QCOMPARE(window1->geometry(), window2->geometry()); QCOMPARE(window1->geometry(), window2->geometry());
// enter // enter
waylandServer()->backend()->pointerMotion(QPointF(25, 25), 1); kwinApp()->platform()->pointerMotion(QPointF(25, 25), 1);
QVERIFY(enteredSpy.wait()); QVERIFY(enteredSpy.wait());
QCOMPARE(enteredSpy.count(), 1); QCOMPARE(enteredSpy.count(), 1);
// window 2 should have focus // window 2 should have focus

View File

@ -142,8 +142,8 @@ void InternalWindowTest::initTestCase()
qRegisterMetaType<KWin::AbstractClient*>(); qRegisterMetaType<KWin::AbstractClient*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
@ -182,14 +182,14 @@ void InternalWindowTest::testEnterLeave()
QVERIFY(moveSpy.isValid()); QVERIFY(moveSpy.isValid());
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->pointerMotion(QPoint(50, 50), timestamp++); kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++);
QTRY_COMPARE(enterSpy.count(), 1); QTRY_COMPARE(enterSpy.count(), 1);
waylandServer()->backend()->pointerMotion(QPoint(60, 50), timestamp++); kwinApp()->platform()->pointerMotion(QPoint(60, 50), timestamp++);
QTRY_COMPARE(moveSpy.count(), 1); QTRY_COMPARE(moveSpy.count(), 1);
QCOMPARE(moveSpy.first().first().toPoint(), QPoint(60, 50)); QCOMPARE(moveSpy.first().first().toPoint(), QPoint(60, 50));
waylandServer()->backend()->pointerMotion(QPoint(101, 50), timestamp++); kwinApp()->platform()->pointerMotion(QPoint(101, 50), timestamp++);
QTRY_COMPARE(leaveSpy.count(), 1); QTRY_COMPARE(leaveSpy.count(), 1);
} }
@ -209,11 +209,11 @@ void InternalWindowTest::testPointerPressRelease()
QCOMPARE(clientAddedSpy.count(), 1); QCOMPARE(clientAddedSpy.count(), 1);
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->pointerMotion(QPoint(50, 50), timestamp++); kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++);
waylandServer()->backend()->pointerButtonPressed(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
QTRY_COMPARE(pressSpy.count(), 1); QTRY_COMPARE(pressSpy.count(), 1);
waylandServer()->backend()->pointerButtonReleased(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++);
QTRY_COMPARE(releaseSpy.count(), 1); QTRY_COMPARE(releaseSpy.count(), 1);
} }
@ -230,11 +230,11 @@ void InternalWindowTest::testPointerAxis()
QCOMPARE(clientAddedSpy.count(), 1); QCOMPARE(clientAddedSpy.count(), 1);
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->pointerMotion(QPoint(50, 50), timestamp++); kwinApp()->platform()->pointerMotion(QPoint(50, 50), timestamp++);
waylandServer()->backend()->pointerAxisVertical(5.0, timestamp++); kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++);
QTRY_COMPARE(wheelSpy.count(), 1); QTRY_COMPARE(wheelSpy.count(), 1);
waylandServer()->backend()->pointerAxisHorizontal(5.0, timestamp++); kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++);
QTRY_COMPARE(wheelSpy.count(), 2); QTRY_COMPARE(wheelSpy.count(), 2);
} }
@ -262,12 +262,12 @@ void InternalWindowTest::testKeyboard()
quint32 timestamp = 1; quint32 timestamp = 1;
QFETCH(QPoint, cursorPos); QFETCH(QPoint, cursorPos);
waylandServer()->backend()->pointerMotion(cursorPos, timestamp++); kwinApp()->platform()->pointerMotion(cursorPos, timestamp++);
waylandServer()->backend()->keyboardKeyPressed(KEY_A, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_A, timestamp++);
QTRY_COMPARE(pressSpy.count(), 1); QTRY_COMPARE(pressSpy.count(), 1);
QCOMPARE(releaseSpy.count(), 0); QCOMPARE(releaseSpy.count(), 0);
waylandServer()->backend()->keyboardKeyReleased(KEY_A, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_A, timestamp++);
QTRY_COMPARE(releaseSpy.count(), 1); QTRY_COMPARE(releaseSpy.count(), 1);
QCOMPARE(pressSpy.count(), 1); QCOMPARE(pressSpy.count(), 1);
} }

View File

@ -55,7 +55,7 @@ WaylandTestApplication::WaylandTestApplication(int &argc, char **argv)
WaylandTestApplication::~WaylandTestApplication() WaylandTestApplication::~WaylandTestApplication()
{ {
waylandServer()->backend()->setOutputsEnabled(false); kwinApp()->platform()->setOutputsEnabled(false);
destroyWorkspace(); destroyWorkspace();
waylandServer()->dispatch(); waylandServer()->dispatch();
// need to unload all effects prior to destroying X connection as they might do X calls // need to unload all effects prior to destroying X connection as they might do X calls
@ -94,7 +94,7 @@ void WaylandTestApplication::performStartup()
void WaylandTestApplication::createBackend() void WaylandTestApplication::createBackend()
{ {
AbstractBackend *backend = waylandServer()->backend(); AbstractBackend *backend = kwinApp()->platform();
connect(backend, &AbstractBackend::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens); connect(backend, &AbstractBackend::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens);
connect(backend, &AbstractBackend::initFailed, this, connect(backend, &AbstractBackend::initFailed, this,
[] () { [] () {
@ -107,7 +107,7 @@ void WaylandTestApplication::createBackend()
void WaylandTestApplication::continueStartupWithScreens() void WaylandTestApplication::continueStartupWithScreens()
{ {
disconnect(waylandServer()->backend(), &AbstractBackend::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens); disconnect(kwinApp()->platform(), &AbstractBackend::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens);
createScreens(); createScreens();
waylandServer()->initOutputs(); waylandServer()->initOutputs();

View File

@ -128,19 +128,19 @@ Q_SIGNALS:
QVERIFY(!waylandServer()->isScreenLocked()); QVERIFY(!waylandServer()->isScreenLocked());
#define MOTION(target) \ #define MOTION(target) \
waylandServer()->backend()->pointerMotion(target, timestamp++) kwinApp()->platform()->pointerMotion(target, timestamp++)
#define PRESS \ #define PRESS \
waylandServer()->backend()->pointerButtonPressed(BTN_LEFT, timestamp++) kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++)
#define RELEASE \ #define RELEASE \
waylandServer()->backend()->pointerButtonReleased(BTN_LEFT, timestamp++) kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++)
#define KEYPRESS( key ) \ #define KEYPRESS( key ) \
waylandServer()->backend()->keyboardKeyPressed(key, timestamp++) kwinApp()->platform()->keyboardKeyPressed(key, timestamp++)
#define KEYRELEASE( key ) \ #define KEYRELEASE( key ) \
waylandServer()->backend()->keyboardKeyReleased(key, timestamp++) kwinApp()->platform()->keyboardKeyReleased(key, timestamp++)
void LockScreenTest::unlock() void LockScreenTest::unlock()
{ {
@ -196,8 +196,8 @@ void LockScreenTest::initTestCase()
qRegisterMetaType<KWin::AbstractClient*>(); qRegisterMetaType<KWin::AbstractClient*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
@ -390,24 +390,24 @@ void LockScreenTest::testPointerAxis()
quint32 timestamp = 1; quint32 timestamp = 1;
MOTION(c->geometry().center()); MOTION(c->geometry().center());
// and simulate axis // and simulate axis
waylandServer()->backend()->pointerAxisHorizontal(5.0, timestamp++); kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++);
QVERIFY(axisChangedSpy.wait()); QVERIFY(axisChangedSpy.wait());
LOCK LOCK
// and simulate axis // and simulate axis
waylandServer()->backend()->pointerAxisHorizontal(5.0, timestamp++); kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++);
QVERIFY(!axisChangedSpy.wait(100)); QVERIFY(!axisChangedSpy.wait(100));
waylandServer()->backend()->pointerAxisVertical(5.0, timestamp++); kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++);
QVERIFY(!axisChangedSpy.wait(100)); QVERIFY(!axisChangedSpy.wait(100));
// and unlock // and unlock
UNLOCK UNLOCK
// and move axis again // and move axis again
waylandServer()->backend()->pointerAxisHorizontal(5.0, timestamp++); kwinApp()->platform()->pointerAxisHorizontal(5.0, timestamp++);
QVERIFY(axisChangedSpy.wait()); QVERIFY(axisChangedSpy.wait());
waylandServer()->backend()->pointerAxisVertical(5.0, timestamp++); kwinApp()->platform()->pointerAxisVertical(5.0, timestamp++);
QVERIFY(axisChangedSpy.wait()); QVERIFY(axisChangedSpy.wait());
} }
@ -621,32 +621,32 @@ void LockScreenTest::testMoveWindow()
workspace()->slotWindowMove(); workspace()->slotWindowMove();
QCOMPARE(workspace()->getMovingClient(), c); QCOMPARE(workspace()->getMovingClient(), c);
QVERIFY(c->isMove()); QVERIFY(c->isMove());
waylandServer()->backend()->keyboardKeyPressed(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++);
QEXPECT_FAIL("", "First event is ignored", Continue); QEXPECT_FAIL("", "First event is ignored", Continue);
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
// TODO adjust once the expected fail is fixed // TODO adjust once the expected fail is fixed
waylandServer()->backend()->keyboardKeyPressed(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++);
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
// while locking our window should continue to be in move resize // while locking our window should continue to be in move resize
LOCK LOCK
QCOMPARE(workspace()->getMovingClient(), c); QCOMPARE(workspace()->getMovingClient(), c);
QVERIFY(c->isMove()); QVERIFY(c->isMove());
waylandServer()->backend()->keyboardKeyPressed(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++);
QCOMPARE(clientStepUserMovedResizedSpy.count(), 1); QCOMPARE(clientStepUserMovedResizedSpy.count(), 1);
UNLOCK UNLOCK
QCOMPARE(workspace()->getMovingClient(), c); QCOMPARE(workspace()->getMovingClient(), c);
QVERIFY(c->isMove()); QVERIFY(c->isMove());
waylandServer()->backend()->keyboardKeyPressed(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++);
QCOMPARE(clientStepUserMovedResizedSpy.count(), 2); QCOMPARE(clientStepUserMovedResizedSpy.count(), 2);
waylandServer()->backend()->keyboardKeyPressed(KEY_ESC, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_ESC, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++);
QVERIFY(!c->isMove()); QVERIFY(!c->isMove());
} }
@ -661,12 +661,12 @@ void LockScreenTest::testPointerShortcut()
// try to trigger the shortcut // try to trigger the shortcut
quint32 timestamp = 1; quint32 timestamp = 1;
#define PERFORM(expectedCount) \ #define PERFORM(expectedCount) \
waylandServer()->backend()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \ kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \
PRESS; \ PRESS; \
QCoreApplication::instance()->processEvents(); \ QCoreApplication::instance()->processEvents(); \
QCOMPARE(actionSpy.count(), expectedCount); \ QCOMPARE(actionSpy.count(), expectedCount); \
RELEASE; \ RELEASE; \
waylandServer()->backend()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \ kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \
QCoreApplication::instance()->processEvents(); \ QCoreApplication::instance()->processEvents(); \
QCOMPARE(actionSpy.count(), expectedCount); QCOMPARE(actionSpy.count(), expectedCount);
@ -713,14 +713,14 @@ void LockScreenTest::testAxisShortcut()
// try to trigger the shortcut // try to trigger the shortcut
quint32 timestamp = 1; quint32 timestamp = 1;
#define PERFORM(expectedCount) \ #define PERFORM(expectedCount) \
waylandServer()->backend()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \ kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \
if (direction == Qt::Vertical) \ if (direction == Qt::Vertical) \
waylandServer()->backend()->pointerAxisVertical(sign * 5.0, timestamp++); \ kwinApp()->platform()->pointerAxisVertical(sign * 5.0, timestamp++); \
else \ else \
waylandServer()->backend()->pointerAxisHorizontal(sign * 5.0, timestamp++); \ kwinApp()->platform()->pointerAxisHorizontal(sign * 5.0, timestamp++); \
QCoreApplication::instance()->processEvents(); \ QCoreApplication::instance()->processEvents(); \
QCOMPARE(actionSpy.count(), expectedCount); \ QCOMPARE(actionSpy.count(), expectedCount); \
waylandServer()->backend()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \ kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \
QCoreApplication::instance()->processEvents(); \ QCoreApplication::instance()->processEvents(); \
QCOMPARE(actionSpy.count(), expectedCount); QCOMPARE(actionSpy.count(), expectedCount);
@ -792,24 +792,24 @@ void LockScreenTest::testTouch()
QVERIFY(pointRemovedSpy.isValid()); QVERIFY(pointRemovedSpy.isValid());
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->touchDown(1, QPointF(25, 25), timestamp++); kwinApp()->platform()->touchDown(1, QPointF(25, 25), timestamp++);
QVERIFY(sequenceStartedSpy.wait()); QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1); QCOMPARE(sequenceStartedSpy.count(), 1);
LOCK LOCK
QVERIFY(cancelSpy.wait()); QVERIFY(cancelSpy.wait());
waylandServer()->backend()->touchUp(1, timestamp++); kwinApp()->platform()->touchUp(1, timestamp++);
QVERIFY(!pointRemovedSpy.wait(100)); QVERIFY(!pointRemovedSpy.wait(100));
waylandServer()->backend()->touchDown(1, QPointF(25, 25), timestamp++); kwinApp()->platform()->touchDown(1, QPointF(25, 25), timestamp++);
waylandServer()->backend()->touchMotion(1, QPointF(26, 26), timestamp++); kwinApp()->platform()->touchMotion(1, QPointF(26, 26), timestamp++);
waylandServer()->backend()->touchUp(1, timestamp++); kwinApp()->platform()->touchUp(1, timestamp++);
UNLOCK UNLOCK
waylandServer()->backend()->touchDown(1, QPointF(25, 25), timestamp++); kwinApp()->platform()->touchDown(1, QPointF(25, 25), timestamp++);
QVERIFY(sequenceStartedSpy.wait()); QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 2); QCOMPARE(sequenceStartedSpy.count(), 2);
waylandServer()->backend()->touchUp(1, timestamp++); kwinApp()->platform()->touchUp(1, timestamp++);
QVERIFY(pointRemovedSpy.wait()); QVERIFY(pointRemovedSpy.wait());
QCOMPARE(pointRemovedSpy.count(), 1); QCOMPARE(pointRemovedSpy.count(), 1);
} }

View File

@ -83,7 +83,7 @@ void MoveResizeWindowTest::initTestCase()
qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode"); qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode");
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
QVERIFY(workspaceCreatedSpy.wait()); QVERIFY(workspaceCreatedSpy.wait());
@ -506,22 +506,22 @@ void MoveResizeWindowTest::testPointerMoveEnd()
// let's trigger the left button // let's trigger the left button
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->pointerButtonPressed(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
QVERIFY(!c->isMove()); QVERIFY(!c->isMove());
workspace()->slotWindowMove(); workspace()->slotWindowMove();
QVERIFY(c->isMove()); QVERIFY(c->isMove());
// let's press another button // let's press another button
QFETCH(int, additionalButton); QFETCH(int, additionalButton);
waylandServer()->backend()->pointerButtonPressed(additionalButton, timestamp++); kwinApp()->platform()->pointerButtonPressed(additionalButton, timestamp++);
QVERIFY(c->isMove()); QVERIFY(c->isMove());
// release the left button, should still have the window moving // release the left button, should still have the window moving
waylandServer()->backend()->pointerButtonReleased(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++);
QVERIFY(c->isMove()); QVERIFY(c->isMove());
// but releasing the other button should now end moving // but releasing the other button should now end moving
waylandServer()->backend()->pointerButtonReleased(additionalButton, timestamp++); kwinApp()->platform()->pointerButtonReleased(additionalButton, timestamp++);
QVERIFY(!c->isMove()); QVERIFY(!c->isMove());
} }

View File

@ -39,7 +39,7 @@ void PlatformCursorTest::initTestCase()
{ {
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
QVERIFY(workspaceCreatedSpy.wait()); QVERIFY(workspaceCreatedSpy.wait());

View File

@ -91,8 +91,8 @@ void PointerInputTest::initTestCase()
qRegisterMetaType<KWin::Deleted*>(); qRegisterMetaType<KWin::Deleted*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
@ -272,7 +272,7 @@ void PointerInputTest::testWarpingGeneratesPointerMotion()
QVERIFY(window); QVERIFY(window);
// enter // enter
waylandServer()->backend()->pointerMotion(QPointF(25, 25), 1); kwinApp()->platform()->pointerMotion(QPointF(25, 25), 1);
QVERIFY(enteredSpy.wait()); QVERIFY(enteredSpy.wait());
// we get a move event together with the enter, that's actually wrong but also shouldn't harm // we get a move event together with the enter, that's actually wrong but also shouldn't harm
QVERIFY(movedSpy.wait()); QVERIFY(movedSpy.wait());
@ -317,8 +317,8 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
QSignalSpy screensChangedSpy(screens(), &Screens::changed); QSignalSpy screensChangedSpy(screens(), &Screens::changed);
QVERIFY(screensChangedSpy.isValid()); QVERIFY(screensChangedSpy.isValid());
// now let's remove the screen containing the cursor // now let's remove the screen containing the cursor
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 1)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 1));
QMetaObject::invokeMethod(waylandServer()->backend(), "sizeChanged", Qt::QueuedConnection); QMetaObject::invokeMethod(kwinApp()->platform(), "sizeChanged", Qt::QueuedConnection);
QVERIFY(screensChangedSpy.wait()); QVERIFY(screensChangedSpy.wait());
QCOMPARE(screens()->count(), 1); QCOMPARE(screens()->count(), 1);
@ -399,15 +399,15 @@ void PointerInputTest::testModifierClickUnrestrictedMove()
quint32 timestamp = 1; quint32 timestamp = 1;
QFETCH(int, modifierKey); QFETCH(int, modifierKey);
QFETCH(int, mouseButton); QFETCH(int, mouseButton);
waylandServer()->backend()->keyboardKeyPressed(modifierKey, timestamp++); kwinApp()->platform()->keyboardKeyPressed(modifierKey, timestamp++);
QVERIFY(!window->isMove()); QVERIFY(!window->isMove());
waylandServer()->backend()->pointerButtonPressed(mouseButton, timestamp++); kwinApp()->platform()->pointerButtonPressed(mouseButton, timestamp++);
QVERIFY(window->isMove()); QVERIFY(window->isMove());
// release modifier should not change it // release modifier should not change it
waylandServer()->backend()->keyboardKeyReleased(modifierKey, timestamp++); kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++);
QVERIFY(window->isMove()); QVERIFY(window->isMove());
// but releasing the key should end move/resize // but releasing the key should end move/resize
waylandServer()->backend()->pointerButtonReleased(mouseButton, timestamp++); kwinApp()->platform()->pointerButtonReleased(mouseButton, timestamp++);
QVERIFY(!window->isMove()); QVERIFY(!window->isMove());
// all of that should not have triggered button events on the surface // all of that should not have triggered button events on the surface
@ -471,12 +471,12 @@ void PointerInputTest::testModifierScrollOpacity()
// simulate modifier+wheel // simulate modifier+wheel
quint32 timestamp = 1; quint32 timestamp = 1;
QFETCH(int, modifierKey); QFETCH(int, modifierKey);
waylandServer()->backend()->keyboardKeyPressed(modifierKey, timestamp++); kwinApp()->platform()->keyboardKeyPressed(modifierKey, timestamp++);
waylandServer()->backend()->pointerAxisVertical(-5, timestamp++); kwinApp()->platform()->pointerAxisVertical(-5, timestamp++);
QCOMPARE(window->opacity(), 0.6); QCOMPARE(window->opacity(), 0.6);
waylandServer()->backend()->pointerAxisVertical(5, timestamp++); kwinApp()->platform()->pointerAxisVertical(5, timestamp++);
QCOMPARE(window->opacity(), 0.5); QCOMPARE(window->opacity(), 0.5);
waylandServer()->backend()->keyboardKeyReleased(modifierKey, timestamp++); kwinApp()->platform()->keyboardKeyReleased(modifierKey, timestamp++);
// axis should have been filtered out // axis should have been filtered out
QCOMPARE(axisSpy.count(), 0); QCOMPARE(axisSpy.count(), 0);
@ -524,7 +524,7 @@ void PointerInputTest::testScrollAction()
quint32 timestamp = 1; quint32 timestamp = 1;
QVERIFY(!window1->isActive()); QVERIFY(!window1->isActive());
waylandServer()->backend()->pointerAxisVertical(5, timestamp++); kwinApp()->platform()->pointerAxisVertical(5, timestamp++);
QVERIFY(window1->isActive()); QVERIFY(window1->isActive());
// but also the wheel event should be passed to the window // but also the wheel event should be passed to the window
@ -689,7 +689,7 @@ void PointerInputTest::testMouseActionInactiveWindow()
// and click // and click
quint32 timestamp = 1; quint32 timestamp = 1;
QFETCH(quint32, button); QFETCH(quint32, button);
waylandServer()->backend()->pointerButtonPressed(button, timestamp++); kwinApp()->platform()->pointerButtonPressed(button, timestamp++);
// should raise window1 and activate it // should raise window1 and activate it
QCOMPARE(stackingOrderChangedSpy.count(), 1); QCOMPARE(stackingOrderChangedSpy.count(), 1);
QVERIFY(!activeWindowChangedSpy.isEmpty()); QVERIFY(!activeWindowChangedSpy.isEmpty());
@ -698,7 +698,7 @@ void PointerInputTest::testMouseActionInactiveWindow()
QVERIFY(!window2->isActive()); QVERIFY(!window2->isActive());
// release again // release again
waylandServer()->backend()->pointerButtonReleased(button, timestamp++); kwinApp()->platform()->pointerButtonReleased(button, timestamp++);
} }
void PointerInputTest::testMouseActionActiveWindow_data() void PointerInputTest::testMouseActionActiveWindow_data()
@ -773,7 +773,7 @@ void PointerInputTest::testMouseActionActiveWindow()
// and click // and click
quint32 timestamp = 1; quint32 timestamp = 1;
QFETCH(quint32, button); QFETCH(quint32, button);
waylandServer()->backend()->pointerButtonPressed(button, timestamp++); kwinApp()->platform()->pointerButtonPressed(button, timestamp++);
QVERIFY(buttonSpy.wait()); QVERIFY(buttonSpy.wait());
if (clickRaise) { if (clickRaise) {
QCOMPARE(stackingOrderChangedSpy.count(), 1); QCOMPARE(stackingOrderChangedSpy.count(), 1);
@ -785,7 +785,7 @@ void PointerInputTest::testMouseActionActiveWindow()
} }
// release again // release again
waylandServer()->backend()->pointerButtonReleased(button, timestamp++); kwinApp()->platform()->pointerButtonReleased(button, timestamp++);
} }
void PointerInputTest::testCursorImage() void PointerInputTest::testCursorImage()

View File

@ -76,8 +76,8 @@ void QuickTilingTest::initTestCase()
qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode"); qRegisterMetaType<KWin::MaximizeMode>("MaximizeMode");
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
// set custom config which disables the Outline // set custom config which disables the Outline
@ -428,26 +428,26 @@ void QuickTilingTest::testQuickTilingKeyboardMove()
QFETCH(QPoint, targetPos); QFETCH(QPoint, targetPos);
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFTCTRL, timestamp++);
while (Cursor::pos().x() > targetPos.x()) { while (Cursor::pos().x() > targetPos.x()) {
waylandServer()->backend()->keyboardKeyPressed(KEY_LEFT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_LEFT, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_LEFT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFT, timestamp++);
} }
while (Cursor::pos().x() < targetPos.x()) { while (Cursor::pos().x() < targetPos.x()) {
waylandServer()->backend()->keyboardKeyPressed(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_RIGHT, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_RIGHT, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_RIGHT, timestamp++);
} }
while (Cursor::pos().y() < targetPos.y()) { while (Cursor::pos().y() < targetPos.y()) {
waylandServer()->backend()->keyboardKeyPressed(KEY_DOWN, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_DOWN, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_DOWN, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_DOWN, timestamp++);
} }
while (Cursor::pos().y() > targetPos.y()) { while (Cursor::pos().y() > targetPos.y()) {
waylandServer()->backend()->keyboardKeyPressed(KEY_UP, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_UP, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_UP, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_UP, timestamp++);
} }
waylandServer()->backend()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_LEFTCTRL, timestamp++);
waylandServer()->backend()->keyboardKeyPressed(KEY_ENTER, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_ENTER, timestamp++);
waylandServer()->backend()->keyboardKeyReleased(KEY_ENTER, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_ENTER, timestamp++);
QCOMPARE(Cursor::pos(), targetPos); QCOMPARE(Cursor::pos(), targetPos);
QVERIFY(!workspace()->getMovingClient()); QVERIFY(!workspace()->getMovingClient());
@ -509,9 +509,9 @@ void QuickTilingTest::testQuickTilingPointerMove()
QFETCH(QPoint, targetPos); QFETCH(QPoint, targetPos);
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->pointerMotion(targetPos, timestamp++); kwinApp()->platform()->pointerMotion(targetPos, timestamp++);
waylandServer()->backend()->pointerButtonPressed(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonPressed(BTN_LEFT, timestamp++);
waylandServer()->backend()->pointerButtonReleased(BTN_LEFT, timestamp++); kwinApp()->platform()->pointerButtonReleased(BTN_LEFT, timestamp++);
QCOMPARE(Cursor::pos(), targetPos); QCOMPARE(Cursor::pos(), targetPos);
QVERIFY(!workspace()->getMovingClient()); QVERIFY(!workspace()->getMovingClient());

View File

@ -51,7 +51,7 @@ void StartTest::initTestCase()
{ {
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
QVERIFY(workspaceCreatedSpy.wait()); QVERIFY(workspaceCreatedSpy.wait());

View File

@ -69,8 +69,8 @@ void TouchInputTest::initTestCase()
qRegisterMetaType<KWin::AbstractClient*>(); qRegisterMetaType<KWin::AbstractClient*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
@ -219,7 +219,7 @@ void TouchInputTest::testMultipleTouchPoints()
QVERIFY(endedSpy.isValid()); QVERIFY(endedSpy.isValid());
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->touchDown(1, QPointF(125, 125), timestamp++); kwinApp()->platform()->touchDown(1, QPointF(125, 125), timestamp++);
QVERIFY(sequenceStartedSpy.wait()); QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1); QCOMPARE(sequenceStartedSpy.count(), 1);
QCOMPARE(m_touch->sequence().count(), 1); QCOMPARE(m_touch->sequence().count(), 1);
@ -229,7 +229,7 @@ void TouchInputTest::testMultipleTouchPoints()
QCOMPARE(pointMovedSpy.count(), 0); QCOMPARE(pointMovedSpy.count(), 0);
// a point outside the window // a point outside the window
waylandServer()->backend()->touchDown(2, QPointF(0, 0), timestamp++); kwinApp()->platform()->touchDown(2, QPointF(0, 0), timestamp++);
QVERIFY(pointAddedSpy.wait()); QVERIFY(pointAddedSpy.wait());
QCOMPARE(pointAddedSpy.count(), 1); QCOMPARE(pointAddedSpy.count(), 1);
QCOMPARE(m_touch->sequence().count(), 2); QCOMPARE(m_touch->sequence().count(), 2);
@ -238,21 +238,21 @@ void TouchInputTest::testMultipleTouchPoints()
QCOMPARE(pointMovedSpy.count(), 0); QCOMPARE(pointMovedSpy.count(), 0);
// let's move that one // let's move that one
waylandServer()->backend()->touchMotion(2, QPointF(100, 100), timestamp++); kwinApp()->platform()->touchMotion(2, QPointF(100, 100), timestamp++);
QVERIFY(pointMovedSpy.wait()); QVERIFY(pointMovedSpy.wait());
QCOMPARE(pointMovedSpy.count(), 1); QCOMPARE(pointMovedSpy.count(), 1);
QCOMPARE(m_touch->sequence().count(), 2); QCOMPARE(m_touch->sequence().count(), 2);
QCOMPARE(m_touch->sequence().at(1)->isDown(), true); QCOMPARE(m_touch->sequence().at(1)->isDown(), true);
QCOMPARE(m_touch->sequence().at(1)->position(), QPointF(0, 0)); QCOMPARE(m_touch->sequence().at(1)->position(), QPointF(0, 0));
waylandServer()->backend()->touchUp(1, timestamp++); kwinApp()->platform()->touchUp(1, timestamp++);
QVERIFY(pointRemovedSpy.wait()); QVERIFY(pointRemovedSpy.wait());
QCOMPARE(pointRemovedSpy.count(), 1); QCOMPARE(pointRemovedSpy.count(), 1);
QCOMPARE(m_touch->sequence().count(), 2); QCOMPARE(m_touch->sequence().count(), 2);
QCOMPARE(m_touch->sequence().first()->isDown(), false); QCOMPARE(m_touch->sequence().first()->isDown(), false);
QCOMPARE(endedSpy.count(), 0); QCOMPARE(endedSpy.count(), 0);
waylandServer()->backend()->touchUp(2, timestamp++); kwinApp()->platform()->touchUp(2, timestamp++);
QVERIFY(pointRemovedSpy.wait()); QVERIFY(pointRemovedSpy.wait());
QCOMPARE(pointRemovedSpy.count(), 2); QCOMPARE(pointRemovedSpy.count(), 2);
QCOMPARE(m_touch->sequence().count(), 2); QCOMPARE(m_touch->sequence().count(), 2);
@ -275,16 +275,16 @@ void TouchInputTest::testCancel()
QVERIFY(pointRemovedSpy.isValid()); QVERIFY(pointRemovedSpy.isValid());
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->touchDown(1, QPointF(125, 125), timestamp++); kwinApp()->platform()->touchDown(1, QPointF(125, 125), timestamp++);
QVERIFY(sequenceStartedSpy.wait()); QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1); QCOMPARE(sequenceStartedSpy.count(), 1);
// cancel // cancel
waylandServer()->backend()->touchCancel(); kwinApp()->platform()->touchCancel();
QVERIFY(cancelSpy.wait()); QVERIFY(cancelSpy.wait());
QCOMPARE(cancelSpy.count(), 1); QCOMPARE(cancelSpy.count(), 1);
waylandServer()->backend()->touchUp(1, timestamp++); kwinApp()->platform()->touchUp(1, timestamp++);
QVERIFY(!pointRemovedSpy.wait(100)); QVERIFY(!pointRemovedSpy.wait(100));
QCOMPARE(pointRemovedSpy.count(), 0); QCOMPARE(pointRemovedSpy.count(), 0);
} }
@ -307,14 +307,14 @@ void TouchInputTest::testTouchMouseAction()
QVERIFY(sequenceStartedSpy.isValid()); QVERIFY(sequenceStartedSpy.isValid());
quint32 timestamp = 1; quint32 timestamp = 1;
waylandServer()->backend()->touchDown(1, c1->geometry().center(), timestamp++); kwinApp()->platform()->touchDown(1, c1->geometry().center(), timestamp++);
QVERIFY(c1->isActive()); QVERIFY(c1->isActive());
QVERIFY(sequenceStartedSpy.wait()); QVERIFY(sequenceStartedSpy.wait());
QCOMPARE(sequenceStartedSpy.count(), 1); QCOMPARE(sequenceStartedSpy.count(), 1);
// cleanup // cleanup
waylandServer()->backend()->touchCancel(); kwinApp()->platform()->touchCancel();
} }
} }

View File

@ -61,7 +61,7 @@ void TransientNoInputTest::initTestCase()
qRegisterMetaType<KWin::ShellClient*>(); qRegisterMetaType<KWin::ShellClient*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();
QVERIFY(workspaceCreatedSpy.wait()); QVERIFY(workspaceCreatedSpy.wait());

View File

@ -79,8 +79,8 @@ void TransientPlacementTest::initTestCase()
qRegisterMetaType<KWin::AbstractClient*>(); qRegisterMetaType<KWin::AbstractClient*>();
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
QVERIFY(workspaceCreatedSpy.isValid()); QVERIFY(workspaceCreatedSpy.isValid());
waylandServer()->backend()->setInitialWindowSize(QSize(1280, 1024)); kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
QMetaObject::invokeMethod(waylandServer()->backend(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2)); QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
waylandServer()->init(s_socketName.toLocal8Bit()); waylandServer()->init(s_socketName.toLocal8Bit());
kwinApp()->start(); kwinApp()->start();

View File

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "screens_hwcomposer.h" #include "screens_hwcomposer.h"
#include "composite.h" #include "composite.h"
#include "input.h" #include "input.h"
#include "main.h"
#include "virtual_terminal.h" #include "virtual_terminal.h"
#include "wayland_server.h" #include "wayland_server.h"
// KWayland // KWayland
@ -225,7 +226,7 @@ void HwcomposerBackend::init()
if (disp != 0) { if (disp != 0) {
return; return;
} }
dynamic_cast<HwcomposerBackend*>(waylandServer()->backend())->wakeVSync(); dynamic_cast<HwcomposerBackend*>(kwinApp()->platform())->wakeVSync();
}; };
procs->hotplug = [] (const struct hwc_procs* procs, int disp, int connected) { procs->hotplug = [] (const struct hwc_procs* procs, int disp, int connected) {
Q_UNUSED(procs) Q_UNUSED(procs)

View File

@ -116,10 +116,10 @@ Compositor::Compositor(QObject* workspace)
m_unusedSupportPropertyTimer.setSingleShot(true); m_unusedSupportPropertyTimer.setSingleShot(true);
connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteUnusedSupportProperties())); connect(&m_unusedSupportPropertyTimer, SIGNAL(timeout()), SLOT(deleteUnusedSupportProperties()));
if (kwinApp()->operationMode() != Application::OperationModeX11) { if (kwinApp()->operationMode() != Application::OperationModeX11) {
if (waylandServer()->backend()->isReady()) { if (kwinApp()->platform()->isReady()) {
QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection); QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection);
} }
connect(waylandServer()->backend(), &AbstractBackend::readyChanged, this, connect(kwinApp()->platform(), &AbstractBackend::readyChanged, this,
[this] (bool ready) { [this] (bool ready) {
if (ready) { if (ready) {
setup(); setup();
@ -649,7 +649,7 @@ void Compositor::performCompositing()
// If outputs are disabled, we return to the event loop and // If outputs are disabled, we return to the event loop and
// continue processing events until the outputs are enabled again // continue processing events until the outputs are enabled again
if (waylandServer() && !waylandServer()->backend()->areOutputsEnabled()) { if (waylandServer() && !kwinApp()->platform()->areOutputsEnabled()) {
compositeTimer.stop(); compositeTimer.stop();
return; return;
} }
@ -796,7 +796,7 @@ void Compositor::setCompositeTimer()
return; return;
// Don't start the timer if all outputs are disabled // Don't start the timer if all outputs are disabled
if (waylandServer() && !waylandServer()->backend()->areOutputsEnabled()) { if (waylandServer() && !kwinApp()->platform()->areOutputsEnabled()) {
return; return;
} }

View File

@ -84,7 +84,7 @@ ApplicationWayland::~ApplicationWayland()
return; return;
} }
waylandServer()->backend()->setOutputsEnabled(false); kwinApp()->platform()->setOutputsEnabled(false);
destroyWorkspace(); destroyWorkspace();
waylandServer()->dispatch(); waylandServer()->dispatch();
// need to unload all effects prior to destroying X connection as they might do X calls // need to unload all effects prior to destroying X connection as they might do X calls
@ -130,7 +130,7 @@ void ApplicationWayland::setupCrashHandler()
void ApplicationWayland::createBackend() void ApplicationWayland::createBackend()
{ {
AbstractBackend *backend = waylandServer()->backend(); AbstractBackend *backend = kwinApp()->platform();
connect(backend, &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens); connect(backend, &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
connect(backend, &AbstractBackend::initFailed, this, connect(backend, &AbstractBackend::initFailed, this,
[] () { [] () {
@ -143,7 +143,7 @@ void ApplicationWayland::createBackend()
void ApplicationWayland::continueStartupWithScreens() void ApplicationWayland::continueStartupWithScreens()
{ {
disconnect(waylandServer()->backend(), &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens); disconnect(kwinApp()->platform(), &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
createScreens(); createScreens();
waylandServer()->initOutputs(); waylandServer()->initOutputs();
@ -699,12 +699,12 @@ int main(int argc, char * argv[])
return 1; return 1;
} }
if (!deviceIdentifier.isEmpty()) { if (!deviceIdentifier.isEmpty()) {
server->backend()->setDeviceIdentifier(deviceIdentifier); a.platform()->setDeviceIdentifier(deviceIdentifier);
} }
if (initialWindowSize.isValid()) { if (initialWindowSize.isValid()) {
server->backend()->setInitialWindowSize(initialWindowSize); a.platform()->setInitialWindowSize(initialWindowSize);
} }
server->backend()->setInitialOutputCount(outputCount); a.platform()->setInitialOutputCount(outputCount);
QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace); QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace);
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->display()->socketName()); environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->display()->socketName());

View File

@ -145,7 +145,7 @@ QPlatformNativeInterface *Integration::nativeInterface() const
QPlatformOpenGLContext *Integration::createPlatformOpenGLContext(QOpenGLContext *context) const QPlatformOpenGLContext *Integration::createPlatformOpenGLContext(QOpenGLContext *context) const
{ {
if (waylandServer()->backend()->supportsQpaContext()) { if (kwinApp()->platform()->supportsQpaContext()) {
return new SharingPlatformContext(context, const_cast<Integration*>(this)); return new SharingPlatformContext(context, const_cast<Integration*>(this));
} }
if (m_eglDisplay == EGL_NO_DISPLAY) { if (m_eglDisplay == EGL_NO_DISPLAY) {

View File

@ -33,7 +33,7 @@ namespace QPA
{ {
SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context, Integration *integration) SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context, Integration *integration)
: AbstractPlatformContext(context, integration, waylandServer()->backend()->sceneEglDisplay()) : AbstractPlatformContext(context, integration, kwinApp()->platform()->sceneEglDisplay())
{ {
create(); create();
} }
@ -85,7 +85,7 @@ void SharingPlatformContext::create()
if (!bindApi()) { if (!bindApi()) {
return; return;
} }
createContext(waylandServer()->backend()->sceneEglContext()); createContext(kwinApp()->platform()->sceneEglContext());
} }
} }

View File

@ -122,7 +122,7 @@ void PointerInputRedirection::init()
Q_ASSERT(!m_inited); Q_ASSERT(!m_inited);
m_cursor = new CursorImage(this); m_cursor = new CursorImage(this);
m_inited = true; m_inited = true;
connect(m_cursor, &CursorImage::changed, waylandServer()->backend(), &AbstractBackend::cursorChanged); connect(m_cursor, &CursorImage::changed, kwinApp()->platform(), &AbstractBackend::cursorChanged);
emit m_cursor->changed(); emit m_cursor->changed();
connect(workspace(), &Workspace::stackingOrderChanged, this, &PointerInputRedirection::update); connect(workspace(), &Workspace::stackingOrderChanged, this, &PointerInputRedirection::update);
connect(screens(), &Screens::changed, this, &PointerInputRedirection::updateAfterScreenChange); connect(screens(), &Screens::changed, this, &PointerInputRedirection::updateAfterScreenChange);
@ -437,7 +437,7 @@ void PointerInputRedirection::updateButton(uint32_t button, InputRedirection::Po
void PointerInputRedirection::warp(const QPointF &pos) void PointerInputRedirection::warp(const QPointF &pos)
{ {
if (supportsWarping()) { if (supportsWarping()) {
waylandServer()->backend()->warpPointer(pos); kwinApp()->platform()->warpPointer(pos);
processMotion(pos, waylandServer()->seat()->timestamp()); processMotion(pos, waylandServer()->seat()->timestamp());
} }
} }
@ -450,7 +450,7 @@ bool PointerInputRedirection::supportsWarping() const
if (m_supportsWarping) { if (m_supportsWarping) {
return true; return true;
} }
if (waylandServer()->backend()->supportsPointerWarping()) { if (kwinApp()->platform()->supportsPointerWarping()) {
return true; return true;
} }
return false; return false;

View File

@ -572,7 +572,7 @@ SceneOpenGL *SceneOpenGL::createScene(QObject *parent)
break; break;
case EglPlatformInterface: case EglPlatformInterface:
if (kwinApp()->shouldUseWaylandForCompositing()) { if (kwinApp()->shouldUseWaylandForCompositing()) {
backend = waylandServer()->backend()->createOpenGLBackend(); backend = kwinApp()->platform()->createOpenGLBackend();
} else { } else {
backend = new EglOnXBackend(); backend = new EglOnXBackend();
} }

View File

@ -96,7 +96,7 @@ SceneQPainter *SceneQPainter::createScene(QObject *parent)
{ {
QScopedPointer<QPainterBackend> backend; QScopedPointer<QPainterBackend> backend;
if (kwinApp()->shouldUseWaylandForCompositing()) { if (kwinApp()->shouldUseWaylandForCompositing()) {
backend.reset(waylandServer()->backend()->createQPainterBackend()); backend.reset(kwinApp()->platform()->createQPainterBackend());
if (backend.isNull()) { if (backend.isNull()) {
return nullptr; return nullptr;
} }

View File

@ -43,7 +43,7 @@ Screens *Screens::create(QObject *parent)
s_self = new MockScreens(parent); s_self = new MockScreens(parent);
#else #else
if (kwinApp()->shouldUseWaylandForCompositing()) { if (kwinApp()->shouldUseWaylandForCompositing()) {
s_self = waylandServer()->backend()->createScreens(parent); s_self = kwinApp()->platform()->createScreens(parent);
} }
if (kwinApp()->operationMode() == Application::OperationModeX11) { if (kwinApp()->operationMode() == Application::OperationModeX11) {
s_self = new XRandRScreens(parent); s_self = new XRandRScreens(parent);