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"
|
|
|
|
|
2007-04-05 12:07:35 +00:00
|
|
|
namespace KWin
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
|
|
|
|
2007-04-12 11:55:07 +00:00
|
|
|
KWIN_EFFECT( MakeTransparent, MakeTransparentEffect )
|
|
|
|
|
2007-03-25 10:48:07 +00:00
|
|
|
void MakeTransparentEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* paint, QRegion* clip, int time )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-04-12 11:55:07 +00:00
|
|
|
if(( w->isUserMove() || w->isUserResize()) || w->isDialog())
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
2007-04-12 11:55:07 +00:00
|
|
|
*mask |= PAINT_WINDOW_TRANSLUCENT;
|
|
|
|
*mask &= ~PAINT_WINDOW_OPAQUE;
|
2006-10-29 19:08:09 +00:00
|
|
|
}
|
2007-03-25 10:48:07 +00:00
|
|
|
effects->prePaintWindow( w, mask, paint, clip, time );
|
2006-10-29 19:08:09 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2007-04-12 11:55:07 +00:00
|
|
|
if( w->isDialog())
|
2006-10-29 19:08:09 +00:00
|
|
|
data.opacity *= 0.8;
|
2007-04-12 11:55:07 +00:00
|
|
|
if( w->isUserMove() || w->isUserResize())
|
2006-10-29 19:08:09 +00:00
|
|
|
data.opacity *= 0.5;
|
|
|
|
effects->paintWindow( w, mask, region, data );
|
|
|
|
}
|
|
|
|
|
2007-04-12 11:55:07 +00:00
|
|
|
void MakeTransparentEffect::windowUserMovedResized( EffectWindow* w, bool first, bool last )
|
2006-10-29 19:08:09 +00:00
|
|
|
{
|
|
|
|
if( first || last )
|
2007-04-12 11:55:07 +00:00
|
|
|
w->addRepaintFull();
|
2006-10-29 19:08:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|