diff --git a/layers.cpp b/layers.cpp index 7a71086e46..a552624c61 100644 --- a/layers.cpp +++ b/layers.cpp @@ -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(); } diff --git a/tabbox.cpp b/tabbox.cpp index f6ad7c09da..82663a9e78 100644 --- a/tabbox.cpp +++ b/tabbox.cpp @@ -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; } diff --git a/workspace.cpp b/workspace.cpp index e7f5722bb0..c146ebf856 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -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() diff --git a/workspace.h b/workspace.h index 636e8dd743..d5cae85b6c 100644 --- a/workspace.h +++ b/workspace.h @@ -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;