QMap -> QHash

svn path=/trunk/KDE/kdebase/workspace/; revision=642528
This commit is contained in:
Luboš Luňák 2007-03-14 16:39:50 +00:00
parent de8f39accf
commit 5d4178c40c

View file

@ -119,7 +119,8 @@ void Workspace::updateStackingOrder( bool propagate_new_clients )
if( changed || propagate_new_clients )
{
propagateClients( propagate_new_clients );
addRepaintFull();
if( active_client )
active_client->updateMouseGrab();
}
}
@ -191,24 +192,26 @@ void Workspace::propagateClients( bool propagate_new_clients )
doesn't accept focus it's excluded.
*/
// TODO misleading name for this method
Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained ) const
Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained, bool only_normal ) const
{
// TODO Q_ASSERT( block_stacking_updates == 0 );
ClientList list;
if( !unconstrained )
{
list = stacking_order;
}
list = stacking_order;
else
list = unconstrained_stacking_order;
for( int i = list.size() - 1;
i >= 0;
--i )
{
list = unconstrained_stacking_order;
if( list.at( i )->isOnDesktop( desktop ) && list.at( i )->isShown( false ))
{
if( !only_normal )
return list.at( i );
if( list.at( i )->wantsTabFocus() && !list.at( i )->isSpecialWindow())
return list.at( i );
}
}
for ( int i = list.size() - 1; i>=0; i-- )
{
if ( list.at( i )->isOnDesktop( desktop ) && !list.at( i )->isSpecialWindow()
&& list.at( i )->isShown( false ) && list.at( i )->wantsTabFocus())
return list.at( i );
}
return 0;
}
@ -398,20 +401,27 @@ void Workspace::restackClientUnderActive( Client* c )
return;
}
// put in the stacking order below _all_ windows belonging to the active application
assert( unconstrained_stacking_order.contains( active_client ));
for( ClientList::Iterator it = unconstrained_stacking_order.begin();
it != unconstrained_stacking_order.end();
++it )
{ // TODO ignore topmenus?
if( Client::belongToSameApplication( active_client, *it ))
{
if( *it != c )
if( Client::belongToSameApplication( active_client, c ))
{ // put it below the active window if it's the same app
unconstrained_stacking_order.removeAll( c );
unconstrained_stacking_order.insert( unconstrained_stacking_order.find( active_client ), c );
}
else
{ // 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 );
unconstrained_stacking_order.insert( it, c );
if( *it != c )
{
unconstrained_stacking_order.removeAll( c );
unconstrained_stacking_order.insert( it, c );
}
break;
}
break;
}
}
assert( unconstrained_stacking_order.contains( c ));
@ -421,16 +431,23 @@ void Workspace::restackClientUnderActive( Client* c )
{ // do for every virtual desktop to handle the case of onalldesktop windows
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
focus_chain[ desktop ].removeAll( c );
for ( int i = focus_chain[ desktop ].size() - 1;
i >= 0;
--i )
{
if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i ) ))
if( Client::belongToSameApplication( active_client, c ))
{ // put it after the active window if it's the same app
focus_chain[ desktop ].removeAll( c );
focus_chain[ desktop ].insert( focus_chain[ desktop ].find( active_client ), c );
}
else
{ // 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 );
break;
if( Client::belongToSameApplication( active_client, focus_chain[ desktop ].at( i )))
{
focus_chain[ desktop ].insert( i, c );
break;
}
}
}
}
@ -438,15 +455,23 @@ 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, c ))
{
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 );
break;
if( Client::belongToSameApplication( active_client, global_focus_chain.at( i ) ))
{
global_focus_chain.insert( i, c );
break;
}
}
}
}
@ -499,7 +524,7 @@ ClientList Workspace::constrainedStackingOrder()
kDebug() << "stacking1:" << endl;
#endif
// build the order from layers
QMap< Group*, Layer > minimum_layer;
QHash< Group*, Layer > minimum_layer;
for( ClientList::ConstIterator it = unconstrained_stacking_order.begin();
it != unconstrained_stacking_order.end();
++it )