Hi all,
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

Cheers,
Marco Martin
Index: fade/fade.cpp
===================================================================
--- fade/fade.cpp	(revision 1018630)
+++ fade/fade.cpp	(working copy)
@@ -28,10 +28,16 @@
 KWIN_EFFECT( fade, FadeEffect )
 
 FadeEffect::FadeEffect()
+    : m_proxy( this )
     {
     reconfigure( ReconfigureAll );
     }
 
+const void* FadeEffect::proxy() const
+    {
+    return &m_proxy;
+    }
+
 void FadeEffect::reconfigure( ReconfigureFlags )
     {
     KConfigGroup conf = effects->effectConfig( "Fade" );
@@ -195,10 +201,20 @@
     windows.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 1018630)
+++ 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 const void* proxy() const;
+        
 
+        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* const m_effect;
+    };
+
+} // namespace
+
+#endif
Index: fade/CMakeLists.txt
===================================================================
--- fade/CMakeLists.txt	(revision 1018630)
+++ 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 1018630)
+++ 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();
         }
     }
Index: slidingpopups/slidingpopups.desktop
===================================================================
--- slidingpopups/slidingpopups.desktop	(revision 1018630)
+++ 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

Reply via email to