Backport r995383:

Fix present windows alt+tab behaviour.
CCBUG: 198711

svn path=/branches/KDE/4.3/kdebase/workspace/; revision=995384
This commit is contained in:
Lucas Murray 2009-07-12 15:27:07 +00:00
parent 31b1209bd3
commit 2feca1b673

View file

@ -565,6 +565,8 @@ void PresentWindowsEffect::rearrangeWindows()
if( m_windowData[m_highlightedWindow].visible == false )
setHighlightedWindow( findFirstWindow() );
}
else if( m_tabBoxEnabled )
setHighlightedWindow( effects->currentTabBoxWindow() );
else
setHighlightedWindow( findFirstWindow() );
@ -586,7 +588,8 @@ void PresentWindowsEffect::rearrangeWindows()
m_gridSizes[screen].columns * m_gridSizes[screen].rows &&
windows.size() < m_gridSizes[screen].columns * m_gridSizes[screen].rows &&
windows.size() > ( m_gridSizes[screen].columns - 1) * m_gridSizes[screen].rows &&
windows.size() > m_gridSizes[screen].columns * ( m_gridSizes[screen].rows - 1 ))
windows.size() > m_gridSizes[screen].columns * ( m_gridSizes[screen].rows - 1 ) &&
!m_tabBoxEnabled )
continue;
// No point continuing if there is no windows to process
@ -1090,34 +1093,6 @@ void PresentWindowsEffect::assignSlots( EffectWindowList windowlist, const QRect
taken[ m_windowData[w].slot ] = true;
int slotWidth = area.width() / columns;
int slotHeight = area.height() / rows;
if( m_tabBoxEnabled )
{
for( int i = 0; i < windowlist.count(); i++ )
{
EffectWindow *w = windowlist[i];
WindowData *wData = &m_windowData[w];
if( wData->slot != -1 )
continue; // It's already has a slot
int x = i % columns;
int y = i / columns;
QPoint pos = w->geometry().center();
if( pos.x() < area.left() )
pos.setX( area.left() );
if( pos.x() > area.right() )
pos.setX( area.right() );
if( pos.y() < area.top() )
pos.setY( area.top() );
if( pos.y() > area.bottom() )
pos.setY( area.bottom() );
int xdiff = pos.x() - ( area.x() + slotWidth * x + slotWidth / 2 );
int ydiff = pos.y() - ( area.y() + slotHeight * y + slotHeight / 2 );
int dist = int( sqrt( double( xdiff * xdiff + ydiff * ydiff )));
wData->slot = i;
wData->slot_distance = dist;
}
}
else
{
foreach( EffectWindow *w, windowlist )
{
WindowData *wData = &m_windowData[w];
@ -1151,7 +1126,6 @@ void PresentWindowsEffect::assignSlots( EffectWindowList windowlist, const QRect
}
}
}
}
void PresentWindowsEffect::getBestAssignments( EffectWindowList windowlist )
{