work correctly with multiple modal windows

svn path=/trunk/KDE/kdebase/workspace/; revision=1023324
This commit is contained in:
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() ) ) if( intersects( w, tmp->geometry() ) )
{ {
QRect slideRect; QRect slideRect;
if( w->isModal() ) slideRect = getSlideDestination( getModalGroupGeometry( w ), tmp->geometry() );
{
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() );
}
effects->setElevatedWindow( tmp, true ); effects->setElevatedWindow( tmp, true );
elevatedList.append( tmp ); elevatedList.append( tmp );
motionManager.manage( 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 ) ) if( oldStackingOrder.lastIndexOf( tmp ) > oldStackingOrder.lastIndexOf( w ) && isWindowUsable( tmp ) )
{ {
kDebug() << "screw detected. region:" << region << "clipping:" << tmp->geometry() ; kDebug() << "screw detected. region:" << region << "clipping:" << tmp->geometry() ;
PaintClipper::push( region.subtracted( tmp->geometry() ) ); PaintClipper::push( region.subtracted( tmp->geometry() ) );
clippedRegions.prepend( region.subtracted( tmp->geometry() ) ); clippedRegions.prepend( region.subtracted( tmp->geometry() ) );
// region = 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 ) ) if( effects->activeWindow() && !tmp->isDock() && !tmp->keepAbove() && effects->activeWindow()->geometry().intersects( elevatedGeometry ) )
{ {
QRect newDestination; QRect newDestination;
if( effects->activeWindow()->isModal() ) newDestination = getSlideDestination( getModalGroupGeometry( effects->activeWindow() ), elevatedGeometry );
{
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 );
}
if( !motionManager.isManaging( tmp ) ) if( !motionManager.isManaging( tmp ) )
{ {
motionManager.manage( tmp ); motionManager.manage( tmp );
@ -392,14 +368,7 @@ bool SlideBackEffect::isWindowUsable( EffectWindow* w )
bool SlideBackEffect::intersects( EffectWindow* windowUnder, const QRect &windowOverGeometry ) bool SlideBackEffect::intersects( EffectWindow* windowUnder, const QRect &windowOverGeometry )
{ {
QRect windowUnderGeometry = windowUnder->geometry(); QRect windowUnderGeometry = getModalGroupGeometry( windowUnder );
if( windowUnder->isModal() )
{
foreach( EffectWindow *tmp, windowUnder->mainWindows() )
{
windowUnderGeometry = windowUnderGeometry.united( tmp->geometry() );
}
}
return windowUnderGeometry.intersects( windowOverGeometry ); return windowUnderGeometry.intersects( windowOverGeometry );
} }
@ -427,4 +396,17 @@ EffectWindow* SlideBackEffect::newTopWindow()
return stacking.isEmpty() ? NULL : stacking.last(); 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 } //Namespace

View file

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