diff --git a/composite.cpp b/composite.cpp index b60dc0497f..0bc7af274b 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" #include "scene.h" #include "scene_basic.h" #include "scene_xrender.h" @@ -36,6 +37,7 @@ void Workspace::setupCompositing() XCompositeRedirectSubwindows( display(), rootWindow(), CompositeRedirectManual ); // scene = new SceneBasic( this ); scene = new SceneXrender( this ); + effects = new EffectsHandler( this ); addDamage( 0, 0, displayWidth(), displayHeight()); foreach( Client* c, clients ) c->setupCompositing(); @@ -53,6 +55,8 @@ void Workspace::finishCompositing() c->finishCompositing(); XCompositeUnredirectSubwindows( display(), rootWindow(), CompositeRedirectManual ); compositeTimer.stop(); + delete effects; + effects = NULL; delete scene; scene = NULL; for( ClientList::ConstIterator it = clients.begin(); diff --git a/effects.cpp b/effects.cpp index 5cfa4b5bdb..935d3ad8b0 100644 --- a/effects.cpp +++ b/effects.cpp @@ -273,11 +273,25 @@ static ShiftWorkspaceUp* swu; EffectsHandler::EffectsHandler( Workspace* ws ) { + if( !compositing()) + return; mht = new MakeHalfTransparent; sm = new ShakyMove; // gm = new GrowMove; swu = new ShiftWorkspaceUp( ws ); } + +EffectsHandler::~EffectsHandler() + { + delete mht; + mht = NULL; + delete sm; + sm = NULL; + delete gm; + gm = NULL; + delete swu; + swu = NULL; + } void EffectsHandler::windowUserMovedResized( Toplevel* c, bool first, bool last ) { diff --git a/effects.h b/effects.h index 1951b37617..425c8633fb 100644 --- a/effects.h +++ b/effects.h @@ -80,6 +80,7 @@ class EffectsHandler { public: EffectsHandler( Workspace* ws ); + ~EffectsHandler(); void windowUserMovedResized( Toplevel* c, bool first, bool last ); void windowDeleted( Toplevel* c ); void transformWindow( Toplevel* c, Matrix& m, EffectData& data ); diff --git a/main.cpp b/main.cpp index 9fff11ceb4..2ee0688fc1 100644 --- a/main.cpp +++ b/main.cpp @@ -122,9 +122,7 @@ Application::Application( ) initting = false; // TODO // create workspace. - Workspace* workspace = new Workspace( isSessionRestored() ); - - effects = new EffectsHandler( workspace ); + (void) new Workspace( isSessionRestored() ); syncX(); // trigger possible errors, there's still a chance to abort