diff --git a/autotests/integration/activation_test.cpp b/autotests/integration/activation_test.cpp index 1bbac769c2..090b74ffdb 100644 --- a/autotests/integration/activation_test.cpp +++ b/autotests/integration/activation_test.cpp @@ -6,7 +6,6 @@ SPDX-License-Identifier: GPL-2.0-or-later */ - #include "kwin_wayland_test.h" #include "core/output.h" @@ -50,7 +49,10 @@ void ActivationTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); @@ -514,11 +516,7 @@ void ActivationTest::stackScreensHorizontally() QRect(0, 0, 1280, 1024), QRect(1280, 0, 1280, 1024), }; - - QMetaObject::invokeMethod(kwinApp()->outputBackend(), - "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, screenGeometries)); + Test::setOutputConfig(screenGeometries); } void ActivationTest::stackScreensVertically() @@ -530,11 +528,7 @@ void ActivationTest::stackScreensVertically() QRect(0, 0, 1280, 1024), QRect(0, 1024, 1280, 1024), }; - - QMetaObject::invokeMethod(kwinApp()->outputBackend(), - "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, screenGeometries)); + Test::setOutputConfig(screenGeometries); } } diff --git a/autotests/integration/activities_test.cpp b/autotests/integration/activities_test.cpp index 4f61ff862c..6b71b49e34 100644 --- a/autotests/integration/activities_test.cpp +++ b/autotests/integration/activities_test.cpp @@ -48,7 +48,10 @@ void ActivitiesTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setUseKActivities(true); kwinApp()->start(); diff --git a/autotests/integration/dbus_interface_test.cpp b/autotests/integration/dbus_interface_test.cpp index 0774e0362d..f5a79ce4eb 100644 --- a/autotests/integration/dbus_interface_test.cpp +++ b/autotests/integration/dbus_interface_test.cpp @@ -57,7 +57,10 @@ void TestDbusInterface::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/debug_console_test.cpp b/autotests/integration/debug_console_test.cpp index ca5bbb859f..5ce41d6c11 100644 --- a/autotests/integration/debug_console_test.cpp +++ b/autotests/integration/debug_console_test.cpp @@ -51,7 +51,10 @@ void DebugConsoleTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/decoration_input_test.cpp b/autotests/integration/decoration_input_test.cpp index c2fa21e6b7..6f9859d2c1 100644 --- a/autotests/integration/decoration_input_test.cpp +++ b/autotests/integration/decoration_input_test.cpp @@ -122,7 +122,10 @@ void DecorationInputTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // change some options KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/desktop_window_x11_test.cpp b/autotests/integration/desktop_window_x11_test.cpp index b77cc684f3..d0fd35ab1d 100644 --- a/autotests/integration/desktop_window_x11_test.cpp +++ b/autotests/integration/desktop_window_x11_test.cpp @@ -43,7 +43,10 @@ void X11DesktopWindowTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/dont_crash_aurorae_destroy_deco.cpp b/autotests/integration/dont_crash_aurorae_destroy_deco.cpp index 74a4b8297a..5793d04ba2 100644 --- a/autotests/integration/dont_crash_aurorae_destroy_deco.cpp +++ b/autotests/integration/dont_crash_aurorae_destroy_deco.cpp @@ -48,7 +48,10 @@ void DontCrashAuroraeDestroyDecoTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); config->group("org.kde.kdecoration2").writeEntry("library", "org.kde.kwin.aurorae"); diff --git a/autotests/integration/dont_crash_cancel_animation.cpp b/autotests/integration/dont_crash_cancel_animation.cpp index b23cc26d0d..f419803311 100644 --- a/autotests/integration/dont_crash_cancel_animation.cpp +++ b/autotests/integration/dont_crash_cancel_animation.cpp @@ -44,7 +44,10 @@ void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase() { qRegisterMetaType(); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(Compositor::self()); QSignalSpy compositorToggledSpy(Compositor::self(), &Compositor::compositingToggled); diff --git a/autotests/integration/dont_crash_empty_deco.cpp b/autotests/integration/dont_crash_empty_deco.cpp index b16dd430f9..383c207bca 100644 --- a/autotests/integration/dont_crash_empty_deco.cpp +++ b/autotests/integration/dont_crash_empty_deco.cpp @@ -45,7 +45,10 @@ void DontCrashEmptyDecorationTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // this test needs to enforce OpenGL compositing to get into the crashy condition qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2")); diff --git a/autotests/integration/dont_crash_glxgears.cpp b/autotests/integration/dont_crash_glxgears.cpp index 52312aafe7..38d8320a2f 100644 --- a/autotests/integration/dont_crash_glxgears.cpp +++ b/autotests/integration/dont_crash_glxgears.cpp @@ -34,7 +34,10 @@ void DontCrashGlxgearsTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); } diff --git a/autotests/integration/dont_crash_reinitialize_compositor.cpp b/autotests/integration/dont_crash_reinitialize_compositor.cpp index c39af64460..ac9cbe1b52 100644 --- a/autotests/integration/dont_crash_reinitialize_compositor.cpp +++ b/autotests/integration/dont_crash_reinitialize_compositor.cpp @@ -50,7 +50,10 @@ void DontCrashReinitializeCompositorTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup plugins(config, QStringLiteral("Plugins")); diff --git a/autotests/integration/dont_crash_useractions_menu.cpp b/autotests/integration/dont_crash_useractions_menu.cpp index 7726287757..9a9f73f70a 100644 --- a/autotests/integration/dont_crash_useractions_menu.cpp +++ b/autotests/integration/dont_crash_useractions_menu.cpp @@ -46,7 +46,10 @@ void TestDontCrashUseractionsMenu::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // force style to breeze as that's the one which triggered the crash QVERIFY(kwinApp()->setStyle(QStringLiteral("breeze"))); diff --git a/autotests/integration/effects/desktop_switching_animation_test.cpp b/autotests/integration/effects/desktop_switching_animation_test.cpp index 28547d415d..441cf25a54 100644 --- a/autotests/integration/effects/desktop_switching_animation_test.cpp +++ b/autotests/integration/effects/desktop_switching_animation_test.cpp @@ -49,7 +49,10 @@ void DesktopSwitchingAnimationTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup plugins(config, QStringLiteral("Plugins")); diff --git a/autotests/integration/effects/maximize_animation_test.cpp b/autotests/integration/effects/maximize_animation_test.cpp index 8f0fe0bea1..28cb97a7be 100644 --- a/autotests/integration/effects/maximize_animation_test.cpp +++ b/autotests/integration/effects/maximize_animation_test.cpp @@ -47,7 +47,10 @@ void MaximizeAnimationTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup plugins(config, QStringLiteral("Plugins")); diff --git a/autotests/integration/effects/minimize_animation_test.cpp b/autotests/integration/effects/minimize_animation_test.cpp index 412ba08925..889d4e0107 100644 --- a/autotests/integration/effects/minimize_animation_test.cpp +++ b/autotests/integration/effects/minimize_animation_test.cpp @@ -50,7 +50,10 @@ void MinimizeAnimationTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup plugins(config, QStringLiteral("Plugins")); diff --git a/autotests/integration/effects/popup_open_close_animation_test.cpp b/autotests/integration/effects/popup_open_close_animation_test.cpp index 11f1bc5604..f5d9aff4d8 100644 --- a/autotests/integration/effects/popup_open_close_animation_test.cpp +++ b/autotests/integration/effects/popup_open_close_animation_test.cpp @@ -50,7 +50,10 @@ void PopupOpenCloseAnimationTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup plugins(config, QStringLiteral("Plugins")); diff --git a/autotests/integration/effects/scripted_effects_test.cpp b/autotests/integration/effects/scripted_effects_test.cpp index aa8250c31e..1424853d03 100644 --- a/autotests/integration/effects/scripted_effects_test.cpp +++ b/autotests/integration/effects/scripted_effects_test.cpp @@ -133,7 +133,7 @@ void ScriptedEffectsTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024))); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); // disable all effects - we don't want to have it interact with the rendering auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/effects/slidingpopups_test.cpp b/autotests/integration/effects/slidingpopups_test.cpp index 08c7decd70..1d6ed8a642 100644 --- a/autotests/integration/effects/slidingpopups_test.cpp +++ b/autotests/integration/effects/slidingpopups_test.cpp @@ -55,7 +55,10 @@ void SlidingPopupsTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // disable all effects - we don't want to have it interact with the rendering auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/effects/toplevel_open_close_animation_test.cpp b/autotests/integration/effects/toplevel_open_close_animation_test.cpp index 3753ca74cd..2f2a500d2a 100644 --- a/autotests/integration/effects/toplevel_open_close_animation_test.cpp +++ b/autotests/integration/effects/toplevel_open_close_animation_test.cpp @@ -50,7 +50,10 @@ void ToplevelOpenCloseAnimationTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup plugins(config, QStringLiteral("Plugins")); diff --git a/autotests/integration/effects/translucency_test.cpp b/autotests/integration/effects/translucency_test.cpp index 0082781dc7..5cd6a611ab 100644 --- a/autotests/integration/effects/translucency_test.cpp +++ b/autotests/integration/effects/translucency_test.cpp @@ -48,7 +48,10 @@ void TranslucencyTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // disable all effects - we don't want to have it interact with the rendering auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/effects/wobbly_shade_test.cpp b/autotests/integration/effects/wobbly_shade_test.cpp index 52b640529d..ea3563c44a 100644 --- a/autotests/integration/effects/wobbly_shade_test.cpp +++ b/autotests/integration/effects/wobbly_shade_test.cpp @@ -52,7 +52,10 @@ void WobblyWindowsShadeTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // disable all effects - we don't want to have it interact with the rendering auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/fractional_scaling_test.cpp b/autotests/integration/fractional_scaling_test.cpp index d296b563a7..360407e76d 100644 --- a/autotests/integration/fractional_scaling_test.cpp +++ b/autotests/integration/fractional_scaling_test.cpp @@ -54,11 +54,16 @@ void TestFractionalScale::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), - "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024)), - Q_ARG(QVector, QVector() << 1.25 << 2.0)); + Test::setOutputConfig({ + Test::OutputInfo{ + .geometry = QRect(0, 0, 1280 / 1.25, 1024 / 1.25), + .scale = 1.25, + }, + Test::OutputInfo{ + .geometry = QRect(1280, 0, 1280 / 2, 1024 / 2), + .scale = 2.0, + }, + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/generic_scene_opengl_test.cpp b/autotests/integration/generic_scene_opengl_test.cpp index fcae045095..75e2382982 100644 --- a/autotests/integration/generic_scene_opengl_test.cpp +++ b/autotests/integration/generic_scene_opengl_test.cpp @@ -45,7 +45,10 @@ void GenericSceneOpenGLTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // disable all effects - we don't want to have it interact with the rendering auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/globalshortcuts_test.cpp b/autotests/integration/globalshortcuts_test.cpp index fbc8df4121..b4ba1cda84 100644 --- a/autotests/integration/globalshortcuts_test.cpp +++ b/autotests/integration/globalshortcuts_test.cpp @@ -61,7 +61,10 @@ void GlobalShortcutsTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); diff --git a/autotests/integration/idle_inhibition_test.cpp b/autotests/integration/idle_inhibition_test.cpp index 839bc60ff1..b17f5ab0ab 100644 --- a/autotests/integration/idle_inhibition_test.cpp +++ b/autotests/integration/idle_inhibition_test.cpp @@ -41,7 +41,10 @@ void TestIdleInhibition::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/input_stacking_order.cpp b/autotests/integration/input_stacking_order.cpp index 0df0211650..5a056d6fae 100644 --- a/autotests/integration/input_stacking_order.cpp +++ b/autotests/integration/input_stacking_order.cpp @@ -49,7 +49,10 @@ void InputStackingOrderTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index 3c39445e9b..14481f4ab4 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -83,7 +83,10 @@ void InputMethodTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); static_cast(kwinApp())->setInputMethodServerToStart("internal"); kwinApp()->start(); diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp index c8ef1ce35d..8b35a64602 100644 --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -173,7 +173,10 @@ void InternalWindowTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); kwinApp()->start(); @@ -638,6 +641,17 @@ void InternalWindowTest::testScale() Q_ARG(QVector, QVector({QRect(0, 0, 1280, 1024), QRect(1280 / 2, 0, 1280, 1024)})), Q_ARG(QVector, QVector({2, 2}))); + Test::setOutputConfig({ + Test::OutputInfo{ + .geometry = QRect(0, 0, 1280, 1024), + .scale = 2.0, + }, + Test::OutputInfo{ + .geometry = QRect(1280, 0, 1280, 1024), + .scale = 2.0, + }, + }); + QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded); HelperWindow win; win.setGeometry(0, 0, 100, 100); diff --git a/autotests/integration/keyboard_layout_test.cpp b/autotests/integration/keyboard_layout_test.cpp index 3849b80337..c750f112b8 100644 --- a/autotests/integration/keyboard_layout_test.cpp +++ b/autotests/integration/keyboard_layout_test.cpp @@ -133,7 +133,10 @@ void KeyboardLayoutTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); kwinApp()->setKxkbConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); diff --git a/autotests/integration/keymap_creation_failure_test.cpp b/autotests/integration/keymap_creation_failure_test.cpp index 26464269e8..d3d1ffd453 100644 --- a/autotests/integration/keymap_creation_failure_test.cpp +++ b/autotests/integration/keymap_creation_failure_test.cpp @@ -49,7 +49,10 @@ void KeymapCreationFailureTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); kwinApp()->setKxkbConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); diff --git a/autotests/integration/kwin_wayland_test.cpp b/autotests/integration/kwin_wayland_test.cpp index 0291396034..3a09f96ba7 100644 --- a/autotests/integration/kwin_wayland_test.cpp +++ b/autotests/integration/kwin_wayland_test.cpp @@ -211,4 +211,27 @@ void Test::FractionalScaleV1::wp_fractional_scale_v1_preferred_scale(uint32_t sc { m_preferredScale = scale; } + +void Test::setOutputConfig(const QVector &geometries) +{ + QVector converted; + std::transform(geometries.begin(), geometries.end(), std::back_inserter(converted), [](const auto &geometry) { + return VirtualBackend::OutputInfo{ + .geometry = geometry, + }; + }); + static_cast(kwinApp()->outputBackend())->setVirtualOutputs(converted); +} + +void Test::setOutputConfig(const QVector &infos) +{ + QVector converted; + std::transform(infos.begin(), infos.end(), std::back_inserter(converted), [](const auto &info) { + return VirtualBackend::OutputInfo{ + .geometry = info.geometry, + .scale = info.scale, + }; + }); + static_cast(kwinApp()->outputBackend())->setVirtualOutputs(converted); +} } diff --git a/autotests/integration/kwin_wayland_test.h b/autotests/integration/kwin_wayland_test.h index 3eec1d9d1a..a089c69a8c 100644 --- a/autotests/integration/kwin_wayland_test.h +++ b/autotests/integration/kwin_wayland_test.h @@ -786,6 +786,14 @@ public: return stream; } }; + +struct OutputInfo +{ + QRect geometry; + double scale = 1; +}; +void setOutputConfig(const QVector &geometries); +void setOutputConfig(const QVector &infos); } } diff --git a/autotests/integration/kwinbindings_test.cpp b/autotests/integration/kwinbindings_test.cpp index e73f60b816..bf555a9432 100644 --- a/autotests/integration/kwinbindings_test.cpp +++ b/autotests/integration/kwinbindings_test.cpp @@ -47,7 +47,10 @@ void KWinBindingsTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); diff --git a/autotests/integration/layershellv1window_test.cpp b/autotests/integration/layershellv1window_test.cpp index 1ddf430a50..61e6c28ef7 100644 --- a/autotests/integration/layershellv1window_test.cpp +++ b/autotests/integration/layershellv1window_test.cpp @@ -56,7 +56,10 @@ void LayerShellV1WindowTest::initTestCase() { QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp index 4471e3bd1a..55834f20e3 100644 --- a/autotests/integration/lockscreen.cpp +++ b/autotests/integration/lockscreen.cpp @@ -179,7 +179,10 @@ void LockScreenTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/maximize_test.cpp b/autotests/integration/maximize_test.cpp index 9d793e74dd..48e5fb1121 100644 --- a/autotests/integration/maximize_test.cpp +++ b/autotests/integration/maximize_test.cpp @@ -49,7 +49,10 @@ void TestMaximized::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); diff --git a/autotests/integration/modifier_only_shortcut_test.cpp b/autotests/integration/modifier_only_shortcut_test.cpp index a0260e2458..7d1653a022 100644 --- a/autotests/integration/modifier_only_shortcut_test.cpp +++ b/autotests/integration/modifier_only_shortcut_test.cpp @@ -83,7 +83,10 @@ void ModifierOnlyShortcutTest::initTestCase() { QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index 2ccfb6312d..5dc37445d7 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -84,7 +84,7 @@ void MoveResizeWindowTest::initTestCase() qRegisterMetaType("MaximizeMode"); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024))); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); const auto outputs = workspace()->outputs(); diff --git a/autotests/integration/no_global_shortcuts_test.cpp b/autotests/integration/no_global_shortcuts_test.cpp index 29b68a9d53..9a99bbe44c 100644 --- a/autotests/integration/no_global_shortcuts_test.cpp +++ b/autotests/integration/no_global_shortcuts_test.cpp @@ -91,7 +91,10 @@ void NoGlobalShortcutsTest::initTestCase() qRegisterMetaType("ElectricBorder"); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName, KWin::WaylandServer::InitializationFlag::NoGlobalShortcuts)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); diff --git a/autotests/integration/outputchanges_test.cpp b/autotests/integration/outputchanges_test.cpp index fb9b4a5424..6639d1665c 100644 --- a/autotests/integration/outputchanges_test.cpp +++ b/autotests/integration/outputchanges_test.cpp @@ -51,7 +51,10 @@ void OutputChangesTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); @@ -63,7 +66,10 @@ void OutputChangesTest::initTestCase() void OutputChangesTest::init() { - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); QVERIFY(Test::setupWaylandConnection()); workspace()->setActiveOutput(QPoint(640, 512)); diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp index 2c5c7022b1..300699a61e 100644 --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -84,7 +84,10 @@ void TestPlacement::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp index 5c379f618a..4cef4c08ff 100644 --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -15,6 +15,7 @@ #include "wayland_server.h" #include "window.h" #include "workspace.h" + #include #include #include @@ -61,7 +62,7 @@ void PlasmaSurfaceTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024))); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); @@ -194,9 +195,7 @@ void PlasmaSurfaceTest::testOSDPlacement() // change the screen size const QVector geometries{QRect(0, 0, 1280, 1024), QRect(1280, 0, 1280, 1024)}; - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); const auto outputs = workspace()->outputs(); QCOMPARE(outputs.count(), 2); QCOMPARE(outputs[0]->geometry(), geometries[0]); diff --git a/autotests/integration/plasmawindow_test.cpp b/autotests/integration/plasmawindow_test.cpp index e5be364c93..5f9b671296 100644 --- a/autotests/integration/plasmawindow_test.cpp +++ b/autotests/integration/plasmawindow_test.cpp @@ -59,7 +59,10 @@ void PlasmaWindowTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/platformcursor.cpp b/autotests/integration/platformcursor.cpp index 552f8b5193..ba2ac407f4 100644 --- a/autotests/integration/platformcursor.cpp +++ b/autotests/integration/platformcursor.cpp @@ -29,7 +29,10 @@ void PlatformCursorTest::initTestCase() { QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp index f947ec1636..04502f9b14 100644 --- a/autotests/integration/pointer_constraints_test.cpp +++ b/autotests/integration/pointer_constraints_test.cpp @@ -59,7 +59,10 @@ void TestPointerConstraints::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // set custom config which disables the OnScreenNotification KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index 876308db4f..31311293e1 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -133,7 +133,10 @@ void PointerInputTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); @@ -331,9 +334,7 @@ void PointerInputTest::testUpdateFocusAfterScreenChange() QVERIFY(leftSpy.wait()); // now let's remove the screen containing the cursor - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, QVector{QRect(0, 0, 1280, 1024)})); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); QCOMPARE(workspace()->outputs().count(), 1); // this should have warped the cursor @@ -545,7 +546,10 @@ void PointerInputTest::testModifierClickUnrestrictedFullscreenMove() { // this test ensures that Meta+mouse button press triggers unrestricted move for fullscreen windows if (workspace()->outputs().size() < 2) { - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); } // first modify the config for this run @@ -1513,7 +1517,7 @@ void PointerInputTest::testConfineToScreenGeometry() QRect(1280, 0, 1280, 1024), QRect(2560, 0, 1280, 1024), QRect(1280, 1024, 1280, 1024)}; - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); const auto outputs = workspace()->outputs(); QCOMPARE(outputs.count(), geometries.count()); diff --git a/autotests/integration/quick_tiling_test.cpp b/autotests/integration/quick_tiling_test.cpp index 935dccb575..9de63b1944 100644 --- a/autotests/integration/quick_tiling_test.cpp +++ b/autotests/integration/quick_tiling_test.cpp @@ -86,7 +86,10 @@ void QuickTilingTest::initTestCase() qRegisterMetaType("MaximizeMode"); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // set custom config which disables the Outline KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/screen_changes_test.cpp b/autotests/integration/screen_changes_test.cpp index 7d9beb6a61..7c88062e6a 100644 --- a/autotests/integration/screen_changes_test.cpp +++ b/autotests/integration/screen_changes_test.cpp @@ -37,7 +37,7 @@ void ScreenChangesTest::initTestCase() { QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024))); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); @@ -82,9 +82,7 @@ void ScreenChangesTest::testScreenAddRemove() // let's announce a new output const QVector geometries{QRect(0, 0, 1280, 1024), QRect(1280, 0, 1280, 1024)}; - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); auto outputs = workspace()->outputs(); QCOMPARE(outputs.count(), 2); QCOMPARE(outputs[0]->geometry(), geometries[0]); @@ -148,9 +146,7 @@ void ScreenChangesTest::testScreenAddRemove() QSignalSpy o2RemovedSpy(o2.get(), &KWayland::Client::Output::removed); const QVector geometries2{QRect(0, 0, 1280, 1024)}; - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, geometries2)); + Test::setOutputConfig(geometries2); outputs = workspace()->outputs(); QCOMPARE(outputs.count(), 1); QCOMPARE(outputs[0]->geometry(), geometries2.at(0)); diff --git a/autotests/integration/screenedges_test.cpp b/autotests/integration/screenedges_test.cpp index 0285d864d3..725a41feb7 100644 --- a/autotests/integration/screenedges_test.cpp +++ b/autotests/integration/screenedges_test.cpp @@ -76,7 +76,7 @@ void ScreenEdgesTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024))); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); // Disable effects, in particular present windows, which reserves a screen edge. auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/screens_test.cpp b/autotests/integration/screens_test.cpp index 3ec4ec6de2..03b1752f20 100644 --- a/autotests/integration/screens_test.cpp +++ b/autotests/integration/screens_test.cpp @@ -44,7 +44,10 @@ void ScreensTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); @@ -84,7 +87,10 @@ void ScreensTest::cleanup() workspace()->slotReconfigure(); // Reset the screen layout of the test environment. - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); } void ScreensTest::testCurrent_data() @@ -131,7 +137,7 @@ void ScreensTest::testCurrentWithFollowsMouse() workspace()->slotReconfigure(); QFETCH(QVector, geometries); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); QFETCH(QPoint, cursorPos); KWin::input()->pointer()->warp(cursorPos); @@ -156,7 +162,7 @@ void ScreensTest::testCurrentPoint_data() void ScreensTest::testCurrentPoint() { QFETCH(QVector, geometries); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); // Disable "active screen follows mouse" auto group = kwinApp()->config()->group("Windows"); diff --git a/autotests/integration/scripting/minimizeall_test.cpp b/autotests/integration/scripting/minimizeall_test.cpp index f557c46e04..0d10fc78a0 100644 --- a/autotests/integration/scripting/minimizeall_test.cpp +++ b/autotests/integration/scripting/minimizeall_test.cpp @@ -47,7 +47,10 @@ void MinimizeAllScriptTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/scripting/screenedge_test.cpp b/autotests/integration/scripting/screenedge_test.cpp index bcc2b4d6ba..bd4c66cae5 100644 --- a/autotests/integration/scripting/screenedge_test.cpp +++ b/autotests/integration/scripting/screenedge_test.cpp @@ -50,7 +50,7 @@ void ScreenEdgeTest::initTestCase() { QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024))); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); // empty config to have defaults auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); diff --git a/autotests/integration/shade_test.cpp b/autotests/integration/shade_test.cpp index 9fe5698bef..d993d92ac4 100644 --- a/autotests/integration/shade_test.cpp +++ b/autotests/integration/shade_test.cpp @@ -40,7 +40,10 @@ void ShadeTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/showing_desktop_test.cpp b/autotests/integration/showing_desktop_test.cpp index 5e4ec63c6e..7ffc10bbce 100644 --- a/autotests/integration/showing_desktop_test.cpp +++ b/autotests/integration/showing_desktop_test.cpp @@ -37,7 +37,10 @@ void ShowingDesktopTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/stacking_order_test.cpp b/autotests/integration/stacking_order_test.cpp index e03daf1ae8..0f7f1e9a1b 100644 --- a/autotests/integration/stacking_order_test.cpp +++ b/autotests/integration/stacking_order_test.cpp @@ -55,7 +55,10 @@ void StackingOrderTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); diff --git a/autotests/integration/struts_test.cpp b/autotests/integration/struts_test.cpp index 149e0a8d78..9692793223 100644 --- a/autotests/integration/struts_test.cpp +++ b/autotests/integration/struts_test.cpp @@ -61,7 +61,10 @@ void StrutsTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); // set custom config which disables the Outline KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); @@ -667,9 +670,7 @@ 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 geometries{QRect(0, 0, 1920, 1080), QRect(554, 1080, 1366, 768)}; - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); QCOMPARE(workspace()->geometry(), QRect(0, 0, 1920, 1848)); VirtualDesktop *desktop = VirtualDesktopManager::self()->currentDesktop(); @@ -748,9 +749,7 @@ 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 geometries{QRect(0, 282, 1366, 768), QRect(1366, 0, 1680, 1050)}; - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); QCOMPARE(workspace()->geometry(), QRect(0, 0, 3046, 1050)); const QList outputs = workspace()->outputs(); @@ -861,9 +860,7 @@ void StrutsTest::testWindowMoveWithPanelBetweenScreens() // left screen must be smaller than right screen const QVector geometries{QRect(0, 282, 1366, 768), QRect(1366, 0, 1680, 1050)}; - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", - Qt::DirectConnection, - Q_ARG(QVector, geometries)); + Test::setOutputConfig(geometries); QCOMPARE(workspace()->geometry(), QRect(0, 0, 3046, 1050)); const QList outputs = workspace()->outputs(); diff --git a/autotests/integration/tabbox_test.cpp b/autotests/integration/tabbox_test.cpp index dbd79fe324..d7c3690368 100644 --- a/autotests/integration/tabbox_test.cpp +++ b/autotests/integration/tabbox_test.cpp @@ -43,7 +43,10 @@ void TabBoxTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); KSharedConfigPtr c = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); c->group("TabBox").writeEntry("ShowTabBox", false); diff --git a/autotests/integration/test_virtualkeyboard_dbus.cpp b/autotests/integration/test_virtualkeyboard_dbus.cpp index e2b07a345f..e587961869 100644 --- a/autotests/integration/test_virtualkeyboard_dbus.cpp +++ b/autotests/integration/test_virtualkeyboard_dbus.cpp @@ -45,7 +45,10 @@ void VirtualKeyboardDBusTest::initTestCase() QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kwin.testvirtualkeyboard")); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); static_cast(kwinApp())->setInputMethodServerToStart("internal"); kwinApp()->start(); diff --git a/autotests/integration/tiles_test.cpp b/autotests/integration/tiles_test.cpp index f74dfcd221..3f5256dc7e 100644 --- a/autotests/integration/tiles_test.cpp +++ b/autotests/integration/tiles_test.cpp @@ -51,7 +51,10 @@ void TilesTest::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(applicationStartedSpy.isValid()); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/touch_input_test.cpp b/autotests/integration/touch_input_test.cpp index c2581d8d25..73c078b8c5 100644 --- a/autotests/integration/touch_input_test.cpp +++ b/autotests/integration/touch_input_test.cpp @@ -55,7 +55,10 @@ void TouchInputTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/transient_placement.cpp b/autotests/integration/transient_placement.cpp index beff7e9202..50df18456a 100644 --- a/autotests/integration/transient_placement.cpp +++ b/autotests/integration/transient_placement.cpp @@ -63,7 +63,10 @@ void TransientPlacementTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/virtual_desktop_test.cpp b/autotests/integration/virtual_desktop_test.cpp index bc606d6f17..3590eb2533 100644 --- a/autotests/integration/virtual_desktop_test.cpp +++ b/autotests/integration/virtual_desktop_test.cpp @@ -41,7 +41,10 @@ void VirtualDesktopTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1"); diff --git a/autotests/integration/window_rules_test.cpp b/autotests/integration/window_rules_test.cpp index 6960c81b67..3bb49e76c6 100644 --- a/autotests/integration/window_rules_test.cpp +++ b/autotests/integration/window_rules_test.cpp @@ -41,7 +41,10 @@ void WindowRuleTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/window_selection_test.cpp b/autotests/integration/window_selection_test.cpp index 67a405fd86..7f25b9a0d6 100644 --- a/autotests/integration/window_selection_test.cpp +++ b/autotests/integration/window_selection_test.cpp @@ -54,7 +54,10 @@ void TestWindowSelection::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); qputenv("XKB_DEFAULT_RULES", "evdev"); kwinApp()->start(); diff --git a/autotests/integration/x11_window_test.cpp b/autotests/integration/x11_window_test.cpp index f1e20386d3..2ae2ea6d1d 100644 --- a/autotests/integration/x11_window_test.cpp +++ b/autotests/integration/x11_window_test.cpp @@ -63,7 +63,7 @@ void X11WindowTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024))); + Test::setOutputConfig({QRect(0, 0, 1280, 1024)}); kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); kwinApp()->start(); diff --git a/autotests/integration/xdgshellwindow_rules_test.cpp b/autotests/integration/xdgshellwindow_rules_test.cpp index 0f36dad743..b9ffefedab 100644 --- a/autotests/integration/xdgshellwindow_rules_test.cpp +++ b/autotests/integration/xdgshellwindow_rules_test.cpp @@ -179,7 +179,10 @@ void TestXdgShellWindowRules::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/xdgshellwindow_test.cpp b/autotests/integration/xdgshellwindow_test.cpp index cc83aec20a..ccb1a3fbb2 100644 --- a/autotests/integration/xdgshellwindow_test.cpp +++ b/autotests/integration/xdgshellwindow_test.cpp @@ -164,7 +164,10 @@ void TestXdgShellWindow::initTestCase() QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/xwayland_input_test.cpp b/autotests/integration/xwayland_input_test.cpp index e372c78193..30490bd093 100644 --- a/autotests/integration/xwayland_input_test.cpp +++ b/autotests/integration/xwayland_input_test.cpp @@ -41,7 +41,10 @@ void XWaylandInputTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/xwayland_selections_test.cpp b/autotests/integration/xwayland_selections_test.cpp index 8cc67df9bd..ef190b7910 100644 --- a/autotests/integration/xwayland_selections_test.cpp +++ b/autotests/integration/xwayland_selections_test.cpp @@ -53,7 +53,10 @@ void XwaylandSelectionsTest::initTestCase() // QSignalSpy clipboardSyncDevicedCreated{waylandServer(), &WaylandServer::xclipboardSyncDataDeviceCreated}; // QVERIFY(clipboardSyncDevicedCreated.isValid()); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); kwinApp()->start(); QVERIFY(applicationStartedSpy.wait()); diff --git a/autotests/integration/xwaylandserver_crash_test.cpp b/autotests/integration/xwaylandserver_crash_test.cpp index f08e13a573..ad25375c2b 100644 --- a/autotests/integration/xwaylandserver_crash_test.cpp +++ b/autotests/integration/xwaylandserver_crash_test.cpp @@ -38,7 +38,10 @@ void XwaylandServerCrashTest::initTestCase() qRegisterMetaType(); QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup xwaylandGroup = config->group("Xwayland"); diff --git a/autotests/integration/xwaylandserver_restart_test.cpp b/autotests/integration/xwaylandserver_restart_test.cpp index 68d25f0c49..67c262e35b 100644 --- a/autotests/integration/xwaylandserver_restart_test.cpp +++ b/autotests/integration/xwaylandserver_restart_test.cpp @@ -36,7 +36,10 @@ void XwaylandServerRestartTest::initTestCase() { QSignalSpy applicationStartedSpy(kwinApp(), &Application::started); QVERIFY(waylandServer()->init(s_socketName)); - QMetaObject::invokeMethod(kwinApp()->outputBackend(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(QVector, QVector() << QRect(0, 0, 1280, 1024) << QRect(1280, 0, 1280, 1024))); + Test::setOutputConfig({ + QRect(0, 0, 1280, 1024), + QRect(1280, 0, 1280, 1024), + }); KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); KConfigGroup xwaylandGroup = config->group("Xwayland"); diff --git a/src/backends/virtual/virtual_backend.cpp b/src/backends/virtual/virtual_backend.cpp index f4205082eb..554b4a364e 100644 --- a/src/backends/virtual/virtual_backend.cpp +++ b/src/backends/virtual/virtual_backend.cpp @@ -106,31 +106,29 @@ Outputs VirtualBackend::outputs() const return m_outputs; } -VirtualOutput *VirtualBackend::createOutput(const QPoint &position, const QSize &size, qreal scale) +VirtualOutput *VirtualBackend::createOutput(const OutputInfo &info) { VirtualOutput *output = new VirtualOutput(this); - output->init(position, size, scale); + output->init(info.geometry.topLeft(), info.geometry.size() * info.scale, info.scale); m_outputs.append(output); Q_EMIT outputAdded(output); output->updateEnabled(true); return output; } -Output *VirtualBackend::addOutput(const QSize &size, qreal scale) +Output *VirtualBackend::addOutput(const OutputInfo &info) { - VirtualOutput *output = createOutput(QPoint(), size * scale, scale); + VirtualOutput *output = createOutput(info); Q_EMIT outputsQueried(); return output; } -void VirtualBackend::setVirtualOutputs(const QVector &geometries, QVector scales) +void VirtualBackend::setVirtualOutputs(const QVector &infos) { - Q_ASSERT(scales.size() == 0 || scales.size() == geometries.size()); - const QVector removed = m_outputs; - for (int i = 0; i < geometries.size(); i++) { - createOutput(geometries[i].topLeft(), geometries[i].size(), scales.value(i, 1.0)); + for (const auto &info : infos) { + createOutput(info); } for (VirtualOutput *output : removed) { diff --git a/src/backends/virtual/virtual_backend.h b/src/backends/virtual/virtual_backend.h index 414e0c4c2a..96a636794e 100644 --- a/src/backends/virtual/virtual_backend.h +++ b/src/backends/virtual/virtual_backend.h @@ -33,9 +33,13 @@ public: std::unique_ptr createQPainterBackend() override; std::unique_ptr createOpenGLBackend() override; - Output *addOutput(const QSize &size, qreal scale); - - Q_INVOKABLE void setVirtualOutputs(const QVector &geometries, QVector scales = QVector()); + struct OutputInfo + { + QRect geometry; + double scale = 1; + }; + Output *addOutput(const OutputInfo &info); + void setVirtualOutputs(const QVector &infos); Outputs outputs() const override; @@ -50,7 +54,7 @@ Q_SIGNALS: void virtualOutputsSet(bool countChanged); private: - VirtualOutput *createOutput(const QPoint &position, const QSize &size, qreal scale); + VirtualOutput *createOutput(const OutputInfo &info); QVector m_outputs; std::unique_ptr m_display; diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index cef6203039..257d8f5942 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -534,7 +534,10 @@ int main(int argc, char *argv[]) case BackendType::Virtual: { auto outputBackend = std::make_unique(); for (int i = 0; i < outputCount; ++i) { - outputBackend->addOutput(initialWindowSize, outputScale); + outputBackend->addOutput(KWin::VirtualBackend::OutputInfo{ + .geometry = QRect(QPoint(), initialWindowSize), + .scale = outputScale, + }); } a.setSession(KWin::Session::create(KWin::Session::Type::Noop)); a.setOutputBackend(std::move(outputBackend));