Convert to plugins.

svn path=/branches/work/kwin_composite/; revision=652631
This commit is contained in:
Luboš Luňák 2007-04-11 15:53:32 +00:00
parent ca5451fef0
commit 74e97a2c9b
7 changed files with 36 additions and 13 deletions

View file

@ -16,6 +16,11 @@ SET(kwin4_effect_builtins_sources
zoom.cpp
)
SET(kwin4_effect_tests_sources
test_input.cpp
test_thumbnail.cpp
)
if(OPENGL_FOUND)
SET(kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
shadow.cpp
@ -47,10 +52,14 @@ if (X11_Xrender_FOUND)
target_link_libraries(kwin4_effect_builtins ${X11_Xrender_LIB})
endif (X11_Xrender_FOUND)
KWIN4_ADD_EFFECT(tests ${kwin4_effect_tests_sources})
install( FILES
presentwindows.desktop
diminactive.desktop
zoom.desktop
test_input.desktop
test_thumbnail.desktop
DESTINATION ${DATA_INSTALL_DIR}/kwin/effects )
include(UsePkgConfig)

View file

@ -21,12 +21,16 @@ License. See the file "COPYING" for the exact licensing terms.
#include "test_input.h"
#include <workspace.h>
#include <client.h>
#include <assert.h>
#include <qcursor.h>
#include <qevent.h>
namespace KWin
{
KWIN_EFFECT( TestInput, TestInputEffect )
TestInputEffect::TestInputEffect()
{
input = effects->createInputWindow( this, 0, 0, displayWidth(), displayHeight(), Qt::CrossCursor );
@ -39,7 +43,7 @@ TestInputEffect::~TestInputEffect()
void TestInputEffect::prePaintScreen( int* mask, QRegion* region, int time )
{
*mask |= Scene::PAINT_SCREEN_TRANSFORMED;
*mask |= PAINT_SCREEN_TRANSFORMED;
effects->prePaintScreen( mask, region, time );
}
@ -56,12 +60,12 @@ void TestInputEffect::windowInputMouseEvent( Window w, QEvent* e )
return;
QPoint pos = static_cast< QMouseEvent* >( e )->pos();
pos -= QPoint( 0, 100 ); // adjust for transformation
foreach( Client* c, Workspace::self()->stackingOrder())
foreach( EffectWindow* c, effects->stackingOrder())
{
if( c->isShown( true ) && c->isOnCurrentDesktop()
if( /* TODO c->isShown( true ) && */c->isOnCurrentDesktop()
&& c->geometry().contains( pos ))
{
effects->activateWindow( c->effectWindow());
effects->activateWindow( c );
return;
}
}

View file

@ -0,0 +1,4 @@
[Desktop Entry]
Encoding=UTF-8
Name=TestInput
X-KDE-Library=kwin4_effect_tests

View file

@ -17,7 +17,7 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef KWIN_TEST_INPUT_H
#define KWIN_TEST_INPUT_H
#include <effects.h>
#include <kwineffects.h>
namespace KWin
{

View file

@ -20,6 +20,8 @@ License. See the file "COPYING" for the exact licensing terms.
namespace KWin
{
KWIN_EFFECT( TestThumbnail, TestThumbnailEffect )
TestThumbnailEffect::TestThumbnailEffect()
: active_window( NULL )
{
@ -34,7 +36,7 @@ void TestThumbnailEffect::paintScreen( int mask, QRegion region, ScreenPaintData
QRect region;
setPositionTransformations( data, region, active_window, thumbnailRect(), Qt::KeepAspectRatio );
effects->drawWindow( active_window,
Scene::PAINT_WINDOW_OPAQUE | Scene::PAINT_WINDOW_TRANSLUCENT | Scene::PAINT_WINDOW_TRANSFORMED,
PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED,
region, data );
}
}
@ -42,20 +44,20 @@ void TestThumbnailEffect::paintScreen( int mask, QRegion region, ScreenPaintData
void TestThumbnailEffect::windowActivated( EffectWindow* act )
{
active_window = act;
workspace()->addRepaint( thumbnailRect());
effects->addRepaint( thumbnailRect());
}
void TestThumbnailEffect::windowDamaged( EffectWindow* w, const QRect& )
{
if( w == active_window )
workspace()->addRepaint( thumbnailRect());
effects->addRepaint( thumbnailRect());
// TODO maybe just the relevant part of the area should be repainted?
}
void TestThumbnailEffect::windowGeometryShapeChanged( EffectWindow* w, const QRect& old )
{
if( w == active_window && w->size() != old.size())
workspace()->addRepaint( thumbnailRect());
effects->addRepaint( thumbnailRect());
}
void TestThumbnailEffect::windowClosed( EffectWindow* w )
@ -63,7 +65,7 @@ void TestThumbnailEffect::windowClosed( EffectWindow* w )
if( w == active_window )
{
active_window = NULL;
workspace()->addRepaint( thumbnailRect());
effects->addRepaint( thumbnailRect());
}
}

View file

@ -0,0 +1,4 @@
[Desktop Entry]
Encoding=UTF-8
Name=TestThumbnail
X-KDE-Library=kwin4_effect_tests

View file

@ -17,7 +17,7 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef KWIN_TEST_THUMBNAIL_H
#define KWIN_TEST_THUMBNAIL_H
#include <effects.h>
#include <kwineffects.h>
namespace KWin
{