From 5646313c2c98bf9d064c1be62b5d4166876400e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 7 Apr 2016 14:25:42 +0200 Subject: [PATCH] Add an explicit dependency to Breeze to find decoration plugin Summary: KWin needs the plugin id of the breeze decoration plugin. Instead of hard coding that it's now resolved through an optional dependency. If the optional dependency is not available, the default is adjusted to aurorae/plastik. Reviewers: #plasma Subscribers: plasma-devel Projects: #plasma Differential Revision: https://phabricator.kde.org/D1344 --- CMakeLists.txt | 15 +++++++++++++++ config-kwin.h.cmake | 4 ++++ decorations/decorationbridge.cpp | 10 ++++++++-- kcmkwin/kwindecoration/kcm.cpp | 11 +++++++++-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00d086e5cd..d24dbe0f62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,21 @@ set_package_properties(KScreenLocker PROPERTIES TYPE REQUIRED PURPOSE "For screenlocker integration in kwin_wayland") +find_package(Breeze ${PROJECT_VERSION} CONFIG) +set_package_properties(Breeze PROPERTIES + TYPE OPTIONAL + PURPOSE "For setting the default window decoration plugin") +if(${Breeze_FOUND}) + if(${BREEZE_WITH_KDECORATION}) + set(HAVE_BREEZE_DECO true) + else() + set(HAVE_BREEZE_DECO FALSE) + endif() +else() + set(HAVE_BREEZE_DECO FALSE) +endif() +add_feature_info("Breeze-Decoration" HAVE_BREEZE_DECO "Default decoration plugin Breeze") + find_package(EGL) set_package_properties(EGL PROPERTIES TYPE RUNTIME diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake index 0996173d89..c7d741795e 100644 --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -17,6 +17,10 @@ #cmakedefine01 HAVE_WAYLAND_EGL #cmakedefine01 HAVE_SYS_PRCTL_H #cmakedefine01 HAVE_PR_SET_DUMPABLE +#cmakedefine01 HAVE_BREEZE_DECO +#if HAVE_BREEZE_DECO +#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}" +#endif /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H 1 diff --git a/decorations/decorationbridge.cpp b/decorations/decorationbridge.cpp index e4762dec05..5afdbdfbf4 100644 --- a/decorations/decorationbridge.cpp +++ b/decorations/decorationbridge.cpp @@ -28,6 +28,7 @@ along with this program. If not, see . #include "scene.h" #include "wayland_server.h" #include "workspace.h" +#include // KDecoration #include @@ -50,8 +51,13 @@ namespace KWin namespace Decoration { +static const QString s_aurorae = QStringLiteral("org.kde.kwin.aurorae"); static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2"); -static const QString s_defaultPlugin = QStringLiteral("org.kde.breeze"); +#if HAVE_BREEZE_DECO +static const QString s_defaultPlugin = QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID); +#else +static const QString s_defaultPlugin = s_aurorae; +#endif KWIN_SINGLETON_FACTORY(DecorationBridge) @@ -105,7 +111,7 @@ void DecorationBridge::init() } // default plugin failed to load, try fallback if (!m_factory) { - m_plugin = QStringLiteral("org.kde.kwin.aurorae"); + m_plugin = s_aurorae; initPlugin(); } } diff --git a/kcmkwin/kwindecoration/kcm.cpp b/kcmkwin/kwindecoration/kcm.cpp index fefdbe3468..035bc8b2aa 100644 --- a/kcmkwin/kwindecoration/kcm.cpp +++ b/kcmkwin/kwindecoration/kcm.cpp @@ -20,6 +20,7 @@ #include "kcm.h" #include "decorationmodel.h" #include "declarative-plugin/buttonsmodel.h" +#include // KDE #include @@ -53,7 +54,13 @@ namespace KDecoration2 namespace Configuration { static const QString s_pluginName = QStringLiteral("org.kde.kdecoration2"); -static const QString s_defaultPlugin = QStringLiteral("org.kde.breeze"); +#if HAVE_BREEZE_DECO +static const QString s_defaultPlugin = QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID); +static const QString s_defaultTheme; +#else +static const QString s_defaultPlugin = QStringLiteral("org.kde.kwin.aurorae"); +static const QString s_defaultTheme = QStringLiteral("kwin4_decoration_qml_plastik"); +#endif static const QString s_borderSizeNormal = QStringLiteral("Normal"); static const QString s_ghnsIcon = QStringLiteral("get-hot-new-stuff"); @@ -294,7 +301,7 @@ void ConfigurationModule::load() s_loading = true; const KConfigGroup config = KSharedConfig::openConfig("kwinrc")->group(s_pluginName); const QString plugin = config.readEntry("library", s_defaultPlugin); - const QString theme = config.readEntry("theme", QString()); + const QString theme = config.readEntry("theme", s_defaultTheme); const QModelIndex index = m_proxyModel->mapFromSource(m_model->findDecoration(plugin, theme)); if (auto listView = m_quickView->rootObject()->findChild("listView")) { listView->setProperty("currentIndex", index.isValid() ? index.row() : -1);