From 633d80001f24768afca54861dd86f1be72d7c551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 13 Jun 2010 07:36:40 +0000 Subject: [PATCH] Add new role, so that fullscreen effects can enforce blurring of windows they know to be translucent and on a fixed position. Used in cube animation for all sticky windows and in desktop grid for the add/remove desktops window. svn path=/trunk/KDE/kdebase/workspace/; revision=1137489 --- effects/blur/blur.cpp | 4 +++- effects/cube/cubeslide.cpp | 9 +++++++++ effects/desktopgrid/desktopgrid.cpp | 13 +++++++++++-- lib/kwineffects.h | 3 ++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index f878f8b915..eef3857d6e 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -220,7 +220,9 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion region, WindowPai bool valid = target->valid() && shader->isValid(); QRegion shape; - if (!effects->activeFullScreenEffect() && hasAlpha && !w->isDesktop() && !transformed) + const QVariant forceBlur = w->data( WindowForceBlurRole ); + if ((!effects->activeFullScreenEffect() || (forceBlur.isValid() && forceBlur.toBool() )) + && hasAlpha && !w->isDesktop() && !transformed) shape = blurRegion(w).translated(w->geometry().topLeft()) & screen; if (valid && !shape.isEmpty() && region.intersects(shape.boundingRect())) diff --git a/effects/cube/cubeslide.cpp b/effects/cube/cubeslide.cpp index 5a7181c7cb..44da3759b3 100644 --- a/effects/cube/cubeslide.cpp +++ b/effects/cube/cubeslide.cpp @@ -204,15 +204,18 @@ void CubeSlideEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data QRect rect = effects->clientArea( FullArea, effects->activeScreen(), painting_desktop ); if( dontSlidePanels && w->isDock()) { + w->setData( WindowForceBlurRole, QVariant( true ) ); panels.insert( w ); } if( !w->isManaged() ) { + w->setData( WindowForceBlurRole, QVariant( true ) ); stickyWindows.insert( w ); } else if( dontSlideStickyWindows && !w->isDock() && !w->isDesktop() && w->isOnAllDesktops()) { + w->setData( WindowForceBlurRole, QVariant( true ) ); stickyWindows.insert( w ); } if( w->isOnDesktop( painting_desktop ) ) @@ -453,6 +456,12 @@ void CubeSlideEffect::postPaintScreen() timeLine.setCurveShape( TimeLine::LinearCurve ); if( slideRotations.empty() ) { + foreach( EffectWindow* w, panels ) + w->setData( WindowForceBlurRole, QVariant( false ) ); + foreach( EffectWindow* w, stickyWindows ) + w->setData( WindowForceBlurRole, QVariant( false ) ); + stickyWindows.clear(); + panels.clear(); effects->setActiveFullScreenEffect( 0 ); } } diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 1154530796..9aedf5bef8 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -38,6 +38,7 @@ along with this program. If not, see . #include #include #include +#include namespace KWin { @@ -166,12 +167,19 @@ void DesktopGridEffect::paintScreen( int mask, QRegion region, ScreenPaintData& it != m_desktopButtonsViews.end(); ++it ) { if( !it.value() ) - it.value() = effects->findWindow( it.key()->winId() ); + { + EffectWindow *view = effects->findWindow( it.key()->winId() ); + if( view ) + { + view->setData( WindowForceBlurRole, QVariant( true ) ); + it.value() = view; + } + } if( it.value() ) { WindowPaintData d( it.value() ); d.opacity *= timeline.value(); - effects->drawWindow( it.value(), PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_TRANSLUCENT, + effects->drawWindow( it.value(), PAINT_WINDOW_TRANSLUCENT, infiniteRegion(), d ); } } @@ -1544,6 +1552,7 @@ DesktopButtonsView::DesktopButtonsView( QWidget* parent ) qreal width = form->size().width() + left + right; qreal height = form->size().height() + top + bottom; m_frame->resizeFrame( QSizeF( width, height ) ); + Plasma::WindowEffects::enableBlurBehind( winId(), true, m_frame->mask() ); form->setPos( left, top ); scene->setSceneRect( QRectF( QPointF( 0, 0 ), QSizeF( width, height ) ) ); setScene( scene ); diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 0979294636..2a5ae70f78 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -192,7 +192,8 @@ enum DataRole WindowAddedGrabRole = 1, WindowClosedGrabRole, WindowMinimizedGrabRole, - WindowUnminimizedGrabRole + WindowUnminimizedGrabRole, + WindowForceBlurRole ///< For fullscreen effects to enforce blurring of windows }; /**