From df2b3170cbfddd3ac671c711e5839e2a51523e26 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Mon, 11 Jan 2010 04:52:19 +0000 Subject: [PATCH] Fix conflicts with sliding popups, fade, fall apart, scale in and explosion by using EffectWindow::data() instead of proxies. BUG: 222168 svn path=/trunk/KDE/kdebase/workspace/; revision=1072837 --- effects/explosion/explosion.cpp | 3 ++ effects/explosion/explosion.desktop | 1 + effects/fade/CMakeLists.txt | 1 - effects/fade/fade.cpp | 28 ++++----------- effects/fade/fade.h | 6 ---- effects/fade/fade_proxy.cpp | 40 --------------------- effects/fade/fade_proxy.h | 47 ------------------------- effects/fallapart/fallapart.cpp | 3 ++ effects/fallapart/fallapart.desktop | 1 + effects/scalein/scalein.cpp | 3 +- effects/slidingpopups/slidingpopups.cpp | 19 +++------- lib/kwineffects.h | 14 ++++++++ 12 files changed, 36 insertions(+), 130 deletions(-) delete mode 100644 effects/fade/fade_proxy.cpp delete mode 100644 effects/fade/fade_proxy.h diff --git a/effects/explosion/explosion.cpp b/effects/explosion/explosion.cpp index 4e3c2570e5..8206fd12c2 100644 --- a/effects/explosion/explosion.cpp +++ b/effects/explosion/explosion.cpp @@ -196,6 +196,9 @@ void ExplosionEffect::postPaintScreen() void ExplosionEffect::windowClosed( EffectWindow* c ) { + const void* e = c->data( WindowClosedGrabRole ).value(); + if( e && e != this ) + return; if( c->isOnCurrentDesktop() && !c->isMinimized()) { mWindows[ c ] = 0; // count up to 1 diff --git a/effects/explosion/explosion.desktop b/effects/explosion/explosion.desktop index 8ead9a024b..08df60c193 100644 --- a/effects/explosion/explosion.desktop +++ b/effects/explosion/explosion.desktop @@ -153,3 +153,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins +X-KDE-Ordering=70 diff --git a/effects/fade/CMakeLists.txt b/effects/fade/CMakeLists.txt index c79b8f063e..865afb7560 100644 --- a/effects/fade/CMakeLists.txt +++ b/effects/fade/CMakeLists.txt @@ -4,7 +4,6 @@ # Source files set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} fade/fade.cpp - fade/fade_proxy.cpp ) # .desktop files diff --git a/effects/fade/fade.cpp b/effects/fade/fade.cpp index be3194fee9..4911527e44 100644 --- a/effects/fade/fade.cpp +++ b/effects/fade/fade.cpp @@ -28,16 +28,10 @@ namespace KWin KWIN_EFFECT( fade, FadeEffect ) FadeEffect::FadeEffect() - : m_proxy( this ) { reconfigure( ReconfigureAll ); } -void* FadeEffect::proxy() - { - return &m_proxy; - } - void FadeEffect::reconfigure( ReconfigureFlags ) { KConfigGroup conf = effects->effectConfig( "Fade" ); @@ -199,26 +193,18 @@ void FadeEffect::windowClosed( EffectWindow* w ) void FadeEffect::windowDeleted( EffectWindow* w ) { windows.remove( w ); - ignoredWindows.remove( w ); } -void FadeEffect::setWindowIgnored( EffectWindow* w, bool ignore ) -{ - if (ignore) - { - ignoredWindows.insert( w ); - } - else - { - ignoredWindows.remove( w ); - } -} - bool FadeEffect::isFadeWindow( EffectWindow* w ) { + void* e; + if( w->isDeleted() ) + e = w->data( WindowClosedGrabRole ).value(); + else + e = w->data( WindowAddedGrabRole ).value(); if( w->windowClass() == "ksplashx ksplashx" - || w->windowClass() == "ksplashsimple ksplashsimple" - || ignoredWindows.contains( w ) ) + || w->windowClass() == "ksplashsimple ksplashsimple" + || ( e && e != this )) { // see login effect return false; } diff --git a/effects/fade/fade.h b/effects/fade/fade.h index 99e0daa64f..48b100e638 100644 --- a/effects/fade/fade.h +++ b/effects/fade/fade.h @@ -21,8 +21,6 @@ along with this program. If not, see . #ifndef KWIN_FADE_H #define KWIN_FADE_H -#include "fade_proxy.h" - #include namespace KWin @@ -43,18 +41,14 @@ class FadeEffect virtual void windowAdded( EffectWindow* c ); virtual void windowClosed( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c ); - virtual void* proxy(); - void setWindowIgnored( EffectWindow* w, bool ignore ); bool isFadeWindow( EffectWindow* w ); private: class WindowInfo; QHash< const EffectWindow*, WindowInfo > windows; - QSet< const EffectWindow* > ignoredWindows; double fadeInStep, fadeOutStep; int fadeInTime, fadeOutTime; bool fadeWindows; - FadeEffectProxy m_proxy; }; class FadeEffect::WindowInfo diff --git a/effects/fade/fade_proxy.cpp b/effects/fade/fade_proxy.cpp deleted file mode 100644 index 23f1cf9024..0000000000 --- a/effects/fade/fade_proxy.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Lucas Murray - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#include "fade_proxy.h" -#include "fade.h" - -namespace KWin -{ - -FadeEffectProxy::FadeEffectProxy( FadeEffect* effect ) - : m_effect( effect ) - { - } - -FadeEffectProxy::~FadeEffectProxy() - { - } - -void FadeEffectProxy::setWindowIgnored(EffectWindow *w, bool ignore) - { - m_effect->setWindowIgnored(w, ignore); - } -} // namespace diff --git a/effects/fade/fade_proxy.h b/effects/fade/fade_proxy.h deleted file mode 100644 index 8aa3c4d986..0000000000 --- a/effects/fade/fade_proxy.h +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2009 Lucas Murray - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#ifndef KWIN_FADE_PROXY_H -#define KWIN_FADE_PROXY_H - - -#include - -namespace KWin -{ - -class FadeEffect; - -// Example proxy code, TODO: Use or remove -class FadeEffectProxy - { - public: - FadeEffectProxy( FadeEffect* effect ); - ~FadeEffectProxy(); - - void setWindowIgnored(EffectWindow *w, bool ignore); - - private: - FadeEffect* m_effect; - }; - -} // namespace - -#endif diff --git a/effects/fallapart/fallapart.cpp b/effects/fallapart/fallapart.cpp index ddadb4b9dc..7dd895d07b 100644 --- a/effects/fallapart/fallapart.cpp +++ b/effects/fallapart/fallapart.cpp @@ -142,6 +142,9 @@ void FallApartEffect::windowClosed( EffectWindow* c ) { if ( !isRealWindow( c ) ) return; + const void* e = c->data( WindowClosedGrabRole ).value(); + if( e && e != this ) + return; windows[ c ] = 0; c->refWindow(); } diff --git a/effects/fallapart/fallapart.desktop b/effects/fallapart/fallapart.desktop index 54a465e52f..481f482a93 100644 --- a/effects/fallapart/fallapart.desktop +++ b/effects/fallapart/fallapart.desktop @@ -149,3 +149,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins +X-KDE-Ordering=70 diff --git a/effects/scalein/scalein.cpp b/effects/scalein/scalein.cpp index 79b277214d..30a2fd1747 100644 --- a/effects/scalein/scalein.cpp +++ b/effects/scalein/scalein.cpp @@ -61,8 +61,9 @@ void ScaleInEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wind bool ScaleInEffect::isScaleWindow( EffectWindow* w ) { + const void* e = w->data( WindowAddedGrabRole ).value(); // TODO: isSpecialWindow is rather generic, maybe tell windowtypes separately? - if ( w->isPopupMenu() || w->isSpecialWindow() || w->isUtility() ) + if ( w->isPopupMenu() || w->isSpecialWindow() || w->isUtility() || ( e && e != this )) return false; return true; } diff --git a/effects/slidingpopups/slidingpopups.cpp b/effects/slidingpopups/slidingpopups.cpp index 2ab69b4cbb..3456c682a3 100644 --- a/effects/slidingpopups/slidingpopups.cpp +++ b/effects/slidingpopups/slidingpopups.cpp @@ -20,8 +20,6 @@ along with this program. If not, see . #include "slidingpopups.h" -#include "../fade/fade_proxy.h" - #include namespace KWin @@ -150,11 +148,8 @@ void SlidingPopupsEffect::windowAdded( EffectWindow* w ) mAppearingWindows[ w ].setProgress( 0.0 ); mAppearingWindows[ w ].setCurveShape( TimeLine::EaseOutCurve ); - //tell fadeto ignore this window - const FadeEffectProxy* proxy = - static_cast( effects->getProxy( "fade" ) ); - if( proxy ) - ((FadeEffectProxy*)proxy)->setWindowIgnored( w, true ); + // Tell other windowAdded() effects to ignore this window + w->setData( WindowAddedGrabRole, QVariant::fromValue( static_cast( this ))); w->addRepaintFull(); } @@ -171,6 +166,9 @@ void SlidingPopupsEffect::windowClosed( EffectWindow* w ) mDisappearingWindows[ w ].setProgress( 0.0 ); mDisappearingWindows[ w ].setCurveShape( TimeLine::EaseOutCurve ); + // Tell other windowClosed() effects to ignore this window + w->setData( WindowClosedGrabRole, QVariant::fromValue( static_cast( this ))); + w->addRepaintFull(); } } @@ -190,14 +188,7 @@ void SlidingPopupsEffect::propertyNotify( EffectWindow* w, long a ) QByteArray data = w->readProperty( mAtom, mAtom, 32 ); if( data.length() < 1 ) - { - FadeEffectProxy* proxy = - static_cast( effects->getProxy( "fade" ) ); - if( proxy ) - proxy->setWindowIgnored(w, false); - return; - } long* d = reinterpret_cast< long* >( data.data()); Data animData; diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 26e2d6c502..440aab5d19 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -182,6 +182,20 @@ enum WindowQuadType EFFECT_QUAD_TYPE_START = 100 ///< @internal }; +/** + * EffectWindow::setData() and EffectWindow::data() global roles. + * All values between 0 and 999 are reserved for global roles. + */ +enum DataRole + { + // Grab roles are used to force all other animations to ignore the window. + // The value of the data is set to the Effect's `this` value. + WindowAddedGrabRole = 1, + WindowClosedGrabRole, + WindowMinimizedGrabRole, + WindowUnminimizedGrabRole + }; + /** * Infinite region (i.e. a special region type saying that everything needs to be painted). */