[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
This commit is contained in:
David Edmundson 2020-07-23 23:21:09 +01:00 committed by David Edmundson
parent 9438a2e1b1
commit 83aa8dccd2
2 changed files with 6 additions and 38 deletions

View file

@ -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<int>("Number", 1), 4);
desktops = config->group("Desktops-screen-3");
QCOMPARE(desktops.readEntry<int>("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)

View file

@ -35,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QDebug>
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));