From 44b293211cefabfd5d110894d6a9197c7bdfb278 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Mon, 28 May 2007 11:23:00 +0000 Subject: [PATCH] Options now longer provides list of effects to be loaded. Instead, EffectsHandler itself loads the list of enabled effects (saved by the effects selector widget), also making use of their EnabledByDefault property, so if you haven't touched the config, you'll automatically get default effects. svn path=/trunk/KDE/kdebase/workspace/; revision=669036 --- effects.cpp | 19 +++++++++++++++++++ effects.h | 1 + lib/kwineffects.h | 1 + options.cpp | 3 --- options.h | 2 -- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/effects.cpp b/effects.cpp index a7b6f7025a..b883bf7e39 100644 --- a/effects.cpp +++ b/effects.cpp @@ -40,6 +40,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type) : EffectsHandler(type) , keyboard_grab_effect( NULL ) { + reconfigure(); } EffectsHandlerImpl::~EffectsHandlerImpl() @@ -52,6 +53,24 @@ EffectsHandlerImpl::~EffectsHandlerImpl() XDestroyWindow( display(), pos.second ); } +void EffectsHandlerImpl::reconfigure() + { + KSharedConfig::Ptr _config = KGlobal::config(); + KConfigGroup conf(_config, "Plugins"); + + KService::List offers = KServiceTypeTrader::self()->query("KWin/Effect"); + foreach( KService::Ptr service, offers ) + { + KPluginInfo plugininfo( service ); + plugininfo.load( &conf ); + + if( plugininfo.isPluginEnabled() ) + loadEffect( plugininfo.pluginName() ); + else + unloadEffect( plugininfo.pluginName() ); + } + } + // the idea is that effects call this function again which calls the next one void EffectsHandlerImpl::prePaintScreen( int* mask, QRegion* region, int time ) { diff --git a/effects.h b/effects.h index 155b67d8b4..9a39975486 100644 --- a/effects.h +++ b/effects.h @@ -84,6 +84,7 @@ class EffectsHandlerImpl : public EffectsHandler virtual void reserveElectricBorderSwitching( bool reserve ); virtual unsigned long xrenderBufferPicture(); + virtual void reconfigure(); // internal (used by kwin core or compositing code) void startPaint(); diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 4874cdbf73..164592f8ae 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -226,6 +226,7 @@ class KWIN_EXPORT EffectsHandler CompositingType compositingType() const { return compositing_type; } virtual unsigned long xrenderBufferPicture() = 0; + virtual void reconfigure() = 0; protected: diff --git a/options.cpp b/options.cpp index 375bffe4d3..7dcac9edfb 100644 --- a/options.cpp +++ b/options.cpp @@ -211,9 +211,6 @@ unsigned long Options::updateSettings() glAlwaysRebind = config.readEntry("GLAlwaysRebind", false ); glDirect = config.readEntry("GLDirect", true ); glVSync = config.readEntry("GLVSync", true ); - - config.changeGroup( "Effects" ); - defaultEffects = config.readEntry( "Load", QStringList() << "ShowFps" << "Fade" ); // Read button tooltip animation effect from kdeglobals // Since we want to allow users to enable window decoration tooltips diff --git a/options.h b/options.h index 80ce60299a..c4fac2cd52 100644 --- a/options.h +++ b/options.h @@ -319,8 +319,6 @@ class Options : public KDecorationOptions bool glDirect; bool glVSync; - QStringList defaultEffects; - private: WindowOperation OpTitlebarDblClick;