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.
This commit is contained in:
parent
93a08ba947
commit
27ceaf9793
2 changed files with 8 additions and 15 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue