[platforms/virtual] Add virtual output class
Summary: This matches the DRM backend more closely and allows mid-test removal and addition of virtual outputs with different properties in the future. Test Plan: Before and after 93% tests passed. Reviewers: #kwin, graesslin Reviewed By: #kwin, graesslin Subscribers: graesslin, kwin, #kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D11351
This commit is contained in:
parent
d3aa33b51b
commit
8136c2722b
37 changed files with 203 additions and 79 deletions
|
@ -60,7 +60,7 @@ void ActivitiesTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->setUseKActivities(true);
|
||||
|
|
|
@ -49,7 +49,7 @@ void ColorCorrectNightColorTest::initTestCase()
|
|||
{
|
||||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
|
|
|
@ -62,7 +62,7 @@ void DebugConsoleTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -131,7 +131,7 @@ void DecorationInputTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// change some options
|
||||
|
|
|
@ -58,7 +58,7 @@ void X11DesktopWindowTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -59,7 +59,7 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
|
|
|
@ -56,7 +56,7 @@ void DontCrashEmptyDecorationTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// this test needs to enforce OpenGL compositing to get into the crashy condition
|
||||
|
|
|
@ -63,7 +63,7 @@ void DontCrashNoBorder::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
|
|
|
@ -62,7 +62,7 @@ void TestDontCrashUseractionsMenu::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// force style to breeze as that's the one which triggered the crash
|
||||
|
|
|
@ -68,7 +68,7 @@ void InputStackingOrderTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -175,7 +175,7 @@ void InternalWindowTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ void LockScreenTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -61,7 +61,7 @@ void TestMaximized::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
|
|
|
@ -229,8 +229,9 @@ void PlasmaSurfaceTest::testOSDPlacement()
|
|||
QSignalSpy screensChangedSpy(screens(), &Screens::changed);
|
||||
QVERIFY(screensChangedSpy.isValid());
|
||||
const QVector<QRect> geometries{QRect(0, 0, 1280, 1024), QRect(1280, 0, 1280, 1024)};
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QVERIFY(screensChangedSpy.wait());
|
||||
QCOMPARE(screensChangedSpy.count(), 1);
|
||||
|
|
|
@ -75,7 +75,7 @@ void PlasmaWindowTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -76,7 +76,7 @@ void TestPointerConstraints::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// set custom config which disables the OnScreenNotification
|
||||
|
|
|
@ -92,7 +92,7 @@ void PointerInputTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
||||
|
@ -298,8 +298,9 @@ void PointerInputTest::testUpdateFocusAfterScreenChange()
|
|||
QSignalSpy screensChangedSpy(screens(), &Screens::changed);
|
||||
QVERIFY(screensChangedSpy.isValid());
|
||||
// now let's remove the screen containing the cursor
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, 1),
|
||||
Q_ARG(QVector<QRect>, QVector<QRect>{QRect(0, 0, 1280, 1024)}));
|
||||
QVERIFY(screensChangedSpy.wait());
|
||||
QCOMPARE(screens()->count(), 1);
|
||||
|
|
|
@ -98,7 +98,7 @@ void QuickTilingTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// set custom config which disables the Outline
|
||||
|
|
|
@ -96,8 +96,9 @@ void ScreenChangesTest::testScreenAddRemove()
|
|||
QSignalSpy screensChangedSpy(screens(), &Screens::changed);
|
||||
QVERIFY(screensChangedSpy.isValid());
|
||||
const QVector<QRect> geometries{QRect(0, 0, 1280, 1024), QRect(1280, 0, 1280, 1024)};
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QVERIFY(screensChangedSpy.wait());
|
||||
QCOMPARE(screensChangedSpy.count(), 1);
|
||||
|
@ -148,8 +149,9 @@ void ScreenChangesTest::testScreenAddRemove()
|
|||
QVERIFY(o2RemovedSpy.isValid());
|
||||
|
||||
const QVector<QRect> geometries2{QRect(0, 0, 1280, 1024)};
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, 1),
|
||||
Q_ARG(QVector<QRect>, geometries2));
|
||||
QVERIFY(screensChangedSpy.wait());
|
||||
QCOMPARE(screensChangedSpy.count(), 1);
|
||||
|
|
|
@ -57,7 +57,7 @@ void ScreenEdgeClientShowTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// set custom config which disable touch edge
|
||||
|
|
|
@ -54,7 +54,7 @@ void ShadeTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -74,7 +74,7 @@ void TestShellClientRules::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -102,7 +102,7 @@ void TestShellClient::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -74,7 +74,7 @@ void StrutsTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
// set custom config which disables the Outline
|
||||
|
@ -660,8 +660,9 @@ void StrutsTest::test363804()
|
|||
// this test verifies the condition described in BUG 363804
|
||||
// two screens in a vertical setup, aligned to right border with panel on the bottom screen
|
||||
const QVector<QRect> geometries{QRect(0, 0, 1920, 1080), QRect(554, 1080, 1366, 768)};
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QCOMPARE(screens()->geometry(0), geometries.at(0));
|
||||
QCOMPARE(screens()->geometry(1), geometries.at(1));
|
||||
|
@ -739,8 +740,9 @@ void StrutsTest::testLeftScreenSmallerBottomAligned()
|
|||
// what this test in addition tests is whether a window larger than the left screen is not placed into
|
||||
// the dead area
|
||||
const QVector<QRect> geometries{QRect(0, 282, 1366, 768), QRect(1366, 0, 1680, 1050)};
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QCOMPARE(screens()->geometry(0), geometries.at(0));
|
||||
QCOMPARE(screens()->geometry(1), geometries.at(1));
|
||||
|
@ -850,8 +852,9 @@ void StrutsTest::testWindowMoveWithPanelBetweenScreens()
|
|||
|
||||
// left screen must be smaller than right screen
|
||||
const QVector<QRect> geometries{QRect(0, 282, 1366, 768), QRect(1366, 0, 1680, 1050)};
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "outputGeometriesChanged",
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, 2),
|
||||
Q_ARG(QVector<QRect>, geometries));
|
||||
QCOMPARE(screens()->geometry(0), geometries.at(0));
|
||||
QCOMPARE(screens()->geometry(1), geometries.at(1));
|
||||
|
|
|
@ -62,7 +62,7 @@ void TouchInputTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -72,7 +72,7 @@ void TransientPlacementTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -57,7 +57,7 @@ void WindowRuleTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -69,7 +69,7 @@ void TestWindowSelection::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
qputenv("XKB_DEFAULT_RULES", "evdev");
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void XClipboardSyncTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -57,7 +57,7 @@ void XWaylandInputTest::initTestCase()
|
|||
QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated);
|
||||
QVERIFY(workspaceCreatedSpy.isValid());
|
||||
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setOutputCount", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
|
||||
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
|
||||
|
||||
kwinApp()->start();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
set(VIRTUAL_SOURCES
|
||||
egl_gbm_backend.cpp
|
||||
virtual_backend.cpp
|
||||
virtual_output.cpp
|
||||
scene_qpainter_virtual_backend.cpp
|
||||
screens_virtual.cpp
|
||||
)
|
||||
|
|
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
#include "screens_virtual.h"
|
||||
#include "virtual_backend.h"
|
||||
#include "virtual_output.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -35,28 +36,27 @@ void VirtualScreens::init()
|
|||
{
|
||||
updateCount();
|
||||
KWin::Screens::init();
|
||||
connect(m_backend, &VirtualBackend::sizeChanged,
|
||||
this, &VirtualScreens::startChangedTimer);
|
||||
connect(m_backend, &VirtualBackend::outputGeometriesChanged, this,
|
||||
[this] (const QVector<QRect> &geometries) {
|
||||
const int oldCount = m_geometries.count();
|
||||
m_geometries = geometries;
|
||||
if (oldCount != m_geometries.count()) {
|
||||
setCount(m_geometries.count());
|
||||
|
||||
connect(m_backend, &VirtualBackend::virtualOutputsSet, this,
|
||||
[this] (bool countChanged) {
|
||||
if (countChanged) {
|
||||
setCount(m_backend->outputCount());
|
||||
} else {
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
||||
QRect VirtualScreens::geometry(int screen) const
|
||||
{
|
||||
if (screen >= m_geometries.count()) {
|
||||
const auto outputs = m_backend->outputs();
|
||||
if (screen >= outputs.size()) {
|
||||
return QRect();
|
||||
}
|
||||
return m_geometries.at(screen);
|
||||
return outputs.at(screen).geometry();
|
||||
}
|
||||
|
||||
QSize VirtualScreens::size(int screen) const
|
||||
|
@ -66,11 +66,6 @@ QSize VirtualScreens::size(int screen) const
|
|||
|
||||
void VirtualScreens::updateCount()
|
||||
{
|
||||
m_geometries.clear();
|
||||
const QSize size = m_backend->size();
|
||||
for (int i = 0; i < m_backend->outputCount(); ++i) {
|
||||
m_geometries.append(QRect(size.width() * i, 0, size.width(), size.height()));
|
||||
}
|
||||
setCount(m_backend->outputCount());
|
||||
}
|
||||
|
||||
|
@ -78,8 +73,9 @@ int VirtualScreens::number(const QPoint &pos) const
|
|||
{
|
||||
int bestScreen = 0;
|
||||
int minDistance = INT_MAX;
|
||||
for (int i = 0; i < m_geometries.count(); ++i) {
|
||||
const QRect &geo = m_geometries.at(i);
|
||||
const auto outputs = m_backend->outputs();
|
||||
for (int i = 0; i < outputs.size(); ++i) {
|
||||
const QRect &geo = outputs.at(i).geometry();
|
||||
if (geo.contains(pos)) {
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
private:
|
||||
void createOutputs();
|
||||
VirtualBackend *m_backend;
|
||||
QVector<QRect> m_geometries;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -68,12 +68,25 @@ VirtualBackend::~VirtualBackend()
|
|||
|
||||
void VirtualBackend::init()
|
||||
{
|
||||
/*
|
||||
* Some tests currently expect one output present at start,
|
||||
* others set them explicitly.
|
||||
*
|
||||
* TODO: rewrite all tests to explicitly set the outputs.
|
||||
*/
|
||||
if (!m_outputs.size()) {
|
||||
auto dummyOutput = VirtualOutput(this);
|
||||
dummyOutput.m_geo = QRect(QPoint(0, 0), initialWindowSize());
|
||||
m_outputs = { dummyOutput };
|
||||
}
|
||||
|
||||
|
||||
setSoftWareCursor(true);
|
||||
m_size = initialWindowSize();
|
||||
setReady(true);
|
||||
waylandServer()->seat()->setHasPointer(true);
|
||||
waylandServer()->seat()->setHasKeyboard(true);
|
||||
waylandServer()->seat()->setHasTouch(true);
|
||||
|
||||
emit screensQueried();
|
||||
}
|
||||
|
||||
|
@ -100,13 +113,34 @@ OpenGLBackend *VirtualBackend::createOpenGLBackend()
|
|||
return new EglGbmBackend(this);
|
||||
}
|
||||
|
||||
void VirtualBackend::setVirtualOutputs(int count, QVector<QRect> geometries)
|
||||
{
|
||||
Q_ASSERT(geometries.size() == 0 || geometries.size() == count);
|
||||
|
||||
bool countChanged = m_outputs.size() != count;
|
||||
m_outputs.resize(count);
|
||||
|
||||
int sumWidth = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
VirtualOutput& o = m_outputs[i];
|
||||
if (geometries.size()) {
|
||||
o.m_geo = geometries.at(i);
|
||||
} else if (!o.m_geo.isValid()) {
|
||||
o.m_geo = QRect(QPoint(sumWidth, 0), initialWindowSize());
|
||||
sumWidth += o.m_geo.width();
|
||||
}
|
||||
}
|
||||
|
||||
emit virtualOutputsSet(countChanged);
|
||||
}
|
||||
|
||||
int VirtualBackend::gammaRampSize(int screen) const {
|
||||
return m_gammaSizes[screen];
|
||||
return m_outputs[screen].m_gammaSize;
|
||||
}
|
||||
|
||||
bool VirtualBackend::setGammaRamp(int screen, ColorCorrect::GammaRamp &gamma) {
|
||||
Q_UNUSED(gamma);
|
||||
return m_gammaResults[screen];
|
||||
return m_outputs[screen].m_gammaResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef KWIN_VIRTUAL_BACKEND_H
|
||||
#define KWIN_VIRTUAL_BACKEND_H
|
||||
#include "platform.h"
|
||||
#include "virtual_output.h"
|
||||
|
||||
#include <kwin_export.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSize>
|
||||
#include <QRect>
|
||||
|
||||
class QTemporaryDir;
|
||||
|
||||
|
@ -32,28 +33,24 @@ struct gbm_device;
|
|||
|
||||
namespace KWin
|
||||
{
|
||||
namespace ColorCorrect {
|
||||
class Manager;
|
||||
struct GammaRamp;
|
||||
}
|
||||
|
||||
struct ColorCorrect::GammaRamp;
|
||||
|
||||
class KWIN_EXPORT VirtualBackend : public Platform
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(KWin::Platform)
|
||||
Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "virtual.json")
|
||||
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
|
||||
|
||||
public:
|
||||
VirtualBackend(QObject *parent = nullptr);
|
||||
virtual ~VirtualBackend();
|
||||
void init() override;
|
||||
|
||||
QSize size() const {
|
||||
return m_size;
|
||||
}
|
||||
int outputCount() const {
|
||||
return m_outputCount;
|
||||
return m_outputs.size();
|
||||
}
|
||||
const QVector<VirtualOutput> outputs() const {
|
||||
return m_outputs;
|
||||
}
|
||||
qreal outputScale() const {
|
||||
return m_outputScale;
|
||||
|
@ -68,11 +65,7 @@ public:
|
|||
QPainterBackend* createQPainterBackend() override;
|
||||
OpenGLBackend *createOpenGLBackend() override;
|
||||
|
||||
Q_INVOKABLE void setOutputCount(int count) {
|
||||
m_outputCount = count;
|
||||
m_gammaSizes = QVector<int>(count, 200);
|
||||
m_gammaResults = QVector<bool>(count, true);
|
||||
}
|
||||
Q_INVOKABLE void setVirtualOutputs(int count, QVector<QRect> geometries = QVector<QRect>());
|
||||
|
||||
Q_INVOKABLE void setOutputScale(qreal scale) {
|
||||
m_outputScale = scale;
|
||||
|
@ -99,19 +92,16 @@ public:
|
|||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
void sizeChanged();
|
||||
void outputGeometriesChanged(const QVector<QRect> &geometries);
|
||||
void virtualOutputsSet(bool countChanged);
|
||||
|
||||
private:
|
||||
QSize m_size;
|
||||
int m_outputCount = 1;
|
||||
QVector<VirtualOutput> m_outputs;
|
||||
|
||||
qreal m_outputScale = 1;
|
||||
|
||||
QScopedPointer<QTemporaryDir> m_screenshotDir;
|
||||
int m_drmFd = -1;
|
||||
gbm_device *m_gbmDevice = nullptr;
|
||||
|
||||
QVector<int> m_gammaSizes = QVector<int>(1, 200);
|
||||
QVector<bool> m_gammaResults = QVector<bool>(1, true);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
42
plugins/platforms/virtual/virtual_output.cpp
Normal file
42
plugins/platforms/virtual/virtual_output.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2018 Roman Gilg <subdiff@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "virtual_output.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
VirtualOutput::VirtualOutput(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
VirtualOutput::VirtualOutput(const VirtualOutput &o)
|
||||
: m_geo(o.m_geo),
|
||||
m_outputScale(o.m_outputScale),
|
||||
m_gammaSize(o.m_gammaSize),
|
||||
m_gammaResult(o.m_gammaResult)
|
||||
{
|
||||
}
|
||||
|
||||
VirtualOutput::~VirtualOutput()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
55
plugins/platforms/virtual/virtual_output.h
Normal file
55
plugins/platforms/virtual/virtual_output.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2018 Roman Gilg <subdiff@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_VIRTUAL_OUTPUT_H
|
||||
#define KWIN_VIRTUAL_OUTPUT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QRect>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
class VirtualBackend;
|
||||
|
||||
class VirtualOutput : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VirtualOutput(QObject *parent = nullptr);
|
||||
VirtualOutput(const VirtualOutput &o);
|
||||
virtual ~VirtualOutput();
|
||||
|
||||
QRect geometry() const {
|
||||
return m_geo;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class VirtualBackend;
|
||||
|
||||
QRect m_geo;
|
||||
qreal m_outputScale = 1;
|
||||
|
||||
int m_gammaSize = 200;
|
||||
bool m_gammaResult = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue