Fix stacking order and focus chain when opening links in background

in Konqueror.


svn path=/trunk/KDE/kdebase/workspace/; revision=603050
This commit is contained in:
Luboš Luňák 2006-11-07 17:07:24 +00:00
parent 0a829c4ece
commit e17138c20b

View file

@ -394,20 +394,27 @@ void Workspace::restackClientUnderActive( Client* c )
return; return;
} }
// put in the stacking order below _all_ windows belonging to the active application
assert( unconstrained_stacking_order.contains( active_client )); assert( unconstrained_stacking_order.contains( active_client ));
for( ClientList::Iterator it = unconstrained_stacking_order.begin(); if( Client::belongToSameApplication( active_client, c ))
it != unconstrained_stacking_order.end(); { // put it below the active window if it's the same app
++it ) unconstrained_stacking_order.removeAll( c );
{ // TODO ignore topmenus? unconstrained_stacking_order.insert( unconstrained_stacking_order.find( active_client ), c );
if( Client::belongToSameApplication( active_client, *it )) }
{ else
if( *it != c ) { // put in the stacking order below _all_ windows belonging to the active application
for( ClientList::Iterator it = unconstrained_stacking_order.begin();
it != unconstrained_stacking_order.end();
++it )
{ // TODO ignore topmenus?
if( Client::belongToSameApplication( active_client, *it ))
{ {
unconstrained_stacking_order.removeAll( c ); if( *it != c )
unconstrained_stacking_order.insert( it, c ); {
unconstrained_stacking_order.removeAll( c );
unconstrained_stacking_order.insert( it, c );
}
break;
} }
break;
} }
} }
assert( unconstrained_stacking_order.contains( c )); assert( unconstrained_stacking_order.contains( c ));
@ -417,16 +424,23 @@ void Workspace::restackClientUnderActive( Client* c )
{ // do for every virtual desktop to handle the case of onalldesktop windows { // do for every virtual desktop to handle the case of onalldesktop windows
if( c->wantsTabFocus() && c->isOnDesktop( desktop ) && focus_chain[ desktop ].contains( active_client )) if( c->wantsTabFocus() && c->isOnDesktop( desktop ) && focus_chain[ desktop ].contains( active_client ))
{ {
// also put in focus_chain[currentDesktop()] after all windows belonging to the active applicationa if( Client::belongToSameApplication( active_client, c ))
focus_chain[ desktop ].removeAll( c ); { // put it after the active window if it's the same app
for ( int i = focus_chain[ desktop ].size() - 1; focus_chain[ desktop ].removeAll( c );
i >= 0; focus_chain[ desktop ].insert( focus_chain[ desktop ].find( active_client ), c );
--i ) }
{ else
if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i ) )) { // put it in focus_chain[currentDesktop()] after all windows belonging to the active applicationa
focus_chain[ desktop ].removeAll( c );
for( int i = focus_chain[ desktop ].size() - 1;
i >= 0;
--i )
{ {
focus_chain[ desktop ].insert( i, c ); if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i )))
break; {
focus_chain[ desktop ].insert( i, c );
break;
}
} }
} }
} }
@ -434,15 +448,23 @@ void Workspace::restackClientUnderActive( Client* c )
// the same for global_focus_chain // the same for global_focus_chain
if( c->wantsTabFocus() && global_focus_chain.contains( active_client )) if( c->wantsTabFocus() && global_focus_chain.contains( active_client ))
{ {
global_focus_chain.removeAll( c ); if( Client::belongToSameApplication( active_client, 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.removeAll( c );
global_focus_chain.insert( global_focus_chain.find( active_client ), c );
}
else
{
global_focus_chain.removeAll( c );
for ( int i = global_focus_chain.size() - 1;
i >= 0;
--i )
{ {
global_focus_chain.insert( i, c ); if( Client::belongToSameApplication( active_client, global_focus_chain.at( i ) ))
break; {
global_focus_chain.insert( i, c );
break;
}
} }
} }
} }