Fix #22403. Also set change current desktop to the last one existing, if
it would be out of bounds. svn path=/trunk/kdebase/kwin/; revision=139159
This commit is contained in:
parent
994148efcf
commit
a05c9193da
1 changed files with 14 additions and 0 deletions
|
@ -2537,10 +2537,24 @@ void Workspace::setNumberOfDesktops( int n )
|
||||||
{
|
{
|
||||||
if ( n == number_of_desktops )
|
if ( n == number_of_desktops )
|
||||||
return;
|
return;
|
||||||
|
int old_number_of_desktops = number_of_desktops;
|
||||||
number_of_desktops = n;
|
number_of_desktops = n;
|
||||||
|
|
||||||
rootInfo->setNumberOfDesktops( number_of_desktops );
|
rootInfo->setNumberOfDesktops( number_of_desktops );
|
||||||
saveDesktopSettings();
|
saveDesktopSettings();
|
||||||
|
|
||||||
|
// if the number of desktops decreased, move all
|
||||||
|
// windows that would be hidden to the last visible desktop
|
||||||
|
if( old_number_of_desktops > number_of_desktops ) {
|
||||||
|
for( ClientList::ConstIterator it = clients.begin();
|
||||||
|
it != clients.end();
|
||||||
|
++it) {
|
||||||
|
if( !(*it)->isSticky() && (*it)->desktop() > numberOfDesktops())
|
||||||
|
sendClientToDesktop( *it, numberOfDesktops());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( currentDesktop() > numberOfDesktops())
|
||||||
|
setCurrentDesktop( numberOfDesktops());
|
||||||
|
|
||||||
// Resize and reset the desktop focus chain.
|
// Resize and reset the desktop focus chain.
|
||||||
desktop_focus_chain.resize( n );
|
desktop_focus_chain.resize( n );
|
||||||
|
|
Loading…
Reference in a new issue