diff --git a/effects/minimizeanimation.cpp b/effects/minimizeanimation.cpp index 667fd1a51c..2e2662be08 100644 --- a/effects/minimizeanimation.cpp +++ b/effects/minimizeanimation.cpp @@ -83,6 +83,16 @@ 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( !icon.isValid() ) + icon = QRect( displayWidth() / 2, displayHeight() / 2, 0, 0 ); data.xScale *= interpolate(1.0, icon.width() / (float)geo.width(), progress); data.yScale *= interpolate(1.0, icon.height() / (float)geo.height(), progress); @@ -106,8 +116,7 @@ void MinimizeAnimationEffect::postPaintScreen() void MinimizeAnimationEffect::windowMinimized( EffectWindow* w ) { - Client* client = static_cast< Client* >( w->window() ); - if( !mAnimationProgress.contains(w) && client->iconGeometry().isValid() ) + if( !mAnimationProgress.contains(w) ) { mAnimationProgress[w] = 0.0f; mActiveAnimations++; @@ -116,13 +125,22 @@ void MinimizeAnimationEffect::windowMinimized( EffectWindow* w ) void MinimizeAnimationEffect::windowUnminimized( EffectWindow* w ) { - Client* client = static_cast< Client* >( w->window() ); - if( !mAnimationProgress.contains(w) && client->iconGeometry().isValid() ) + if( !mAnimationProgress.contains(w) ) { mAnimationProgress[w] = 1.0f; mActiveAnimations++; } } +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 6cd9b766a9..4c5add4d5f 100644 --- a/effects/minimizeanimation.h +++ b/effects/minimizeanimation.h @@ -35,6 +35,9 @@ class MinimizeAnimationEffect virtual void windowMinimized( EffectWindow* c ); virtual void windowUnminimized( EffectWindow* c ); + protected: + Client* findParentWithIconGeometry( Client* c ); + private: Workspace* mWorkspace; QMap< EffectWindow*, float > mAnimationProgress;