From fc21b3099ce16fa35de9aaea7207c2d5f65bce2f Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Sun, 17 May 2009 19:38:06 +0000 Subject: [PATCH] Don't handle windows set to keepAbove(). Fixes issues with windows like yakuake or full screen windows. Use PaintClipper instead of direcly subtracting from paint region. svn path=/trunk/KDE/kdebase/workspace/; revision=969256 --- effects/slideback/slideback.cpp | 28 ++++++++++++++++++++-------- effects/slideback/slideback.h | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/effects/slideback/slideback.cpp b/effects/slideback/slideback.cpp index 2bc823e71e..c6eec3aae3 100644 --- a/effects/slideback/slideback.cpp +++ b/effects/slideback/slideback.cpp @@ -35,18 +35,18 @@ SlideBackEffect::SlideBackEffect() void SlideBackEffect::windowActivated( EffectWindow* w ) { - if( w == NULL ) + if( w == NULL || w->keepAbove()) // plasma popups, yakuake etc... { return; - } - + } + if( disabled || effects->activeFullScreenEffect() ) // TabBox or PresentWindows/Cube in progress { updateStackingOrder(); disabled = false; return; } - if( !isWindowUsable( w ) || !isWindowOnTop( w ) ) // Focus changed but stacking still the same + if( !isWindowUsable( w ) || !stackingOrderChanged() ) // Focus changed but stacking still the same { updateStackingOrder(); return; @@ -105,7 +105,7 @@ void SlideBackEffect::windowActivated( EffectWindow* w ) } } - if( tmp->isDock() ) + if( tmp->isDock() || tmp->keepAbove() ) { effects->setElevatedWindow( tmp, true ); elevatedList.append( tmp ); @@ -192,6 +192,15 @@ void SlideBackEffect::prePaintWindow( EffectWindow *w, WindowPrePaintData &data, void SlideBackEffect::paintWindow( EffectWindow *w, int mask, QRegion region, WindowPaintData &data ) { + if( !clippedRegions.isEmpty() ) + { + foreach( const QRegion ®ion, clippedRegions ) + { + PaintClipper::pop( region ); + } + clippedRegions.clear(); + } + if( stackingOrderChanged() && ( w == newTopWindow() ) ) { /* This can happen because of two reasons: @@ -201,7 +210,10 @@ void SlideBackEffect::paintWindow( EffectWindow *w, int mask, QRegion region, Wi { if( oldStackingOrder.lastIndexOf( tmp ) > oldStackingOrder.lastIndexOf( w ) && isWindowUsable( tmp ) ) { - region = 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() ); } } // Add a full repaint to make sure the not painted area is repainted soon @@ -241,7 +253,7 @@ void SlideBackEffect::postPaintWindow( EffectWindow* w ) { elevatedGeometry = motionManager.transformedGeometry( tmp ).toAlignedRect(); } - if( effects->activeWindow() && !tmp->isDock() && effects->activeWindow()->geometry().intersects( elevatedGeometry ) ) + if( effects->activeWindow() && !tmp->isDock() && !tmp->keepAbove() && effects->activeWindow()->geometry().intersects( elevatedGeometry ) ) { QRect newDestination; if( effects->activeWindow()->isModal() ) @@ -352,7 +364,7 @@ bool SlideBackEffect::isWindowOnTop( EffectWindow* w ) bool SlideBackEffect::isWindowUsable( EffectWindow* w ) { - return w && ( w->isNormalWindow() || w->isDialog() ) && !w->isDeleted() && !w->isMinimized(); + return w && ( w->isNormalWindow() || w->isDialog() ) && !w->keepAbove() && !w->isDeleted() && !w->isMinimized(); } bool SlideBackEffect::intersects( EffectWindow* windowUnder, const QRect &windowOverGeometry ) diff --git a/effects/slideback/slideback.h b/effects/slideback/slideback.h index 0073f77403..ea4d484fc1 100644 --- a/effects/slideback/slideback.h +++ b/effects/slideback/slideback.h @@ -56,6 +56,7 @@ class SlideBackEffect EffectWindowList elevatedList; QHash destinationList; bool disabled; + QList clippedRegions; QRect getSlideDestination( const QRect &windowUnderGeometry, const QRect &windowOverGeometry); void updateStackingOrder();