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
This commit is contained in:
parent
e32fd9e0cd
commit
df2b3170cb
12 changed files with 36 additions and 130 deletions
|
@ -196,6 +196,9 @@ void ExplosionEffect::postPaintScreen()
|
|||
|
||||
void ExplosionEffect::windowClosed( EffectWindow* c )
|
||||
{
|
||||
const void* e = c->data( WindowClosedGrabRole ).value<void*>();
|
||||
if( e && e != this )
|
||||
return;
|
||||
if( c->isOnCurrentDesktop() && !c->isMinimized())
|
||||
{
|
||||
mWindows[ c ] = 0; // count up to 1
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
# Source files
|
||||
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
|
||||
fade/fade.cpp
|
||||
fade/fade_proxy.cpp
|
||||
)
|
||||
|
||||
# .desktop files
|
||||
|
|
|
@ -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<void*>();
|
||||
else
|
||||
e = w->data( WindowAddedGrabRole ).value<void*>();
|
||||
if( w->windowClass() == "ksplashx ksplashx"
|
||||
|| w->windowClass() == "ksplashsimple ksplashsimple"
|
||||
|| ignoredWindows.contains( w ) )
|
||||
|| w->windowClass() == "ksplashsimple ksplashsimple"
|
||||
|| ( e && e != this ))
|
||||
{ // see login effect
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ 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
|
||||
|
@ -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
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.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)
|
||||
{
|
||||
m_effect->setWindowIgnored(w, ignore);
|
||||
}
|
||||
} // namespace
|
|
@ -1,47 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.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 FadeEffectProxy
|
||||
{
|
||||
public:
|
||||
FadeEffectProxy( FadeEffect* effect );
|
||||
~FadeEffectProxy();
|
||||
|
||||
void setWindowIgnored(EffectWindow *w, bool ignore);
|
||||
|
||||
private:
|
||||
FadeEffect* m_effect;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -142,6 +142,9 @@ void FallApartEffect::windowClosed( EffectWindow* c )
|
|||
{
|
||||
if ( !isRealWindow( c ) )
|
||||
return;
|
||||
const void* e = c->data( WindowClosedGrabRole ).value<void*>();
|
||||
if( e && e != this )
|
||||
return;
|
||||
windows[ c ] = 0;
|
||||
c->refWindow();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<void*>();
|
||||
// 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;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ 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
|
||||
|
@ -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<const FadeEffectProxy*>( 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<void*>( 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<void*>( 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<FadeEffectProxy*>( effects->getProxy( "fade" ) );
|
||||
if( proxy )
|
||||
proxy->setWindowIgnored(w, false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
long* d = reinterpret_cast< long* >( data.data());
|
||||
Data animData;
|
||||
|
|
|
@ -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).
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue