Separate focus chains are nice, but KDE-style Alt+Tab not limited

to the current desktop still needs the global one for MRU (#124721).


svn path=/trunk/KDE/kdebase/workspace/; revision=528612
This commit is contained in:
Luboš Luňák 2006-04-11 14:14:38 +00:00
parent 7f04417ad5
commit e906595aaf
4 changed files with 37 additions and 14 deletions

View file

@ -431,6 +431,21 @@ void Workspace::restackClientUnderActive( Client* c )
}
}
}
// the same for global_focus_chain
if( c->wantsTabFocus() && global_focus_chain.contains( active_client ))
{
global_focus_chain.removeAll( c );
for ( int i = global_focus_chain.size() - 1;
i >= 0;
--i )
{
if( Client::belongToSameApplication( active_client, global_focus_chain.at( i ) ))
{
global_focus_chain.insert( i, c );
break;
}
}
}
updateStackingOrder();
}

View file

@ -1165,14 +1165,13 @@ int Workspace::previousDesktopFocusChain( int iDesktop ) const
*/
Client* Workspace::nextFocusChainClient( Client* c ) const
{
int desktop = !c || c->isOnAllDesktops() ? currentDesktop() : c->desktop();
if ( focus_chain[desktop].isEmpty() )
if ( global_focus_chain.isEmpty() )
return 0;
ClientList::ConstIterator it = focus_chain[desktop].find( c );
if ( it == focus_chain[desktop].end() )
return focus_chain[desktop].last();
if ( it == focus_chain[desktop].begin() )
return focus_chain[desktop].last();
ClientList::ConstIterator it = global_focus_chain.find( c );
if ( it == global_focus_chain.end() )
return global_focus_chain.last();
if ( it == global_focus_chain.begin() )
return global_focus_chain.last();
--it;
return *it;
}
@ -1183,15 +1182,14 @@ Client* Workspace::nextFocusChainClient( Client* c ) const
*/
Client* Workspace::previousFocusChainClient( Client* c ) const
{
int desktop = !c || c->isOnAllDesktops() ? currentDesktop() : c->desktop();
if ( focus_chain[desktop].isEmpty() )
if ( global_focus_chain.isEmpty() )
return 0;
ClientList::ConstIterator it = focus_chain[desktop].find( c );
if ( it == focus_chain[desktop].end() )
return focus_chain[desktop].first();
ClientList::ConstIterator it = global_focus_chain.find( c );
if ( it == global_focus_chain.end() )
return global_focus_chain.first();
++it;
if ( it == focus_chain[desktop].end() )
return focus_chain[desktop].first();
if ( it == global_focus_chain.end() )
return global_focus_chain.first();
return *it;
}

View file

@ -568,6 +568,7 @@ void Workspace::removeClient( Client* c, allowed_t )
i <= numberOfDesktops();
++i )
focus_chain[ i ].remove( c );
global_focus_chain.remove( c );
attention_chain.remove( c );
if( c->isTopMenu())
removeTopMenu( c );
@ -602,6 +603,7 @@ void Workspace::updateFocusChains( Client* c, bool make_first )
i<= numberOfDesktops();
++i )
focus_chain[i].remove(c);
global_focus_chain.remove( c );
return;
}
if(c->desktop() == NET::OnAllDesktops)
@ -635,6 +637,13 @@ void Workspace::updateFocusChains( Client* c, bool make_first )
focus_chain[ i ].remove( c );
}
}
if( make_first )
{
global_focus_chain.remove( c );
global_focus_chain.append( c );
}
else if( !global_focus_chain.contains( c ))
global_focus_chain.prepend( c );
}
void Workspace::updateCurrentTopMenu()

View file

@ -510,6 +510,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
ClientList unconstrained_stacking_order;
ClientList stacking_order;
QVector< ClientList > focus_chain;
ClientList global_focus_chain; // this one is only for things like tabbox's MRU
ClientList should_get_focus; // last is most recent
ClientList attention_chain;