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 "maketransparent.h"
|
|
|
|
|
|
|
|
#include <client.h>
|
|
|
|
|
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void MakeTransparentEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* region, int time )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
|
|
|
const Client* c = dynamic_cast< const Client* >( w->window());
|
|
|
|
if(( c != NULL && ( c->isMove() || c->isResize())) || w->window()->isDialog())
|
|
|
|
{
|
|
|
|
*mask |= Scene::PAINT_WINDOW_TRANSLUCENT;
|
|
|
|
*mask &= ~Scene::PAINT_WINDOW_OPAQUE;
|
|
|
|
}
|
|
|
|
effects->prePaintWindow( w, mask, region, time );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void MakeTransparentEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
|
|
|
const Client* c = dynamic_cast< const Client* >( w->window());
|
|
|
|
if( w->window()->isDialog())
|
|
|
|
data.opacity *= 0.8;
|
2006-10-30 20:33:06 +00:00
|
|
|
if( c != NULL && ( c->isMove() || c->isResize()))
|
2006-10-29 19:08:09 +00:00
|
|
|
data.opacity *= 0.5;
|
|
|
|
effects->paintWindow( w, mask, region, data );
|
|
|
|
}
|
|
|
|
|
2007-01-22 22:57:22 +00:00
|
|
|
void MakeTransparentEffect::windowUserMovedResized( EffectWindow* c, bool first, bool last )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
|
|
|
if( first || last )
|
2007-01-22 22:57:22 +00:00
|
|
|
c->window()->addDamageFull();
|
2006-10-29 19:08:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|