kwin/effects/maketransparent.cpp
Luboš Luňák f52b8e48cd branches/work/kwin_composite becomes new trunk kwin.
svn path=/trunk/KDE/kdebase/workspace/; revision=659202
2007-04-29 17:35:43 +00:00

43 lines
1.3 KiB
C++

/*****************************************************************
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"
namespace KWin
{
KWIN_EFFECT( MakeTransparent, MakeTransparentEffect )
void MakeTransparentEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* paint, QRegion* clip, int time )
{
if(( w->isUserMove() || w->isUserResize()) || w->isDialog())
{
*mask |= PAINT_WINDOW_TRANSLUCENT;
*mask &= ~PAINT_WINDOW_OPAQUE;
}
effects->prePaintWindow( w, mask, paint, clip, time );
}
void MakeTransparentEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
{
if( w->isDialog())
data.opacity *= 0.8;
if( w->isUserMove() || w->isUserResize())
data.opacity *= 0.5;
effects->paintWindow( w, mask, region, data );
}
void MakeTransparentEffect::windowUserMovedResized( EffectWindow* w, bool first, bool last )
{
if( first || last )
w->addRepaintFull();
}
} // namespace