add a proxy effect to the fade effect, used to add and remove ignored

windows.
the slidingpopups effect adds its managed windows to the ignored list of
the fadeeffect, making them mutually exclusive

svn path=/trunk/KDE/kdebase/workspace/; revision=1021321
remotes/origin/Plasma/5.0
Marco Martin 17 years ago
parent 9e3484e2f0
commit f6bf95cb44
  1. 1
      effects/fade/CMakeLists.txt
  2. 21
      effects/fade/fade.cpp
  3. 7
      effects/fade/fade.h
  4. 6
      effects/shadow/shadow.cpp
  5. 19
      effects/slidingpopups/slidingpopups.cpp
  6. 2
      effects/slidingpopups/slidingpopups.desktop

@ -4,6 +4,7 @@
# Source files # Source files
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
fade/fade.cpp fade/fade.cpp
fade/fade_proxy.cpp
) )
# .desktop files # .desktop files

@ -28,10 +28,16 @@ namespace KWin
KWIN_EFFECT( fade, FadeEffect ) KWIN_EFFECT( fade, FadeEffect )
FadeEffect::FadeEffect() FadeEffect::FadeEffect()
: m_proxy( this )
{ {
reconfigure( ReconfigureAll ); reconfigure( ReconfigureAll );
} }
const void* FadeEffect::proxy() const
{
return &m_proxy;
}
void FadeEffect::reconfigure( ReconfigureFlags ) void FadeEffect::reconfigure( ReconfigureFlags )
{ {
KConfigGroup conf = effects->effectConfig( "Fade" ); KConfigGroup conf = effects->effectConfig( "Fade" );
@ -195,10 +201,23 @@ void FadeEffect::windowDeleted( EffectWindow* w )
windows.remove( w ); windows.remove( w );
} }
void FadeEffect::setWindowIgnored( EffectWindow* w, bool ignore )
{
if (ignore)
{
ignoredWindows.insert( w );
}
else
{
ignoredWindows.remove( w );
}
}
bool FadeEffect::isFadeWindow( EffectWindow* w ) bool FadeEffect::isFadeWindow( EffectWindow* w )
{ {
if( w->windowClass() == "ksplashx ksplashx" if( w->windowClass() == "ksplashx ksplashx"
|| w->windowClass() == "ksplashsimple ksplashsimple" ) || w->windowClass() == "ksplashsimple ksplashsimple"
|| ignoredWindows.contains( w ) )
{ // see login effect { // see login effect
return false; return false;
} }

@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KWIN_FADE_H #ifndef KWIN_FADE_H
#define KWIN_FADE_H #define KWIN_FADE_H
#include "fade_proxy.h"
#include <kwineffects.h> #include <kwineffects.h>
namespace KWin namespace KWin
@ -41,14 +43,19 @@ class FadeEffect
virtual void windowAdded( EffectWindow* c ); virtual void windowAdded( EffectWindow* c );
virtual void windowClosed( EffectWindow* c ); virtual void windowClosed( EffectWindow* c );
virtual void windowDeleted( EffectWindow* c ); virtual void windowDeleted( EffectWindow* c );
virtual const void* proxy() const;
void setWindowIgnored( EffectWindow* w, bool ignore );
bool isFadeWindow( EffectWindow* w ); bool isFadeWindow( EffectWindow* w );
private: private:
class WindowInfo; class WindowInfo;
QHash< const EffectWindow*, WindowInfo > windows; QHash< const EffectWindow*, WindowInfo > windows;
QSet< const EffectWindow* > ignoredWindows;
double fadeInStep, fadeOutStep; double fadeInStep, fadeOutStep;
int fadeInTime, fadeOutTime; int fadeInTime, fadeOutTime;
bool fadeWindows; bool fadeWindows;
FadeEffectProxy m_proxy;
}; };
class FadeEffect::WindowInfo class FadeEffect::WindowInfo

