From 8ed4c44539323e1132908fe63adcfdb49724d93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 1 Apr 2009 16:24:40 +0000 Subject: [PATCH] Send notification about effects that could not be activated because they are not supported by hardware or compositing backend. FEATURE: 168841 svn path=/trunk/KDE/kdebase/workspace/; revision=947920 --- kcmkwin/kwincompositing/main.cpp | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 3f6b976d8c..4ccc604144 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -33,6 +33,7 @@ along with this program. If not, see . #include #include #include +#include #include #include @@ -611,6 +612,45 @@ void KWinCompositingConfig::configChanged(bool reinitCompositing) effectConfig = KConfigGroup( mKWinConfig, "Plugins" ); bool shadowAfter = effectEnabled( "shadow", effectConfig ); + // check for effects not supported by Backend or hardware + // such effects are enabled but not returned by DBus method loadedEffects + message = QDBusMessage::createMethodCall( "org.kde.kwin", "/KWin", "org.kde.KWin", "loadedEffects" ); + QDBusMessage reply = QDBusConnection::sessionBus().call( message ); + if( reply.type() == QDBusMessage::ReplyMessage ) + { + QStringList loadedEffects = reply.arguments()[0].toStringList(); + QStringList effects = effectConfig.keyList(); + QStringList disabledEffects = QStringList(); + foreach( QString effect, effects ) + { + QString temp = effect.mid( 13, effect.length() - 13 - 7 ); + effect.truncate( effect.length() - 7 ); + if( effectEnabled( temp, effectConfig ) && !loadedEffects.contains( effect ) ) + { + disabledEffects << effect; + } + } + if( !disabledEffects.isEmpty() ) + { + KServiceTypeTrader* trader = KServiceTypeTrader::self(); + KService::List services; + QString message = i18n( "The following effects could not be activated:" ); + message.append( "
    " ); + foreach( QString effect, disabledEffects ) + { + services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == '" + effect + "'"); + message.append( "
  • " ); + if( !services.isEmpty() ) + message.append( services.first()->name() ); + else + message.append( effect); + message.append( "
  • " ); + } + message.append( "
" ); + KNotification::event( KNotification::Notification, message ); + } + } + if( enabledBefore != enabledAfter || shadowBefore != shadowAfter ) { message = QDBusMessage::createMethodCall( "org.kde.kwin", "/KWin", "org.kde.KWin", "reconfigure" );