From cc93b859e3ef4e48ec6fa39a9afdbd3be519fed0 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Mon, 29 Jan 2007 19:28:53 +0000 Subject: [PATCH] Make Client::iconGeometry() recursively use it's mainwindow's icongeometry if it doesn't have one itself. svn path=/branches/work/kwin_composite/; revision=628327 --- client.cpp | 16 +++++++++++++++- effects/minimizeanimation.cpp | 19 +------------------ effects/minimizeanimation.h | 3 --- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/client.cpp b/client.cpp index 73315e6e79..e02bff70ac 100644 --- a/client.cpp +++ b/client.cpp @@ -601,7 +601,21 @@ void Client::unminimize( bool avoid_animation ) QRect Client::iconGeometry() const { NETRect r = info->iconGeometry(); - return QRect( r.pos.x, r.pos.y, r.size.width, r.size.height ); + QRect geom( r.pos.x, r.pos.y, r.size.width, r.size.height ); + if( geom.isValid() ) + return geom; + else + { + // Check all mainwindows of this window (recursively) + foreach( Client* mainwin, mainClients() ) + { + geom = mainwin->iconGeometry(); + if( geom.isValid() ) + return geom; + } + // No mainwindow (or their parents) with icon geometry was found + return QRect(); + } } extern bool blockAnimation; diff --git a/effects/minimizeanimation.cpp b/effects/minimizeanimation.cpp index 2e2662be08..28c5c4cd48 100644 --- a/effects/minimizeanimation.cpp +++ b/effects/minimizeanimation.cpp @@ -83,14 +83,7 @@ void MinimizeAnimationEffect::paintWindow( EffectWindow* w, int mask, QRegion re Client* c = static_cast< Client* >( w->window() ); QRect geo = c->geometry(); QRect icon = c->iconGeometry(); - // For dialogs, try to use parent window's taskbar entry - if( !icon.isValid() ) - { - Client* parent = findParentWithIconGeometry( c ); - if( parent ) - icon = parent->iconGeometry(); - } - // If everything else fails, minimize to the center of the screen + // If there's no icon geometry, minimize to the center of the screen if( !icon.isValid() ) icon = QRect( displayWidth() / 2, displayHeight() / 2, 0, 0 ); @@ -132,15 +125,5 @@ void MinimizeAnimationEffect::windowUnminimized( EffectWindow* w ) } } -Client* MinimizeAnimationEffect::findParentWithIconGeometry( Client* c ) - { - if( c->iconGeometry().isValid() ) - return c; - else if( c->transientFor() ) - return findParentWithIconGeometry( c->transientFor() ); - else - return 0; - } - } // namespace diff --git a/effects/minimizeanimation.h b/effects/minimizeanimation.h index 4c5add4d5f..6cd9b766a9 100644 --- a/effects/minimizeanimation.h +++ b/effects/minimizeanimation.h @@ -35,9 +35,6 @@ class MinimizeAnimationEffect virtual void windowMinimized( EffectWindow* c ); virtual void windowUnminimized( EffectWindow* c ); - protected: - Client* findParentWithIconGeometry( Client* c ); - private: Workspace* mWorkspace; QMap< EffectWindow*, float > mAnimationProgress;