From b4cc61877314b602956a602a865e5ae7b9538fd5 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Sat, 13 Nov 1999 02:35:15 +0000 Subject: [PATCH] nicer code and (hopefully) even more robust svn path=/trunk/kdebase/kwin/; revision=33642 --- workspace.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/workspace.cpp b/workspace.cpp index 2b1d466ef5..3daeef250b 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -854,15 +854,32 @@ void Workspace::raiseClient( Client* c ) if ( c == desktop_client ) return; // deny - Window* new_stack = new Window[ stacking_order.count()+1]; - stacking_order.remove( c ); stacking_order.append( c ); ClientList saveset; + if ( c->transientFor() ) { + saveset.append( c ); + Client* t = findClient( c->transientFor() ); + Client* tmp; + while ( t && !saveset.contains( t ) && t->transientFor() ) { + tmp = findClient( t->transientFor() ); + if ( !tmp ) + break; + saveset.append( t ); + t = tmp; + } + if ( t && !saveset.contains( t ) && t != desktop_client ) { + raiseClient( t ); + return; + } + } + + saveset.clear(); saveset.append( c ); raiseTransientsOf(saveset, c ); + Window* new_stack = new Window[ stacking_order.count()+1]; int i = 0; for ( ClientList::ConstIterator it = stacking_order.fromLast(); it != stacking_order.end(); --it) { new_stack[i++] = (*it)->winId(); @@ -871,21 +888,7 @@ void Workspace::raiseClient( Client* c ) XRestackWindows(qt_xdisplay(), new_stack, i); delete [] new_stack; - if ( c->transientFor() ) { - Client* t = findClient( c->transientFor() ); - Client* t2; - while (t && t->transientFor() ) { - t2 = findClient( t->transientFor() ); - if ( t2 == c ) - goto end; - if ( t2 == t ) - break; - t = t2; - } - raiseClient( t ); - } - end: propagateClients( TRUE ); }