Commit 27ceaf97 authored by David Edmundson's avatar David Edmundson Committed by Vlad Zahorodnii
Browse files

Only call VirtualDesktops::load once

It was called twice once with and without X as our implementation of
setRootInfo() missed some calls.

This was done to avoid a bug as setRootInfo() didn't update everything.
This patch aims to resolve that at the root cause.

I tested the original conditions of the patch with an empty kwinrc and a
file in /etc/xdg/kwinrc setting desktops to 2 and everything loaded
correctly.
parent 93a08ba9
......@@ -247,6 +247,13 @@ void VirtualDesktopManager::setRootInfo(NETRootInfo *info)
// Nothing will be connected to rootInfo
if (m_rootInfo) {
int columns = count() / m_rows;
if (count() % m_rows > 0) {
columns++;
}
m_rootInfo->setDesktopLayout(NET::OrientationHorizontal, columns, m_rows, NET::DesktopLayoutCornerTopLeft);
updateRootInfo();
m_rootInfo->setCurrentDesktop(currentDesktop()->x11DesktopNumber());
for (auto *vd : m_desktops) {
m_rootInfo->setDesktopName(vd->x11DesktopNumber(), vd->name().toUtf8().data());
}
......@@ -713,7 +720,6 @@ void VirtualDesktopManager::load()
const QString sId = group.readEntry(QStringLiteral("Id_%1").arg(i), QString());
//load gets called 2 times, see workspace.cpp line 416 and BUG 385260
if (m_desktops[i-1]->id().isEmpty()) {
m_desktops[i-1]->setId(sId.isEmpty() ? generateDesktopId() : sId.toUtf8());
} else {
......@@ -727,16 +733,6 @@ void VirtualDesktopManager::load()
int rows = group.readEntry<int>("Rows", 2);
m_rows = qBound(1, rows, n);
if (m_rootInfo) {
// avoid weird cases like having 3 rows for 4 desktops, where the last row is unused
int columns = n / m_rows;
if (n % m_rows > 0) {
columns++;
}
m_rootInfo->setDesktopLayout(NET::OrientationHorizontal, columns, m_rows, NET::DesktopLayoutCornerTopLeft);
m_rootInfo->activate();
}
s_loadingDesktopSettings = false;
}
......
......@@ -359,10 +359,7 @@ void Workspace::initWithX11()
RootInfo *rootInfo = RootInfo::create();
const auto vds = VirtualDesktopManager::self();
vds->setRootInfo(rootInfo);
// load again to sync to RootInfo, see BUG 385260
vds->load();
vds->updateRootInfo();
rootInfo->setCurrentDesktop(vds->currentDesktop()->x11DesktopNumber());
rootInfo->activate();
// TODO: only in X11 mode
// Extra NETRootInfo instance in Client mode is needed to get the values of the properties
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment