From 746cdddf765592da830fdecaab938f2e83e31479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 10 Nov 2010 03:01:49 +0000 Subject: [PATCH] adjust/fix behaviour of Modal Dialogs reg. Minimizing, Virtual Desktop change & Shading BUG: 193611 BUG: 180195 svn path=/trunk/KDE/kdebase/workspace/; revision=1194907 --- client.cpp | 17 ++++++++++++++++- group.cpp | 5 ++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/client.cpp b/client.cpp index 6b3052f800..b9b4fe7a6b 100644 --- a/client.cpp +++ b/client.cpp @@ -1058,7 +1058,6 @@ void Client::setShade( ShadeMode mode ) discardWindowPixmap(); updateVisibility(); updateAllowedActions(); - workspace()->updateMinimizedOfTransients( this ); if( decoration ) decoration->shadeChange(); updateWindowRules(); @@ -1499,6 +1498,7 @@ void Client::setDesktop( int desktop ) desktop = qMin( workspace()->numberOfDesktops(), rules()->checkDesktop( desktop )); if( desk == desktop ) return; + int was_desk = desk; desk = desktop; info->setDesktop( desktop ); @@ -1510,6 +1510,21 @@ void Client::setDesktop( int desktop ) } if( decoration != NULL ) decoration->desktopChange(); + + ClientList transients_stacking_order = workspace()->ensureStackingOrder( transients() ); + for( ClientList::ConstIterator it = transients_stacking_order.constBegin(); + it != transients_stacking_order.constEnd(); + ++it ) + (*it)->setDesktop( desktop ); + + if( isModal()) // if a modal dialog is moved, move the mainwindow with it as otherwise + // the (just moved) modal dialog will confusingly return to the mainwindow with + // the next desktop change + { + foreach( Client* c2, mainClients()) + c2->setDesktop( desktop ); + } + workspace()->updateFocusChains( this, Workspace::FocusChainMakeFirst ); updateVisibility(); updateWindowRules(); diff --git a/group.cpp b/group.cpp index 868080c638..76c0e9685c 100644 --- a/group.cpp +++ b/group.cpp @@ -404,12 +404,15 @@ Group* Workspace::findClientLeaderGroup( const Client* c ) const void Workspace::updateMinimizedOfTransients( Client* c ) { // if mainwindow is minimized or shaded, minimize transients too - if ( c->isMinimized() || c->isShade() ) + if ( c->isMinimized() ) { for( ClientList::ConstIterator it = c->transients().constBegin(); it != c->transients().constEnd(); ++it ) { + if ((*it)->isModal()) + continue; // there's no reason to hide modal dialogs with the main client + // but to keep them to eg. watch progress or whatever if( !(*it)->isMinimized() && !(*it)->isTopMenu() ) // topmenus are not minimized, they're hidden {