On 9/3/09, Lucas Murray <lmur...@undefinedfire.com> wrote: > On Thu, Sep 3, 2009 at 7:36 PM, Marco Martin<notm...@gmail.com> wrote: >> this patch adds a proxy to the fade effect that permits to set ignored >> windows, all the windows where slidingpopups is applied add themseves >> to this list > > - Does not meet coding style (Check whitespace between parentheses and > end of lines as well as brace locations) > - Example comments have not been removed (E.g. "// Example proxy code, > TODO: Use or remove") > - Typos in other comments > - kDebug() should be in zone 1212 (Although I think this is no longer > required in trunk it should still be added for consistency) > - Those debug comments probably shouldn't even be required > - FadeEffect::proxy() should not be const'ed on either side due to > recent proxy API changes at your request > - Code does not take into account when a window initially slides out > yet has been configured to not slide back in on close (Currently it > prevents the window from being faded as windows are only ever added to > the list, never removed) > - Memory leak: Windows are not removed from FadeEffect::ignoredWindows > when they are deleted this version should address those points
Cheers, Marco Martin > -- > > Lucas Murray :: http://www.undefinedfire.com > GPG Fingerprint: 0B88 499E 3F5B 1405 D952 258A AD90 B4F5 90B6 3534 > _______________________________________________ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel >
Index: fade/fade.cpp =================================================================== --- fade/fade.cpp (revision 1019580) +++ fade/fade.cpp (working copy) @@ -28,10 +28,16 @@ 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" ); @@ -193,12 +199,23 @@ 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 ) { if( w->windowClass() == "ksplashx ksplashx" - || w->windowClass() == "ksplashsimple ksplashsimple" ) + || w->windowClass() == "ksplashsimple ksplashsimple" + || ignoredWindows.contains(w)) { // see login effect return false; } Index: fade/fade_proxy.cpp =================================================================== --- fade/fade_proxy.cpp (revision 0) +++ fade/fade_proxy.cpp (revision 0) @@ -0,0 +1,40 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2009 Marco Martin <notm...@gmail.com> + +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 <http://www.gnu.org/licenses/>. +*********************************************************************/ + +#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 ) const + { + m_effect->setWindowIgnored( w, ignore ); + } +} // namespace Index: fade/fade.h =================================================================== --- fade/fade.h (revision 1019580) +++ fade/fade.h (working copy) @@ -21,6 +21,8 @@ #ifndef KWIN_FADE_H #define KWIN_FADE_H +#include "fade_proxy.h" + #include <kwineffects.h> namespace KWin @@ -41,14 +43,19 @@ 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 Index: fade/fade_proxy.h =================================================================== --- fade/fade_proxy.h (revision 0) +++ fade/fade_proxy.h (revision 0) @@ -0,0 +1,47 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2009 Marco Martin <notm...@gmail.com> + +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 <http://www.gnu.org/licenses/>. +*********************************************************************/ + +#ifndef KWIN_FADE_PROXY_H +#define KWIN_FADE_PROXY_H + + +#include <kwineffects.h> + +namespace KWin +{ + +class FadeEffect; + +// Example proxy code, TODO: Use or remove +class KWIN_EXPORT FadeEffectProxy + { + public: + FadeEffectProxy( FadeEffect* effect ); + ~FadeEffectProxy(); + + void setWindowIgnored( EffectWindow *w, bool ignore ) const; + + private: + FadeEffect* m_effect; + }; + +} // namespace + +#endif Index: fade/CMakeLists.txt =================================================================== --- fade/CMakeLists.txt (revision 1019580) +++ fade/CMakeLists.txt (working copy) @@ -4,6 +4,7 @@ # Source files set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} fade/fade.cpp + fade/fade_proxy.cpp ) # .desktop files Index: slidingpopups/slidingpopups.cpp =================================================================== --- slidingpopups/slidingpopups.cpp (revision 1019580) +++ slidingpopups/slidingpopups.cpp (working copy) @@ -20,6 +20,8 @@ #include "slidingpopups.h" +#include "../fade/fade_proxy.h" + #include <kdebug.h> namespace KWin @@ -85,7 +87,6 @@ bool animating = false; bool appearing = false; QRegion clippedRegion = region; - data.opacity = 1.0; if( mAppearingWindows.contains( w ) ) { @@ -143,6 +144,17 @@ mAppearingWindows[ w ].setProgress( 0.0 ); mAppearingWindows[ w ].setCurveShape( TimeLine::EaseOutCurve ); + //tell fadeto ignore this window + const FadeEffectProxy* proxy = + static_cast<const FadeEffectProxy*>( effects->getProxy( "fade" ) ); + if( proxy ) + { + kDebug() << "Retrieved FadeEffectProxy"; + proxy->setWindowIgnored(w, true); + } + else + kDebug() << "Failed to retrieve FadeEffectProxy. Maybe the fade effect isn't enabled?"; + w->addRepaintFull(); } } @@ -177,7 +189,18 @@ QByteArray data = w->readProperty( mAtom, mAtom, 32 ); if( data.length() < 1 ) + { + const FadeEffectProxy* proxy = + static_cast<const FadeEffectProxy*>( effects->getProxy( "fade" ) ); + if( proxy ) + { + kDebug() << "Retrieved FadeEffectProxy"; + proxy->setWindowIgnored(w, false); + } + else + kDebug() << "Failed to retrieve FadeEffectProxy. Maybe the fade effect isn't enabled?"; return; + } long* d = reinterpret_cast< long* >( data.data()); Data animData; animData.start = d[ 0 ]; Index: slidingpopups/slidingpopups.desktop =================================================================== --- slidingpopups/slidingpopups.desktop (revision 1019580) +++ slidingpopups/slidingpopups.desktop (working copy) @@ -39,4 +39,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=70 +X-KDE-Ordering=50
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel