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
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
fade/fade.cpp
fade/fade_proxy.cpp
)
# .desktop files

@ -28,10 +28,16 @@ namespace KWin
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,23 @@ void FadeEffect::windowDeleted( EffectWindow* 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 )
{
if( w->windowClass() == "ksplashx ksplashx"
|| w->windowClass() == "ksplashsimple ksplashsimple" )
|| w->windowClass() == "ksplashsimple ksplashsimple"
|| ignoredWindows.contains( w ) )
{ // see login effect
return false;
}

@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KWIN_FADE_H
#define KWIN_FADE_H
#include "fade_proxy.h"
#include <kwineffects.h>
namespace KWin
@ -41,14 +43,19 @@ class FadeEffect
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

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

@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "slidingpopups.h"
#include "../fade/fade_proxy.h"
#include <kdebug.h>
namespace KWin
@ -85,7 +87,6 @@ void SlidingPopupsEffect::paintWindow( EffectWindow* w, int mask, QRegion region
bool animating = false;
bool appearing = false;
QRegion clippedRegion = region;
data.opacity = 1.0;
if( mAppearingWindows.contains( w ) )
{
@ -107,20 +108,20 @@ void SlidingPopupsEffect::paintWindow( EffectWindow* w, int mask, QRegion region
{
case West:
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;
case North:
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;
case East:
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;
case South:
default:
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 );
if( w->isOnCurrentDesktop() && mWindowsData.contains( w ) )
{
mAppearingWindows[ w ].setDuration( animationTime( mFadeInTime ));
mAppearingWindows[ w ].setDuration( animationTime( mFadeInTime ) );
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 )
((FadeEffectProxy*)proxy)->setWindowIgnored( w, true );
w->addRepaintFull();
}
}

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

Loading…
Cancel
Save