Assign default name if new virtual desktop has no explicit name
If a virtual desktop has empty name, kwin is going to end up in an infinite cycle where VirtualDesktopManager::save() updates the _NET_DESKTOP_NAMES property and then in the next event loop cycle, RootInfoFilter::filter() is going to call VirtualDesktopManager::save() because the _NET_DESKTOP_NAMES property has been changed. This regression has showed up just now because some parts of kwin used to increase virtual desktop count to create new desktops. Recently, that code was ported to VirtualDesktopManager::createVirtualDesktop(). The main difference between createVirtualDesktop() and setCount() is that the latter will set the desktop name to "Desktop N", the former will use user-specified name. If the user-specified name is empty, the createVirtualDesktop() method should assign "Desktop N" name to the virtual desktop according to the docs. However, it's not the case and this change addresses that.
This commit is contained in:
parent
16f5ce9361
commit
0aaa57e18e
1 changed files with 6 additions and 1 deletions
|
@ -442,10 +442,15 @@ VirtualDesktop *VirtualDesktopManager::createVirtualDesktop(uint position, const
|
||||||
|
|
||||||
position = qBound(0u, position, static_cast<uint>(m_desktops.count()));
|
position = qBound(0u, position, static_cast<uint>(m_desktops.count()));
|
||||||
|
|
||||||
|
QString desktopName = name;
|
||||||
|
if (desktopName.isEmpty()) {
|
||||||
|
desktopName = defaultName(position + 1);
|
||||||
|
}
|
||||||
|
|
||||||
auto *vd = new VirtualDesktop(this);
|
auto *vd = new VirtualDesktop(this);
|
||||||
vd->setX11DesktopNumber(position + 1);
|
vd->setX11DesktopNumber(position + 1);
|
||||||
vd->setId(generateDesktopId());
|
vd->setId(generateDesktopId());
|
||||||
vd->setName(name);
|
vd->setName(desktopName);
|
||||||
|
|
||||||
connect(vd, &VirtualDesktop::nameChanged, this,
|
connect(vd, &VirtualDesktop::nameChanged, this,
|
||||||
[this, vd]() {
|
[this, vd]() {
|
||||||
|
|
Loading…
Reference in a new issue