diff --git a/composite.cpp b/composite.cpp index 7e48066a50..c2ad976ace 100644 --- a/composite.cpp +++ b/composite.cpp @@ -556,6 +556,28 @@ bool Workspace::openGLIsBroken() const return CompositingPrefs::openGlIsBroken(); } +QString Workspace::compositingType() +{ + // the returned strings are considered as identifiers and may not be translated + if (!effects) { + return "none"; + } + if (effects->compositingType() == XRenderCompositing) { + return "xrender"; + } else if (effects->compositingType() == OpenGLCompositing) { +#ifdef KWIN_HAVE_OPENGLES + return "gles"; +#else + if (ShaderManager::instance()->isValid()) { + return "gl2"; + } else { + return "gl1"; + } +#endif + } + return "none"; +} + //**************************************** // Toplevel //**************************************** diff --git a/effects/blur/blur.desktop b/effects/blur/blur.desktop index db8940b114..6332582763 100644 --- a/effects/blur/blur.desktop +++ b/effects/blur/blur.desktop @@ -165,4 +165,5 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=75 - +X-KWin-Requires-OpenGL=true +X-KWin-Requires-Shaders=true diff --git a/effects/coverswitch/coverswitch.desktop b/effects/coverswitch/coverswitch.desktop index 3f49bbb722..ba906dfdcc 100644 --- a/effects/coverswitch/coverswitch.desktop +++ b/effects/coverswitch/coverswitch.desktop @@ -149,3 +149,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=50 +X-KWin-Requires-OpenGL=true diff --git a/effects/cube/cube.desktop b/effects/cube/cube.desktop index c9304d72a6..d7f2998597 100644 --- a/effects/cube/cube.desktop +++ b/effects/cube/cube.desktop @@ -163,3 +163,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=50 +X-KWin-Requires-OpenGL=true diff --git a/effects/cube/cubeslide.desktop b/effects/cube/cubeslide.desktop index 2967b7c9c7..133c1d83f2 100644 --- a/effects/cube/cubeslide.desktop +++ b/effects/cube/cubeslide.desktop @@ -143,3 +143,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=50 +X-KWin-Requires-OpenGL=true diff --git a/effects/explosion/explosion.desktop b/effects/explosion/explosion.desktop index ed36e2454a..d4156228f3 100644 --- a/effects/explosion/explosion.desktop +++ b/effects/explosion/explosion.desktop @@ -162,3 +162,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=70 +X-KWin-Requires-OpenGL2=true diff --git a/effects/flipswitch/flipswitch.desktop b/effects/flipswitch/flipswitch.desktop index 2aba28aec9..48a81da609 100644 --- a/effects/flipswitch/flipswitch.desktop +++ b/effects/flipswitch/flipswitch.desktop @@ -145,3 +145,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=50 +X-KWin-Requires-OpenGL=true diff --git a/effects/glide/glide.desktop b/effects/glide/glide.desktop index 28e7ad15fd..0bc2ead207 100644 --- a/effects/glide/glide.desktop +++ b/effects/glide/glide.desktop @@ -130,3 +130,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=50 +X-KWin-Requires-OpenGL=true diff --git a/effects/invert/invert.desktop b/effects/invert/invert.desktop index d4a2457d9f..40f7895d02 100644 --- a/effects/invert/invert.desktop +++ b/effects/invert/invert.desktop @@ -162,3 +162,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins +X-KWin-Requires-OpenGL2=true diff --git a/effects/kwineffect.desktop b/effects/kwineffect.desktop index 760f6d6a4b..721801092a 100644 --- a/effects/kwineffect.desktop +++ b/effects/kwineffect.desktop @@ -88,3 +88,12 @@ Comment[zh_TW]=KWin 效果 [PropertyDef::X-KDE-Ordering] Type=int + +[PropertyDef::X-KWin-Requires-OpenGL] +Type=bool + +[PropertyDef::X-KWin-Requires-OpenGL2] +Type=bool + +[PropertyDef::X-KWin-Requires-Shaders] +Type=bool diff --git a/effects/lookingglass/lookingglass.desktop b/effects/lookingglass/lookingglass.desktop index e46e51e867..5d6d83b65f 100644 --- a/effects/lookingglass/lookingglass.desktop +++ b/effects/lookingglass/lookingglass.desktop @@ -155,3 +155,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins +X-KWin-Requires-OpenGL2=true diff --git a/effects/magiclamp/magiclamp.desktop b/effects/magiclamp/magiclamp.desktop index 5c1705e985..9e37d67d0a 100644 --- a/effects/magiclamp/magiclamp.desktop +++ b/effects/magiclamp/magiclamp.desktop @@ -155,3 +155,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=50 +X-KWin-Requires-OpenGL=true diff --git a/effects/sheet/sheet.desktop b/effects/sheet/sheet.desktop index 3400fdfb1b..3d55edb81b 100644 --- a/effects/sheet/sheet.desktop +++ b/effects/sheet/sheet.desktop @@ -144,3 +144,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=60 +X-KWin-Requires-OpenGL=true diff --git a/effects/startupfeedback/startupfeedback.desktop b/effects/startupfeedback/startupfeedback.desktop index c5bf017055..bf6f46d0cf 100644 --- a/effects/startupfeedback/startupfeedback.desktop +++ b/effects/startupfeedback/startupfeedback.desktop @@ -118,3 +118,4 @@ X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-EnabledByDefault=true X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=90 +X-KWin-Requires-OpenGL=true diff --git a/effects/wobblywindows/wobblywindows.desktop b/effects/wobblywindows/wobblywindows.desktop index 1d03ed71ac..b66afce7ff 100644 --- a/effects/wobblywindows/wobblywindows.desktop +++ b/effects/wobblywindows/wobblywindows.desktop @@ -156,3 +156,4 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=false X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=45 +X-KWin-Requires-OpenGL=true diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 90655ad259..caf9b0a248 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -79,6 +79,8 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList : KCModule(KWinCompositingConfigFactory::componentData(), parent) , mKWinConfig(KSharedConfig::openConfig("kwinrc")) , m_showConfirmDialog(false) + , m_showDetailedErrors(new QAction(i18nc("Action to open a dialog showing detailed information why an effect could not be loaded", + "Details"), this)) { KGlobal::locale()->insertCatalog("kwin_effects"); ui.setupUi(this); @@ -86,6 +88,9 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList ui.tabWidget->setCurrentIndex(0); ui.statusTitleWidget->hide(); ui.rearmGlSupport->hide(); + ui.messageBox->setVisible(false); + ui.messageBox->addAction(m_showDetailedErrors); + ui.messageBox->setMessageType(KMessageWidget::Warning); // For future use (void) I18N_NOOP("Use GLSL shaders"); @@ -124,6 +129,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.glShaders, SIGNAL(toggled(bool)), this, SLOT(changed())); + connect(m_showDetailedErrors, SIGNAL(triggered(bool)), SLOT(showDetailedEffectLoadingInformation())); // Open the temporary config file // Temporary conf file is used to synchronize effect checkboxes with effect @@ -584,14 +590,15 @@ void KWinCompositingConfig::checkLoadedEffects() { // check for effects not supported by Backend or hardware // such effects are enabled but not returned by DBus method loadedEffects - QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kwin", "/KWin", "org.kde.KWin", "loadedEffects"); - QDBusMessage reply = QDBusConnection::sessionBus().call(message); + OrgKdeKWinInterface kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus()); KConfigGroup effectConfig = KConfigGroup(mKWinConfig, "Compositing"); bool enabledAfter = effectConfig.readEntry("Enabled", true); - if (reply.type() == QDBusMessage::ReplyMessage && enabledAfter && !getenv("KDE_FAILSAFE")) { + QDBusPendingReply< QStringList > reply = kwin.loadedEffects(); + + if (!reply.isError() && enabledAfter && !getenv("KDE_FAILSAFE")) { effectConfig = KConfigGroup(mKWinConfig, "Plugins"); - QStringList loadedEffects = reply.arguments()[0].toStringList(); + QStringList loadedEffects = reply.value(); QStringList effects = effectConfig.keyList(); QStringList disabledEffects = QStringList(); foreach (QString effect, effects) { // krazy:exclude=foreach @@ -602,25 +609,108 @@ void KWinCompositingConfig::checkLoadedEffects() } } if (!disabledEffects.isEmpty()) { - KServiceTypeTrader* trader = KServiceTypeTrader::self(); - KService::List services; - QString message = i18n("The following desktop effects could not be activated:"); - message.append("