Commit 4bfb0acc authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Make Workspace track managed outputs

This change adjusts the window management abstractions in kwin for the
drm backend providing more than just "desktop" outputs.

Besides that, it has other potential benefits - for example, the
Workspace could start managing allocation of the placeholder output by
itself, thus leading to some simplifications in the drm backend. Another
is that it lets us move wayland code from the drm backend.
parent 724d6761
......@@ -56,7 +56,7 @@ void ActivationTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -57,7 +57,7 @@ void ActivitiesTest::initTestCase()
kwinApp()->setUseKActivities(true);
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -57,7 +57,7 @@ void DebugConsoleTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -138,7 +138,7 @@ void DecorationInputTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -51,7 +51,7 @@ void X11DesktopWindowTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -57,7 +57,7 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase()
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -49,7 +49,7 @@ void DontCrashEmptyDecorationTest::initTestCase()
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -58,7 +58,7 @@ void DontCrashNoBorder::initTestCase()
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -66,7 +66,7 @@ void DontCrashReinitializeCompositorTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -58,7 +58,7 @@ void TestDontCrashUseractionsMenu::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -57,7 +57,7 @@ void InputStackingOrderTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -89,7 +89,7 @@ void InputMethodTest::initTestCase()
static_cast<WaylandTestApplication *>(kwinApp())->setInputMethodServerToStart("internal");
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -188,7 +188,7 @@ void InternalWindowTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -61,7 +61,7 @@ void LayerShellV1WindowTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -187,7 +187,7 @@ void LockScreenTest::initTestCase()
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -58,7 +58,7 @@ void TestMaximized::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -86,7 +86,7 @@ void MoveResizeWindowTest::initTestCase()
QVERIFY(waylandServer()->init(s_socketName));
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 1);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
}
......
......@@ -47,7 +47,7 @@ void OutputChangesTest::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......
......@@ -87,7 +87,7 @@ void TestPlacement::initTestCase()
kwinApp()->start();
QVERIFY(applicationStartedSpy.wait());
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
......@@ -348,7 +348,7 @@ void TestPlacement::testPlaceRandom()
void TestPlacement::testFullscreen()
{
const QVector<Output *> outputs = kwinApp()->platform()->enabledOutputs();
const QList<Output *> outputs = workspace()->outputs();
setPlacementPolicy(Placement::Smart);
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
......
......@@ -204,7 +204,7 @@ void PlasmaSurfaceTest::testOSDPlacement()
Q_ARG(QVector<QRect>, geometries));
QVERIFY(screensChangedSpy.wait());
QCOMPARE(screensChangedSpy.count(), 2);
const auto outputs = kwinApp()->platform()->enabledOutputs();
const auto outputs = workspace()->outputs();
QCOMPARE(outputs.count(), 2);
QCOMPARE(outputs[0]->geometry(), geometries[0]);
QCOMPARE(outputs[1]->geometry(), geometries[1]);
......@@ -272,7 +272,7 @@ void PlasmaSurfaceTest::testPanelTypeHasStrut()
auto window = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
// the panel is on the first output and the current desktop
Output *output = kwinApp()->platform()->enabledOutputs().constFirst();
Output *output = workspace()->outputs().constFirst();
VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop();
QVERIFY(window);
......@@ -323,7 +323,7 @@ void PlasmaSurfaceTest::testPanelWindowsCanCover()
auto panel = Test::renderAndWaitForShown(surface.data(), panelGeometry.size(), Qt::blue);
// the panel is on the first output and the current desktop
Output *output = kwinApp()->platform()->enabledOutputs().constFirst();
Output *output = workspace()->outputs().constFirst();
VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop();
QVERIFY(panel);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment