Ensure that width*height is not smaller than the number of desktops when setting a new layout.

svn path=/trunk/KDE/kdebase/workspace/; revision=1108238
This commit is contained in:
Martin Gräßlin 2010-03-28 09:02:10 +00:00
parent eb0a8f02b6
commit 40a2bebe67

View file

@ -32,7 +32,6 @@ void Workspace::updateDesktopLayout()
int height = rootInfo->desktopLayoutColumnsRows().height();
if( width == 0 && height == 0 ) // Not given, set default layout
height = 2;
// TODO: Make sure desktopCount_ <= width * height
setNETDesktopLayout(
rootInfo->desktopLayoutOrientation() == NET::OrientationHorizontal ? Qt::Horizontal : Qt::Vertical,
width, height, 0 //rootInfo->desktopLayoutCorner() // Not really worth implementing right now.
@ -50,6 +49,13 @@ void Workspace::setNETDesktopLayout( Qt::Orientation orientation, int width, int
width = ( desktopCount_ + height - 1 ) / height;
else if(( height <= 0 ) && ( width > 0 ))
height = ( desktopCount_ + width - 1 ) / width;
while( width * height < desktopCount_ )
{
if( orientation == Qt::Horizontal )
++width;
else
++height;
}
// Set private variables
delete[] desktopGrid_;