2006-07-04 20:51:01 +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 "effects.h"
|
|
|
|
|
2006-07-06 13:17:44 +00:00
|
|
|
#include "toplevel.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "scene.h"
|
|
|
|
|
2006-10-29 19:08:09 +00:00
|
|
|
#include "effects/fadein.h"
|
2006-10-30 22:49:59 +00:00
|
|
|
#include "effects/howto.h"
|
2006-10-29 19:08:09 +00:00
|
|
|
#include "effects/maketransparent.h"
|
|
|
|
#include "effects/scalein.h"
|
|
|
|
#include "effects/shakymove.h"
|
|
|
|
#include "effects/shiftworkspaceup.h"
|
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
namespace KWinInternal
|
|
|
|
{
|
|
|
|
|
|
|
|
//****************************************
|
|
|
|
// Effect
|
|
|
|
//****************************************
|
|
|
|
|
|
|
|
Effect::~Effect()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-07-06 13:17:44 +00:00
|
|
|
void Effect::windowUserMovedResized( Toplevel* , bool, bool )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
void Effect::windowAdded( Toplevel* )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
void Effect::windowDeleted( Toplevel* )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-10-30 22:49:59 +00:00
|
|
|
void Effect::windowActivated( Toplevel* )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-10-24 19:17:48 +00:00
|
|
|
void Effect::prePaintScreen( int* mask, QRegion* region, int time )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
2006-10-29 19:06:32 +00:00
|
|
|
effects->prePaintScreen( mask, region, time );
|
2006-07-04 20:51:01 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
void Effect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
|
|
|
|
{
|
2006-10-29 19:06:32 +00:00
|
|
|
effects->paintScreen( mask, region, data );
|
2006-10-16 10:12:48 +00:00
|
|
|
}
|
2006-10-29 19:07:10 +00:00
|
|
|
|
|
|
|
void Effect::postPaintScreen()
|
|
|
|
{
|
|
|
|
effects->postPaintScreen();
|
|
|
|
}
|
2006-10-16 10:12:48 +00:00
|
|
|
|
2006-10-24 19:17:48 +00:00
|
|
|
void Effect::prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time )
|
2006-10-16 18:46:07 +00:00
|
|
|
{
|
2006-10-29 19:06:32 +00:00
|
|
|
effects->prePaintWindow( w, mask, region, time );
|
2006-10-16 18:46:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Effect::paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data )
|
|
|
|
{
|
2006-10-29 19:06:32 +00:00
|
|
|
effects->paintWindow( w, mask, region, data );
|
2006-10-16 18:46:07 +00:00
|
|
|
}
|
|
|
|
|
2006-10-29 19:07:10 +00:00
|
|
|
void Effect::postPaintWindow( Scene::Window* w )
|
|
|
|
{
|
|
|
|
effects->postPaintWindow( w );
|
|
|
|
}
|
|
|
|
|
2006-07-06 13:17:44 +00:00
|
|
|
//****************************************
|
|
|
|
// EffectsHandler
|
|
|
|
//****************************************
|
|
|
|
|
2006-07-06 19:02:14 +00:00
|
|
|
EffectsHandler::EffectsHandler( Workspace* ws )
|
2006-10-16 10:12:48 +00:00
|
|
|
: current_paint_window( 0 )
|
|
|
|
, current_paint_screen( 0 )
|
2006-07-06 09:55:10 +00:00
|
|
|
{
|
2006-07-10 18:34:57 +00:00
|
|
|
if( !compositing())
|
|
|
|
return;
|
2006-10-30 22:54:51 +00:00
|
|
|
// effects.append( new HowtoEffect );
|
2006-10-29 19:08:09 +00:00
|
|
|
// effects.append( new MakeTransparentEffect );
|
|
|
|
// effects.append( new ShakyMoveEffect );
|
|
|
|
// effects.append( new ShiftWorkspaceUpEffect( ws ));
|
|
|
|
// effects.append( new FadeInEffect );
|
|
|
|
// effects.append( new ScaleInEffect );
|
2006-07-06 09:55:10 +00:00
|
|
|
}
|
2006-10-21 18:07:00 +00:00
|
|
|
|
2006-07-10 18:34:57 +00:00
|
|
|
EffectsHandler::~EffectsHandler()
|
|
|
|
{
|
2006-10-16 10:12:48 +00:00
|
|
|
foreach( Effect* e, effects )
|
|
|
|
delete e;
|
2006-07-10 18:34:57 +00:00
|
|
|
}
|
2006-07-06 09:55:10 +00:00
|
|
|
|
2006-07-06 13:17:44 +00:00
|
|
|
void EffectsHandler::windowUserMovedResized( Toplevel* c, bool first, bool last )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
2006-10-16 10:12:48 +00:00
|
|
|
foreach( Effect* e, effects )
|
|
|
|
e->windowUserMovedResized( c, first, last );
|
2006-07-04 20:51:01 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
void EffectsHandler::windowAdded( Toplevel* c )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
2006-10-16 10:12:48 +00:00
|
|
|
foreach( Effect* e, effects )
|
|
|
|
e->windowAdded( c );
|
2006-07-04 20:51:01 +00:00
|
|
|
}
|
|
|
|
|
2006-10-16 10:12:48 +00:00
|
|
|
void EffectsHandler::windowDeleted( Toplevel* c )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
2006-10-16 10:12:48 +00:00
|
|
|
foreach( Effect* e, effects )
|
|
|
|
e->windowDeleted( c );
|
2006-07-04 20:51:01 +00:00
|
|
|
}
|
|
|
|
|
2006-10-30 22:49:59 +00:00
|
|
|
void EffectsHandler::windowActivated( Toplevel* c )
|
|
|
|
{
|
|
|
|
foreach( Effect* e, effects )
|
|
|
|
e->windowActivated( c );
|
|
|
|
}
|
|
|
|
|
2006-10-29 19:06:32 +00:00
|
|
|
// start another painting pass
|
|
|
|
void EffectsHandler::startPaint()
|
2006-10-16 10:12:48 +00:00
|
|
|
{
|
2006-10-16 18:46:07 +00:00
|
|
|
assert( current_paint_screen == 0 );
|
|
|
|
assert( current_paint_window == 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
// the idea is that effects call this function again which calls the next one
|
2006-10-29 19:06:32 +00:00
|
|
|
void EffectsHandler::prePaintScreen( int* mask, QRegion* region, int time )
|
2006-10-16 18:46:07 +00:00
|
|
|
{
|
2006-10-29 19:07:10 +00:00
|
|
|
if( current_paint_screen < effects.size())
|
2006-10-29 19:06:32 +00:00
|
|
|
{
|
|
|
|
effects[ current_paint_screen++ ]->prePaintScreen( mask, region, time );
|
|
|
|
--current_paint_screen;
|
|
|
|
}
|
|
|
|
// no special final code
|
2006-10-16 10:12:48 +00:00
|
|
|
}
|
|
|
|
|
2006-10-29 19:06:32 +00:00
|
|
|
void EffectsHandler::paintScreen( int mask, QRegion region, ScreenPaintData& data )
|
2006-07-04 20:51:01 +00:00
|
|
|
{
|
2006-10-29 19:07:10 +00:00
|
|
|
if( current_paint_screen < effects.size())
|
2006-10-29 19:06:32 +00:00
|
|
|
{
|
|
|
|
effects[ current_paint_screen++ ]->paintScreen( mask, region, data );
|
|
|
|
--current_paint_screen;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
scene->finalPaintScreen( mask, region, data );
|
2006-07-04 20:51:01 +00:00
|
|
|
}
|
|
|
|
|
2006-10-29 19:07:10 +00:00
|
|
|
void EffectsHandler::postPaintScreen()
|
|
|
|
{
|
|
|
|
if( current_paint_screen < effects.size())
|
|
|
|
{
|
|
|
|
effects[ current_paint_screen++ ]->postPaintScreen();
|
|
|
|
--current_paint_screen;
|
|
|
|
}
|
|
|
|
// no special final code
|
|
|
|
}
|
|
|
|
|
2006-10-29 19:06:32 +00:00
|
|
|
void EffectsHandler::prePaintWindow( Scene::Window* w, int* mask, QRegion* region, int time )
|
2006-10-16 18:46:07 +00:00
|
|
|
{
|
2006-10-29 19:07:10 +00:00
|
|
|
if( current_paint_window < effects.size())
|
2006-10-29 19:06:32 +00:00
|
|
|
{
|
|
|
|
effects[ current_paint_window++ ]->prePaintWindow( w, mask, region, time );
|
|
|
|
--current_paint_window;
|
|
|
|
}
|
|
|
|
// no special final code
|
2006-10-16 18:46:07 +00:00
|
|
|
}
|
|
|
|
|
2006-10-29 19:06:32 +00:00
|
|
|
void EffectsHandler::paintWindow( Scene::Window* w, int mask, QRegion region, WindowPaintData& data )
|
2006-10-16 18:46:07 +00:00
|
|
|
{
|
2006-10-29 19:07:10 +00:00
|
|
|
if( current_paint_window < effects.size())
|
2006-10-29 19:06:32 +00:00
|
|
|
{
|
|
|
|
effects[ current_paint_window++ ]->paintWindow( w, mask, region, data );
|
|
|
|
--current_paint_window;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
scene->finalPaintWindow( w, mask, region, data );
|
2006-10-16 18:46:07 +00:00
|
|
|
}
|
|
|
|
|
2006-10-29 19:07:10 +00:00
|
|
|
void EffectsHandler::postPaintWindow( Scene::Window* w )
|
|
|
|
{
|
|
|
|
if( current_paint_window < effects.size())
|
|
|
|
{
|
|
|
|
effects[ current_paint_window++ ]->postPaintWindow( w );
|
|
|
|
--current_paint_window;
|
|
|
|
}
|
|
|
|
// no special final code
|
|
|
|
}
|
|
|
|
|
2006-07-04 20:51:01 +00:00
|
|
|
EffectsHandler* effects;
|
|
|
|
|
|
|
|
} // namespace
|