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:
parent
31b1209bd3
commit
2feca1b673
1 changed files with 32 additions and 58 deletions
|
@ -565,6 +565,8 @@ void PresentWindowsEffect::rearrangeWindows()
|
||||||
if( m_windowData[m_highlightedWindow].visible == false )
|
if( m_windowData[m_highlightedWindow].visible == false )
|
||||||
setHighlightedWindow( findFirstWindow() );
|
setHighlightedWindow( findFirstWindow() );
|
||||||
}
|
}
|
||||||
|
else if( m_tabBoxEnabled )
|
||||||
|
setHighlightedWindow( effects->currentTabBoxWindow() );
|
||||||
else
|
else
|
||||||
setHighlightedWindow( findFirstWindow() );
|
setHighlightedWindow( findFirstWindow() );
|
||||||
|
|
||||||
|
@ -586,7 +588,8 @@ void PresentWindowsEffect::rearrangeWindows()
|
||||||
m_gridSizes[screen].columns * m_gridSizes[screen].rows &&
|
m_gridSizes[screen].columns * m_gridSizes[screen].rows &&
|
||||||
windows.size() < 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 - 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;
|
continue;
|
||||||
|
|
||||||
// No point continuing if there is no windows to process
|
// No point continuing if there is no windows to process
|
||||||
|
@ -1090,66 +1093,37 @@ void PresentWindowsEffect::assignSlots( EffectWindowList windowlist, const QRect
|
||||||
taken[ m_windowData[w].slot ] = true;
|
taken[ m_windowData[w].slot ] = true;
|
||||||
int slotWidth = area.width() / columns;
|
int slotWidth = area.width() / columns;
|
||||||
int slotHeight = area.height() / rows;
|
int slotHeight = area.height() / rows;
|
||||||
if( m_tabBoxEnabled )
|
foreach( EffectWindow *w, windowlist )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < windowlist.count(); i++ )
|
WindowData *wData = &m_windowData[w];
|
||||||
{
|
if( wData->slot != -1 )
|
||||||
EffectWindow *w = windowlist[i];
|
continue; // it already has a slot
|
||||||
WindowData *wData = &m_windowData[w];
|
QPoint pos = w->geometry().center();
|
||||||
if( wData->slot != -1 )
|
if( pos.x() < area.left() )
|
||||||
continue; // It's already has a slot
|
pos.setX( area.left() );
|
||||||
int x = i % columns;
|
if( pos.x() > area.right() )
|
||||||
int y = i / columns;
|
pos.setX( area.right() );
|
||||||
QPoint pos = w->geometry().center();
|
if( pos.y() < area.top() )
|
||||||
if( pos.x() < area.left() )
|
pos.setY( area.top() );
|
||||||
pos.setX( area.left() );
|
if( pos.y() > area.bottom() )
|
||||||
if( pos.x() > area.right() )
|
pos.setY( area.bottom() );
|
||||||
pos.setX( area.right() );
|
int distance = INT_MAX;
|
||||||
if( pos.y() < area.top() )
|
for( int x = 0; x < columns; x++ )
|
||||||
pos.setY( area.top() );
|
for( int y = 0; y < rows; y++ )
|
||||||
if( pos.y() > area.bottom() )
|
{
|
||||||
pos.setY( area.bottom() );
|
int slot = x + y * columns;
|
||||||
int xdiff = pos.x() - ( area.x() + slotWidth * x + slotWidth / 2 );
|
if( taken[slot] )
|
||||||
int ydiff = pos.y() - ( area.y() + slotHeight * y + slotHeight / 2 );
|
continue;
|
||||||
int dist = int( sqrt( double( xdiff * xdiff + ydiff * ydiff )));
|
int xdiff = pos.x() - ( area.x() + slotWidth * x + slotWidth / 2 );
|
||||||
wData->slot = i;
|
int ydiff = pos.y() - ( area.y() + slotHeight * y + slotHeight / 2 );
|
||||||
wData->slot_distance = dist;
|
int dist = int( sqrt( double( xdiff * xdiff + ydiff * ydiff )));
|
||||||
}
|
if( dist < distance )
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach( EffectWindow *w, windowlist )
|
|
||||||
{
|
|
||||||
WindowData *wData = &m_windowData[w];
|
|
||||||
if( wData->slot != -1 )
|
|
||||||
continue; // it already has a slot
|
|
||||||
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 distance = INT_MAX;
|
|
||||||
for( int x = 0; x < columns; x++ )
|
|
||||||
for( int y = 0; y < rows; y++ )
|
|
||||||
{
|
{
|
||||||
int slot = x + y * columns;
|
distance = dist;
|
||||||
if( taken[slot] )
|
wData->slot = slot;
|
||||||
continue;
|
wData->slot_distance = distance;
|
||||||
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 )));
|
|
||||||
if( dist < distance )
|
|
||||||
{
|
|
||||||
distance = dist;
|
|
||||||
wData->slot = slot;
|
|
||||||
wData->slot_distance = distance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue