work correctly with multiple modal windows

svn path=/trunk/KDE/kdebase/workspace/; revision=1023324
icc-effect-5.14.5
Michael Zanetti 2009-09-14 14:22:31 +00:00
parent d26256cc22
commit 400ee1a6c8
2 changed files with 20 additions and 37 deletions

View File

@ -80,19 +80,7 @@ void SlideBackEffect::windowActivated( EffectWindow* w )
if( intersects( w, tmp->geometry() ) )
{
QRect slideRect;
if( w->isModal() )
{
QRect modalGroupGeometry = w->geometry();
foreach( EffectWindow *modalWindow, w->mainWindows() )
{
modalGroupGeometry = modalGroupGeometry.united( modalWindow->geometry() );
}
slideRect = getSlideDestination( modalGroupGeometry, tmp->geometry() );
}
else
{
slideRect = getSlideDestination( w->geometry(), tmp->geometry() );
}
slideRect = getSlideDestination( getModalGroupGeometry( w ), tmp->geometry() );
effects->setElevatedWindow( tmp, true );
elevatedList.append( tmp );
motionManager.manage( tmp );
@ -211,9 +199,9 @@ void SlideBackEffect::paintWindow( EffectWindow *w, int mask, QRegion region, Wi
{
if( oldStackingOrder.lastIndexOf( tmp ) > oldStackingOrder.lastIndexOf( w ) && isWindowUsable( tmp ) )
{
kDebug() << "screw detected. region:" << region << "clipping:" << tmp->geometry() ;
PaintClipper::push( region.subtracted( tmp->geometry() ) );
clippedRegions.prepend( region.subtracted( tmp->geometry() ) );
kDebug() << "screw detected. region:" << region << "clipping:" << tmp->geometry() ;
PaintClipper::push( region.subtracted( tmp->geometry() ) );
clippedRegions.prepend( region.subtracted( tmp->geometry() ) );
// region = region.subtracted( tmp->geometry() );
}
}
@ -260,19 +248,7 @@ void SlideBackEffect::postPaintWindow( EffectWindow* w )
if( effects->activeWindow() && !tmp->isDock() && !tmp->keepAbove() && effects->activeWindow()->geometry().intersects( elevatedGeometry ) )
{
QRect newDestination;
if( effects->activeWindow()->isModal() )
{
QRect modalGroupGeometry = effects->activeWindow()->geometry();
foreach( EffectWindow *modalWindow, effects->activeWindow()->mainWindows() )
{
modalGroupGeometry = modalGroupGeometry.united( modalWindow->geometry() );
}
newDestination = getSlideDestination( modalGroupGeometry, elevatedGeometry );
}
else
{
newDestination = getSlideDestination( effects->activeWindow()->geometry(), elevatedGeometry );
}
newDestination = getSlideDestination( getModalGroupGeometry( effects->activeWindow() ), elevatedGeometry );
if( !motionManager.isManaging( tmp ) )
{
motionManager.manage( tmp );
@ -392,14 +368,7 @@ bool SlideBackEffect::isWindowUsable( EffectWindow* w )
bool SlideBackEffect::intersects( EffectWindow* windowUnder, const QRect &windowOverGeometry )
{
QRect windowUnderGeometry = windowUnder->geometry();
if( windowUnder->isModal() )
{
foreach( EffectWindow *tmp, windowUnder->mainWindows() )
{
windowUnderGeometry = windowUnderGeometry.united( tmp->geometry() );
}
}
QRect windowUnderGeometry = getModalGroupGeometry( windowUnder );
return windowUnderGeometry.intersects( windowOverGeometry );
}
@ -427,4 +396,17 @@ EffectWindow* SlideBackEffect::newTopWindow()
return stacking.isEmpty() ? NULL : stacking.last();
}
QRect SlideBackEffect::getModalGroupGeometry( EffectWindow *w )
{
QRect modalGroupGeometry = w->geometry();
if( w->isModal() )
{
foreach( EffectWindow *modalWindow, w->mainWindows() )
{
modalGroupGeometry = modalGroupGeometry.united( getModalGroupGeometry( modalWindow ) );
}
}
return modalGroupGeometry;
}
} //Namespace

View File

@ -68,6 +68,7 @@ class SlideBackEffect
bool intersects( EffectWindow *windowUnder, const QRect &windowOverGeometry );
EffectWindowList usableWindows( const EffectWindowList &allWindows );
EffectWindow *newTopWindow();
QRect getModalGroupGeometry( EffectWindow *w );
};