From 4f12c1e60620ac4a1c1d734b40908212508103cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 4 Jul 2006 20:51:01 +0000 Subject: [PATCH] Some first attempt at effects interface. svn path=/branches/work/kwin_composite/; revision=558191 --- CMakeLists.txt | 3 ++- composite.cpp | 10 ++++++++ effects.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ effects.h | 43 ++++++++++++++++++++++++++++++++++ geometry.cpp | 6 ++++- main.cpp | 4 ++++ 6 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 effects.cpp create mode 100644 effects.h diff --git a/CMakeLists.txt b/CMakeLists.txt index dc90a31350..72970c3e60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,8 @@ set(kwin_KDEINIT_SRCS rules.cpp composite.cpp toplevel.cpp - unmanaged.cpp ) + unmanaged.cpp + effects.cpp ) kde4_automoc(${kwin_KDEINIT_SRCS}) diff --git a/composite.cpp b/composite.cpp index bc0f40e45d..9183663b02 100644 --- a/composite.cpp +++ b/composite.cpp @@ -12,6 +12,7 @@ License. See the file "COPYING" for the exact licensing terms. #include "workspace.h" #include "client.h" #include "unmanaged.h" +#include "effects.h" namespace KWinInternal { @@ -63,21 +64,30 @@ void Workspace::compositeTimeout() it != stackingOrder().end(); ++it ) { +#if 1 + (*it)->windowPixmap(); // trigger creation + effects->paintWindow( *it ); +#else QRect r = (*it)->geometry().intersect( QRect( 0, 0, displayWidth(), displayHeight())); if( !r.isEmpty()) { XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc, qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y()); } +#endif } for( UnmanagedList::ConstIterator it = unmanaged.begin(); it != unmanaged.end(); ++it ) { +#if 1 + effects->paintWorkspace( this ); +#else QRect r = (*it)->geometry().intersect( QRect( 0, 0, displayWidth(), displayHeight())); if( !r.isEmpty()) XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc, qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y()); +#endif } XCopyArea( display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0 ); XFreeGC( display(), gc ); diff --git a/effects.cpp b/effects.cpp new file mode 100644 index 0000000000..09cf356c77 --- /dev/null +++ b/effects.cpp @@ -0,0 +1,62 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2006 Lubos Lunak + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#include "effects.h" + +namespace KWinInternal +{ + +//**************************************** +// Effect +//**************************************** + +Effect::~Effect() + { + } + +void Effect::windowUserMoved( Toplevel* ) + { + } + +void Effect::windowUserResized( Toplevel* ) + { + } + +void Effect::paintWindow( Toplevel* ) + { + } + +void Effect::paintWorkspace( Workspace* ) + { + } + +//**************************************** +// EffectsHandler +//**************************************** + +void EffectsHandler::windowUserMoved( Toplevel* c ) + { + } + +void EffectsHandler::windowUserResized( Toplevel* c ) + { + } + +void EffectsHandler::paintWindow( Toplevel* c ) + { + } + +void EffectsHandler::paintWorkspace( Workspace* ) + { + } + +EffectsHandler* effects; + +} // namespace diff --git a/effects.h b/effects.h new file mode 100644 index 0000000000..7a0118c1c1 --- /dev/null +++ b/effects.h @@ -0,0 +1,43 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2006 Lubos Lunak + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#ifndef KWIN_EFFECTS_H +#define KWIN_EFFECTS_H + +namespace KWinInternal +{ + +class Toplevel; +class Workspace; + +class Effect + { + public: + virtual ~Effect(); + virtual void windowUserMoved( Toplevel* c ); + virtual void windowUserResized( Toplevel* c ); + virtual void paintWindow( Toplevel* c ); + virtual void paintWorkspace( Workspace* ); + }; + +class EffectsHandler + { + public: + void windowUserMoved( Toplevel* c ); + void windowUserResized( Toplevel* c ); + void paintWindow( Toplevel* c ); + void paintWorkspace( Workspace* ); + }; + +extern EffectsHandler* effects; + +} // namespace + +#endif diff --git a/geometry.cpp b/geometry.cpp index 6c4f545017..d95b6c3859 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -28,6 +28,7 @@ License. See the file "COPYING" for the exact licensing terms. #include "notifications.h" #include "geometrytip.h" #include "rules.h" +#include "effects.h" #include #include @@ -2549,7 +2550,10 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root ) } if ( isMove() ) workspace()->clientMoved(globalPos, xTime()); + if( isMove()) + effects->windowUserMoved( this ); + else + effects->windowUserResized( this ); } - } // namespace diff --git a/main.cpp b/main.cpp index 10be863581..538c062ba0 100644 --- a/main.cpp +++ b/main.cpp @@ -30,6 +30,7 @@ License. See the file "COPYING" for the exact licensing terms. #include "options.h" #include "sm.h" #include "utils.h" +#include "effects.h" #define INT8 _X11INT8 #define INT32 _X11INT32 @@ -117,6 +118,7 @@ Application::Application( ) options = new Options; atoms = new Atoms; + effects = new EffectsHandler; // create workspace. (void) new Workspace( isSessionRestored() ); @@ -143,6 +145,8 @@ Application::~Application() if( owner.ownerWindow() != None ) // if there was no --replace (no new WM) XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() ); delete options; + delete effects; + delete atoms; } void Application::lostSelection()