Force window switching mode to use the regular grid as well as putting all windows on the same screen if using a multi-monitor system. Also fixed the incorrectly highlighted window when window switching is first activated.
svn path=/trunk/KDE/kdebase/workspace/; revision=853112
This commit is contained in:
parent
7ce5cea00d
commit
faf7477fdb
1 changed files with 27 additions and 22 deletions
|
@ -329,14 +329,10 @@ void PresentWindowsEffect::setActive(bool active)
|
||||||
EffectWindowList tabBoxWindows = effects->currentTabBoxWindowList();
|
EffectWindowList tabBoxWindows = effects->currentTabBoxWindowList();
|
||||||
int selectedWindow = tabBoxWindows.indexOf( effects->currentTabBoxWindow() );
|
int selectedWindow = tabBoxWindows.indexOf( effects->currentTabBoxWindow() );
|
||||||
for( int i=selectedWindow; i<tabBoxWindows.count(); i++ )
|
for( int i=selectedWindow; i<tabBoxWindows.count(); i++ )
|
||||||
{
|
|
||||||
mWindowsToPresent.append( tabBoxWindows[ i ] );
|
mWindowsToPresent.append( tabBoxWindows[ i ] );
|
||||||
}
|
|
||||||
for( int i=selectedWindow-1; i>=0; i-- )
|
for( int i=selectedWindow-1; i>=0; i-- )
|
||||||
{
|
|
||||||
mWindowsToPresent.append( tabBoxWindows[ i ] );
|
mWindowsToPresent.append( tabBoxWindows[ i ] );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Filter out special windows such as panels and taskbars
|
// Filter out special windows such as panels and taskbars
|
||||||
|
@ -382,7 +378,6 @@ void PresentWindowsEffect::effectActivated()
|
||||||
mInput = effects->createFullScreenInputWindow( this, Qt::PointingHandCursor );
|
mInput = effects->createFullScreenInputWindow( this, Qt::PointingHandCursor );
|
||||||
hasKeyboardGrab = effects->grabKeyboard( this );
|
hasKeyboardGrab = effects->grabKeyboard( this );
|
||||||
effects->setActiveFullScreenEffect( this );
|
effects->setActiveFullScreenEffect( this );
|
||||||
setHighlightedWindow( effects->activeWindow());
|
|
||||||
|
|
||||||
screenGridSizes.clear();
|
screenGridSizes.clear();
|
||||||
for( int i = 0; i < effects->numScreens(); i++ )
|
for( int i = 0; i < effects->numScreens(); i++ )
|
||||||
|
@ -453,18 +448,30 @@ void PresentWindowsEffect::rearrangeWindows()
|
||||||
// Initialize new entries
|
// Initialize new entries
|
||||||
foreach( EffectWindow* w, windowlist )
|
foreach( EffectWindow* w, windowlist )
|
||||||
if( !mWindowData.contains( w ))
|
if( !mWindowData.contains( w ))
|
||||||
{
|
|
||||||
mWindowData[ w ].highlight = 0;
|
mWindowData[ w ].highlight = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
|
|
||||||
bool rearranging = false;
|
bool rearranging = false;
|
||||||
|
int iterations = mTabBoxMode ? 1 : effects->numScreens(); // Only use one screen for window switching
|
||||||
QVector<int> newNumOfWindows( effects->numScreens(), 0 );
|
QVector<int> newNumOfWindows( effects->numScreens(), 0 );
|
||||||
QVector<GridSize> newScreenGridSizes( effects->numScreens() );
|
QVector<GridSize> newScreenGridSizes( effects->numScreens() );
|
||||||
for( int i = 0; i < effects->numScreens(); i++ )
|
for( int i = 0; i < iterations; i++ )
|
||||||
{
|
{
|
||||||
|
int screen;
|
||||||
|
EffectWindowList screenList;
|
||||||
|
if( mTabBoxMode )
|
||||||
|
{
|
||||||
|
screen = effects->activeScreen();
|
||||||
|
screenList = windowlist;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screen = i;
|
||||||
|
screenList = windowlists[i];
|
||||||
|
}
|
||||||
|
|
||||||
newScreenGridSizes.append( GridSize() );
|
newScreenGridSizes.append( GridSize() );
|
||||||
|
|
||||||
// Do not rearrange if filtering only removed windows, so that the remaining ones don't possibly
|
// Do not rearrange if filtering only removed windows, so that the remaining ones don't possibly
|
||||||
|
@ -476,12 +483,12 @@ void PresentWindowsEffect::rearrangeWindows()
|
||||||
doRearrange = true;
|
doRearrange = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newNumOfWindows[i] = windowlists[i].count();
|
newNumOfWindows[screen] = screenList.count();
|
||||||
newScreenGridSizes[i].columns = int( ceil( sqrt( (double)windowlists[i].count())));
|
newScreenGridSizes[screen].columns = int( ceil( sqrt( (double)screenList.count())));
|
||||||
newScreenGridSizes[i].rows = int( ceil( windowlists[i].count() / double( newScreenGridSizes[i].columns )));
|
newScreenGridSizes[screen].rows = int( ceil( screenList.count() / double( newScreenGridSizes[screen].columns )));
|
||||||
if( newNumOfWindows[i] && ( firstTime || newNumOfWindows[i] > numOfWindows[i] ||
|
if( newNumOfWindows[screen] && ( firstTime || newNumOfWindows[screen] > numOfWindows[screen] ||
|
||||||
( newNumOfWindows[i] < numOfWindows[i] && ( newScreenGridSizes[i].rows != screenGridSizes[i].rows ||
|
( newNumOfWindows[screen] < numOfWindows[screen] && ( newScreenGridSizes[screen].rows != screenGridSizes[screen].rows ||
|
||||||
newScreenGridSizes[i].columns != screenGridSizes[i].columns ))))
|
newScreenGridSizes[screen].columns != screenGridSizes[screen].columns ))))
|
||||||
doRearrange = true;
|
doRearrange = true;
|
||||||
}
|
}
|
||||||
if( doRearrange )
|
if( doRearrange )
|
||||||
|
@ -492,22 +499,22 @@ void PresentWindowsEffect::rearrangeWindows()
|
||||||
prepareToRearrange();
|
prepareToRearrange();
|
||||||
}
|
}
|
||||||
// No point calculating if there is no windows
|
// No point calculating if there is no windows
|
||||||
if( !windowlists[i].size() )
|
if( !screenList.size() )
|
||||||
continue;
|
continue;
|
||||||
// Calculate new positions and scales for windows
|
// Calculate new positions and scales for windows
|
||||||
if( layoutMode == LayoutRegularGrid )
|
if( layoutMode == LayoutRegularGrid || mTabBoxMode ) // Force the grid for window switching
|
||||||
calculateWindowTransformationsClosest( windowlists[i], i );
|
calculateWindowTransformationsClosest( screenList, screen );
|
||||||
else if( layoutMode == LayoutFlexibleGrid )
|
else if( layoutMode == LayoutFlexibleGrid )
|
||||||
calculateWindowTransformationsKompose( windowlists[i], i );
|
calculateWindowTransformationsKompose( screenList, screen );
|
||||||
else
|
else
|
||||||
calculateWindowTransformationsNatural( windowlists[i], i );
|
calculateWindowTransformationsNatural( screenList, screen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
numOfWindows = newNumOfWindows;
|
numOfWindows = newNumOfWindows;
|
||||||
screenGridSizes = newScreenGridSizes;
|
screenGridSizes = newScreenGridSizes;
|
||||||
|
|
||||||
if( !mWindowData.isEmpty() && mHighlightedWindow == NULL )
|
if( !mWindowData.isEmpty() && mHighlightedWindow == NULL && !mTabBoxMode ) // Tab box takes care of this itself
|
||||||
setHighlightedWindow( findFirstWindow());
|
setHighlightedWindow( findFirstWindow());
|
||||||
|
|
||||||
// Schedule entire desktop to be repainted
|
// Schedule entire desktop to be repainted
|
||||||
|
@ -1606,10 +1613,8 @@ void PresentWindowsEffect::tabBoxClosed()
|
||||||
void PresentWindowsEffect::tabBoxUpdated()
|
void PresentWindowsEffect::tabBoxUpdated()
|
||||||
{
|
{
|
||||||
if( mActivated )
|
if( mActivated )
|
||||||
{
|
|
||||||
setHighlightedWindow( effects->currentTabBoxWindow() );
|
setHighlightedWindow( effects->currentTabBoxWindow() );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
#include "presentwindows.moc"
|
#include "presentwindows.moc"
|
||||||
|
|
Loading…
Reference in a new issue