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:
Luboš Luňák 2002-02-27 16:17:45 +00:00
parent 994148efcf
commit a05c9193da

View file

@ -2537,10 +2537,24 @@ void Workspace::setNumberOfDesktops( int n )
{
if ( n == number_of_desktops )
return;
int old_number_of_desktops = number_of_desktops;
number_of_desktops = n;
rootInfo->setNumberOfDesktops( number_of_desktops );
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.
desktop_focus_chain.resize( n );