From 83aa8dccd25f0000ec8b98b699ff36486f14373d Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 23 Jul 2020 23:21:09 +0100 Subject: [PATCH] [virtualdekstops] Drop multi-head from VirtualDesktopManagement Kwin's VirtualDesktop saved a different configuration per X screen. This messes up with a recent refactor of our startup as now we load virtualdesktops before the X11 screen number is set and we load from the group "Desktops-screen--1" then save to another place. For a wayland session it doesn't make sense to have such a strong X tie-in. We may as well just tidy this up. Multihead has been deprecated for a decade. There is absolutely no way Plasma supports it. Worst case if someone magically is using mutlihead they just get syncronised virtual desktops. BUG: 424571 --- autotests/test_virtual_desktops.cpp | 26 +++----------------------- virtualdesktops.cpp | 18 +++--------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/autotests/test_virtual_desktops.cpp b/autotests/test_virtual_desktops.cpp index 61b2ab9c22..57b359628b 100644 --- a/autotests/test_virtual_desktops.cpp +++ b/autotests/test_virtual_desktops.cpp @@ -621,12 +621,9 @@ void TestVirtualDesktops::load() config->group("Desktops").writeEntry("Number", 4); vds->load(); QCOMPARE(vds->count(), (uint)4); - // setting the screen number should reset to one desktop as config value is missing - screen_number = 2; - vds->load(); - QCOMPARE(vds->count(), (uint)1); - // creating the respective group should properly load - config->group("Desktops-screen-2").writeEntry("Number", 5); + + // setting the config value and reloading should update + config->group("Desktops").writeEntry("Number", 5); vds->load(); QCOMPARE(vds->count(), (uint)5); } @@ -650,23 +647,6 @@ void TestVirtualDesktops::save() QCOMPARE(desktops.hasKey("Name_2"), false); QCOMPARE(desktops.hasKey("Name_3"), false); QCOMPARE(desktops.hasKey("Name_4"), false); - - // change screen number - screen_number = 3; - QCOMPARE(config->hasGroup("Desktops-screen-3"), false); - vds->setCount(3); - vds->save(); - QCOMPARE(config->hasGroup("Desktops-screen-3"), true); - // old one should be unchanged - desktops = config->group("Desktops"); - QCOMPARE(desktops.readEntry("Number", 1), 4); - desktops = config->group("Desktops-screen-3"); - QCOMPARE(desktops.readEntry("Number", 1), 3); - QCOMPARE(desktops.hasKey("Name_1"), false); - QCOMPARE(desktops.hasKey("Name_2"), false); - QCOMPARE(desktops.hasKey("Name_3"), false); - QCOMPARE(desktops.hasKey("Name_4"), false); - } QTEST_MAIN(TestVirtualDesktops) diff --git a/virtualdesktops.cpp b/virtualdesktops.cpp index 121c5f602d..a439460926 100644 --- a/virtualdesktops.cpp +++ b/virtualdesktops.cpp @@ -35,7 +35,6 @@ along with this program. If not, see . #include namespace KWin { -extern int screen_number; static bool s_loadingDesktopSettings = false; static QByteArray generateDesktopId() @@ -701,13 +700,8 @@ void VirtualDesktopManager::load() if (!m_config) { return; } - QString groupname; - if (screen_number == 0) { - groupname = QStringLiteral("Desktops"); - } else { - groupname = QStringLiteral("Desktops-screen-%1").arg(screen_number); - } - KConfigGroup group(m_config, groupname); + + KConfigGroup group(m_config, QStringLiteral("Desktops")); const int n = group.readEntry("Number", 1); setCount(n); @@ -744,13 +738,7 @@ void VirtualDesktopManager::save() if (!m_config) { return; } - QString groupname; - if (screen_number == 0) { - groupname = QStringLiteral("Desktops"); - } else { - groupname = QStringLiteral("Desktops-screen-%1").arg(screen_number); - } - KConfigGroup group(m_config, groupname); + KConfigGroup group(m_config, QStringLiteral("Desktops")); for (int i = count() + 1; group.hasKey(QStringLiteral("Id_%1").arg(i)); i++) { group.deleteEntry(QStringLiteral("Id_%1").arg(i));