Make VirtualDesktopManager update grid dimentions when only 1 desktop

This is a patch to get the last two commits to work.
A larger problem to fix is that when the desktop grid size is changed in
the KCM by removing desktops, the internal grid dimensions are not
updated until system restart.
This commit is contained in:
Eric Edlund 2022-04-02 09:35:32 -04:00 committed by Nate Graham
parent 003c820e00
commit c09871917b

View file

@ -502,9 +502,9 @@ void VirtualDesktopManager::removeVirtualDesktop(VirtualDesktop *desktop)
Q_EMIT currentChanged(oldCurrent, newCurrent);
}
updateRootInfo();
save();
updateRootInfo();
Q_EMIT desktopRemoved(desktop);
Q_EMIT countChanged(m_desktops.count() + 1, m_desktops.count());
@ -661,6 +661,13 @@ void VirtualDesktopManager::updateLayout()
m_rows = count() == 1u ? 1 : 2;
columns = count() / m_rows;
}
// Patch to make desktop grid size equal 1 when 1 desktop for desktop switching animations
if (m_desktops.size() == 1) {
m_rows = 1;
columns = 1;
}
setNETDesktopLayout(orientation,
columns, m_rows, 0 // rootInfo->desktopLayoutCorner() // Not really worth implementing right now.
);