2006-10-29 19:08:09 +00:00
|
|
|
/*****************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#include "fadein.h"
|
|
|
|
|
|
|
|
#include <client.h>
|
|
|
|
|
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeInEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* region, int time )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
if( windows.contains( w ))
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
windows[ w ] += time / 1000.; // complete change in 1000ms
|
|
|
|
if( windows[ w ] < 1 )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
|
|
|
*mask |= Scene::PAINT_WINDOW_TRANSLUCENT;
|
|
|
|
*mask &= ~Scene::PAINT_WINDOW_OPAQUE;
|
|
|
|
}
|
|
|
|
else
|
2007-01-22 22:57:22 +00:00
|
|
|
windows.remove( w );
|
2006-10-29 19:08:09 +00:00
|
|
|
}
|
|
|
|
effects->prePaintWindow( w, mask, region, time );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeInEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
if( windows.contains( w ))
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
data.opacity *= windows[ w ];
|
2006-10-29 19:08:09 +00:00
|
|
|
}
|
|
|
|
effects->paintWindow( w, mask, region, data );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeInEffect::postPaintWindow( EffectWindow* w )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
if( windows.contains( w ))
|
2006-10-29 19:08:09 +00:00
|
|
|
w->window()->addDamageFull(); // trigger next animation repaint
|
|
|
|
effects->postPaintWindow( w );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeInEffect::windowAdded( EffectWindow* c )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
Client* cc = dynamic_cast< Client* >( c->window());
|
2006-10-29 19:08:09 +00:00
|
|
|
if( cc == NULL || cc->isOnCurrentDesktop())
|
|
|
|
{
|
|
|
|
windows[ c ] = 0;
|
2007-01-22 22:57:22 +00:00
|
|
|
c->window()->addDamageFull();
|
2006-10-29 19:08:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeInEffect::windowClosed( EffectWindow* c )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
|
|
|
windows.remove( c );
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|