From 74e97a2c9b459b0dcd8d76f436f554e244386104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 11 Apr 2007 15:53:32 +0000 Subject: [PATCH] Convert to plugins. svn path=/branches/work/kwin_composite/; revision=652631 --- effects/CMakeLists.txt | 9 +++++++++ effects/test_input.cpp | 16 ++++++++++------ effects/test_input.desktop | 4 ++++ effects/test_input.h | 2 +- effects/test_thumbnail.cpp | 12 +++++++----- effects/test_thumbnail.desktop | 4 ++++ effects/test_thumbnail.h | 2 +- 7 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 effects/test_input.desktop create mode 100644 effects/test_thumbnail.desktop diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index de8f1707a1..2e048968a0 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -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) diff --git a/effects/test_input.cpp b/effects/test_input.cpp index 9cb99f81e0..4c6d1ca936 100644 --- a/effects/test_input.cpp +++ b/effects/test_input.cpp @@ -21,12 +21,16 @@ License. See the file "COPYING" for the exact licensing terms. #include "test_input.h" -#include -#include +#include + +#include +#include 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; } } diff --git a/effects/test_input.desktop b/effects/test_input.desktop new file mode 100644 index 0000000000..73a62977cc --- /dev/null +++ b/effects/test_input.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=TestInput +X-KDE-Library=kwin4_effect_tests diff --git a/effects/test_input.h b/effects/test_input.h index 355bf381c3..7f984bbbe7 100644 --- a/effects/test_input.h +++ b/effects/test_input.h @@ -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 +#include namespace KWin { diff --git a/effects/test_thumbnail.cpp b/effects/test_thumbnail.cpp index 40cb61f606..f3388a1418 100644 --- a/effects/test_thumbnail.cpp +++ b/effects/test_thumbnail.cpp @@ -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()); } } diff --git a/effects/test_thumbnail.desktop b/effects/test_thumbnail.desktop new file mode 100644 index 0000000000..311d5ee92d --- /dev/null +++ b/effects/test_thumbnail.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=TestThumbnail +X-KDE-Library=kwin4_effect_tests diff --git a/effects/test_thumbnail.h b/effects/test_thumbnail.h index 439a26201e..0028a6471f 100644 --- a/effects/test_thumbnail.h +++ b/effects/test_thumbnail.h @@ -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 +#include namespace KWin {