diff --git a/layers.cpp b/layers.cpp index f8d2d3e14f..71e3aef77b 100644 --- a/layers.cpp +++ b/layers.cpp @@ -350,29 +350,21 @@ void Workspace::raiseClientWithinApplication( Client* c ) StackingUpdatesBlocker blocker( this ); // ignore mainwindows - bool raised = false; - bool is_above_active = false; - bool was_active = false; // first try to put it above the top-most window of the application for( ClientList::Iterator it = unconstrained_stacking_order.fromLast(); it != unconstrained_stacking_order.end(); --it ) { - if( (*it)->isActive()) - was_active = true; - if( Client::belongToSameApplication( *it, c ) && (*it) != c ) + if( *it == c ) // don't lower it just because it asked to be raised + return; + if( Client::belongToSameApplication( *it, c )) { unconstrained_stacking_order.remove( c ); ++it; // insert after the found one unconstrained_stacking_order.insert( it, c ); - raised = true; - break; + return; } - if( *it == c && !was_active ) // if it is already above the active one for some reason, - is_above_active = true; // don't put it lower just because it asked to be raised } - if( !raised && !is_above_active ) - restackClientUnderActive( c ); } void Workspace::raiseClientRequest( Client* c )