2007-01-15 18:03:04 +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 "fadeout.h"
|
|
|
|
|
|
|
|
#include <client.h>
|
2007-01-22 22:51:30 +00:00
|
|
|
#include <deleted.h>
|
2007-01-15 18:03:04 +00:00
|
|
|
|
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeOutEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* region, int time )
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
if( windows.contains( w ))
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
windows[ w ] -= time / 1000.; // complete change in 1000ms
|
|
|
|
if( windows[ w ] > 0 )
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
|
|
|
*mask |= Scene::PAINT_WINDOW_TRANSLUCENT;
|
|
|
|
*mask &= ~( Scene::PAINT_WINDOW_OPAQUE | Scene::PAINT_WINDOW_DISABLED );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
windows.remove( w );
|
2007-01-22 22:51:30 +00:00
|
|
|
static_cast< Deleted* >( w->window())->unrefWindow();
|
2007-01-15 18:03:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
effects->prePaintWindow( w, mask, region, time );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeOutEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
if( windows.contains( w ))
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
data.opacity *= windows[ w ];
|
2007-01-15 18:03:04 +00:00
|
|
|
}
|
|
|
|
effects->paintWindow( w, mask, region, data );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeOutEffect::postPaintWindow( EffectWindow* w )
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
if( windows.contains( w ))
|
2007-01-15 18:03:04 +00:00
|
|
|
w->window()->addDamageFull(); // trigger next animation repaint
|
|
|
|
effects->postPaintWindow( w );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeOutEffect::windowClosed( EffectWindow* c )
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
Client* cc = dynamic_cast< Client* >( c->window());
|
2007-01-15 18:03:04 +00:00
|
|
|
if( cc == NULL || cc->isOnCurrentDesktop())
|
|
|
|
{
|
2007-01-22 22:57:22 +00:00
|
|
|
windows[ c ] = 1; // count down to 0
|
|
|
|
c->window()->addDamageFull();
|
|
|
|
static_cast< Deleted* >( c->window())->refWindow();
|
2007-01-15 18:03:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void FadeOutEffect::windowDeleted( EffectWindow* c )
|
2007-01-15 18:03:04 +00:00
|
|
|
{
|
|
|
|
windows.remove( c );
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|