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
This commit is contained in:
Rivo Laks 2007-01-29 19:28:53 +00:00
parent 3003c4ecf8
commit cc93b859e3
3 changed files with 16 additions and 22 deletions

View file

@ -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;

View file

@ -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

View file

@ -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;