@ -369,9 +369,9 @@ void ShadowEffect::windowClosed( EffectWindow* c )
bool ShadowEffect::useShadow( EffectWindow* w ) const bool ShadowEffect::useShadow( EffectWindow* w ) const
{ {
return !w->isDeleted() && !w->isDesktop() && !w->isDock() return !w->isDeleted() && !w->isDesktop()
// popups may have shadow even if shaped, their shape is almost rectangular // popups and docks may have shadow even if shaped, their shape is almost rectangular
&& ( !w->hasOwnShape() || w->isDropdownMenu() || w->isPopupMenu() || w->isComboBox()) && ( !w->hasOwnShape() || w->isDropdownMenu() || w->isPopupMenu() || w->isComboBox() || w->isDock())
// If decoration has it's own shadow leave it alone // If decoration has it's own shadow leave it alone
&& !( w->hasDecoration() && effects->hasDecorationShadows() ); && !( w->hasDecoration() && effects->hasDecorationShadows() );
} }

@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "slidingpopups.h" #include "slidingpopups.h"
#include "../fade/fade_proxy.h"
#include <kdebug.h> #include <kdebug.h>
namespace KWin namespace KWin
@ -85,7 +87,6 @@ void SlidingPopupsEffect::paintWindow( EffectWindow* w, int mask, QRegion region
bool animating = false; bool animating = false;
bool appearing = false; bool appearing = false;
QRegion clippedRegion = region; QRegion clippedRegion = region;
data.opacity = 1.0;
if( mAppearingWindows.contains( w ) ) if( mAppearingWindows.contains( w ) )
{ {
@ -107,20 +108,20 @@ void SlidingPopupsEffect::paintWindow( EffectWindow* w, int mask, QRegion region
{ {
case West: case West:
data.xTranslate += (start - w->width()) * progress; data.xTranslate += (start - w->width()) * progress;
clippedRegion = clippedRegion.subtracted(QRegion(start - w->width(), w->y(), w->width(), w->height())); clippedRegion = clippedRegion.subtracted(QRegion(start - w->width(), w->y(), w->width(), w->height() ) );
break; break;
case North: case North:
data.yTranslate += (start - w->height()) * progress; data.yTranslate += (start - w->height()) * progress;
clippedRegion = clippedRegion.subtracted(QRegion(w->x(), start - w->height(), w->width(), w->height())); clippedRegion = clippedRegion.subtracted(QRegion( w->x(), start - w->height(), w->width(), w->height() ) );
break; break;
case East: case East:
data.xTranslate += (start - w->x()) * progress; data.xTranslate += (start - w->x()) * progress;
clippedRegion = clippedRegion.subtracted(QRegion(w->x()+w->width(), w->y(), w->width(), w->height())); clippedRegion = clippedRegion.subtracted(QRegion( w->x()+w->width(), w->y(), w->width(), w->height() ) );
break; break;
case South: case South:
default: default:
data.yTranslate += (start - w->y()) * progress; data.yTranslate += (start - w->y()) * progress;
clippedRegion = clippedRegion.subtracted(QRegion(w->x(), start, w->width(), w->height())); clippedRegion = clippedRegion.subtracted(QRegion( w->x(), start, w->width(), w->height() ) );
} }
} }
@ -139,10 +140,16 @@ void SlidingPopupsEffect::windowAdded( EffectWindow* w )
propertyNotify( w, mAtom ); propertyNotify( w, mAtom );
if( w->isOnCurrentDesktop() && mWindowsData.contains( w ) ) if( w->isOnCurrentDesktop() && mWindowsData.contains( w ) )
{ {
mAppearingWindows[ w ].setDuration( animationTime( mFadeInTime )); mAppearingWindows[ w ].setDuration( animationTime( mFadeInTime ) );
mAppearingWindows[ w ].setProgress( 0.0 ); mAppearingWindows[ w ].setProgress( 0.0 );
mAppearingWindows[ w ].setCurveShape( TimeLine::EaseOutCurve ); mAppearingWindows[ w ].setCurveShape( TimeLine::EaseOutCurve );
//tell fadeto ignore this window
const FadeEffectProxy* proxy =
static_cast<const FadeEffectProxy*>( effects->getProxy( "fade" ) );
if( proxy )
((FadeEffectProxy*)proxy)->setWindowIgnored( w, true );
w->addRepaintFull(); w->addRepaintFull();
} }
} }

@ -39,4 +39,4 @@ X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-Library=kwin4_effect_builtins X-KDE-Library=kwin4_effect_builtins
X-KDE-Ordering=70 X-KDE-Ordering=50

Loading…
Cancel
Save