aboutsummaryrefslogtreecommitdiff
path: root/x11-wm/kwinft/files/patch-plasma-5.23
blob: ab82453a9d369dda19fdc8ce4d9b9a330b8c482f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
Revert until x11-wm/plasma5-kdecoration is updated to 5.24
https://gitlab.com/kwinft/kwinft/-/commit/0368384f4942
https://gitlab.com/kwinft/kwinft/-/commit/2d9277aa47f7
https://gitlab.com/kwinft/kwinft/-/commit/67fd993c8ba6

CMake Error at CMakeLists.txt:115 (find_package):
  Could not find a configuration file for package "KDecoration2" that is
  compatible with requested version "5.23.90".

  The following configuration files were considered but not accepted:

    /usr/local/lib/cmake/KDecoration2/KDecoration2Config.cmake, version: 5.23.5

--- CMakeLists.txt.orig	2022-02-03 10:38:21 UTC
+++ CMakeLists.txt
@@ -112,7 +112,7 @@ set_package_properties(KF5Kirigami2 PROPERTIES
     TYPE RUNTIME
 )
 
-find_package(KDecoration2 ${PROJECT_VERSION} CONFIG REQUIRED)
+find_package(KDecoration2 5.18.0 CONFIG REQUIRED)
 
 find_package(KScreenLocker CONFIG REQUIRED)
 set_package_properties(KScreenLocker PROPERTIES
--- kcmkwin/kwindecoration/decorationmodel.cpp.orig	2022-02-03 10:38:21 UTC
+++ kcmkwin/kwindecoration/decorationmodel.cpp
@@ -19,10 +19,10 @@
  */
 #include "decorationmodel.h"
 // KDecoration2
-#include <KDecoration2/Decoration>
 #include <KDecoration2/DecorationSettings>
-#include <KDecoration2/DecorationThemeProvider>
+#include <KDecoration2/Decoration>
 // KDE
+#include <KPluginLoader>
 #include <KPluginFactory>
 #include <KPluginMetaData>
 // Qt
@@ -55,18 +55,18 @@ QVariant DecorationsModel::data(const QModelIndex &ind
     if (!index.isValid() || index.column() != 0 || index.row() < 0 || index.row() >= int(m_plugins.size())) {
         return QVariant();
     }
-    const KDecoration2::DecorationThemeMetaData &d = m_plugins.at(index.row());
+    const Data &d = m_plugins.at(index.row());
     switch (role) {
     case Qt::DisplayRole:
-        return d.visibleName();
+        return d.visibleName;
     case PluginNameRole:
-        return d.pluginId();
+        return d.pluginName;
     case ThemeNameRole:
-        return d.themeName();
+        return d.themeName;
     case ConfigurationRole:
-        return d.hasConfiguration();
+        return d.configuration;
     case RecommendedBorderSizeRole:
-        return Utils::borderSizeToString(d.borderSize());
+        return Utils::borderSizeToString(d.recommendedBorderSize);
     }
     return QVariant();
 }
@@ -132,13 +132,17 @@ void DecorationsModel::init()
 {
     beginResetModel();
     m_plugins.clear();
-    const auto plugins = KPluginMetaData::findPlugins(s_pluginName);
+    const auto plugins = KPluginLoader::findPlugins(s_pluginName);
     for (const auto &info : plugins) {
-        QScopedPointer<KDecoration2::DecorationThemeProvider> themeFinder(
-            KPluginFactory::instantiatePlugin<KDecoration2::DecorationThemeProvider>(info).plugin);
-        KDecoration2::DecorationThemeMetaData data;
-        const auto decoSettingsMap = info.rawData().value("org.kde.kdecoration2").toObject().toVariantMap();
-        if (themeFinder) {
+        KPluginLoader loader(info.fileName());
+        KPluginFactory *factory = loader.factory();
+        if (!factory) {
+            continue;
+        }
+        auto metadata = loader.metaData().value(QStringLiteral("MetaData")).toObject().value(s_pluginName);
+        Data data;
+        if (!metadata.isUndefined()) {
+            const auto decoSettingsMap = metadata.toObject().toVariantMap();
             const QString &kns = findKNewStuff(decoSettingsMap);
             if (!kns.isEmpty() && !m_knsProviders.contains(kns)) {
                 m_knsProviders.append(kns);
@@ -149,20 +153,35 @@ void DecorationsModel::init()
                     // We cannot list the themes
                     continue;
                 }
-                const auto themesList = themeFinder->themes();
-                for (const KDecoration2::DecorationThemeMetaData &data : themesList) {
-                    m_plugins.emplace_back(data);
+                QScopedPointer<QObject> themeFinder(factory->create<QObject>(keyword));
+                if (themeFinder.isNull()) {
+                    continue;
                 }
+                QVariant themes = themeFinder->property("themes");
+                if (!themes.isValid()) {
+                    continue;
+                }
+                const auto themesMap = themes.toMap();
+                for (auto it = themesMap.begin(); it != themesMap.end(); ++it) {
+                    Data d;
+                    d.pluginName = info.pluginId();
+                    d.themeName = it.value().toString();
+                    d.visibleName = it.key();
+                    QMetaObject::invokeMethod(themeFinder.data(), "hasConfiguration",
+                                              Q_RETURN_ARG(bool, d.configuration),
+                                              Q_ARG(QString, d.themeName));
+                    m_plugins.emplace_back(std::move(d));
+                }
 
                 // it's a theme engine, we don't want to show this entry
                 continue;
             }
+            data.configuration = isConfigureable(decoSettingsMap);
+            data.recommendedBorderSize = recommendedBorderSize(decoSettingsMap);
         }
-        data.setHasConfiguration(isConfigureable(decoSettingsMap));
-        data.setBorderSize(recommendedBorderSize(decoSettingsMap));
-        data.setVisibleName(info.name().isEmpty() ? info.pluginId() : info.name());
-        data.setPluginId(info.pluginId());
-        data.setThemeName(data.visibleName());
+        data.pluginName = info.pluginId();
+        data.visibleName = info.name().isEmpty() ? info.pluginId() : info.name();
+        data.themeName = data.visibleName;
 
         m_plugins.emplace_back(std::move(data));
     }
@@ -171,9 +190,11 @@ void DecorationsModel::init()
 
 QModelIndex DecorationsModel::findDecoration(const QString &pluginName, const QString &themeName) const
 {
-    auto it = std::find_if(m_plugins.cbegin(), m_plugins.cend(), [pluginName, themeName](const KDecoration2::DecorationThemeMetaData &d) {
-        return d.pluginId() == pluginName && d.themeName() == themeName;
-    });
+    auto it = std::find_if(m_plugins.cbegin(), m_plugins.cend(),
+        [pluginName, themeName](const Data &d) {
+            return d.pluginName == pluginName && d.themeName == themeName;
+        }
+    );
     if (it == m_plugins.cend()) {
         return QModelIndex();
     }
--- kcmkwin/kwindecoration/decorationmodel.h.orig	2022-02-03 10:38:21 UTC
+++ kcmkwin/kwindecoration/decorationmodel.h
@@ -22,7 +22,6 @@
 
 #include "utils.h"
 
-#include <KDecoration2/DecorationThemeProvider>
 #include <QAbstractListModel>
 
 namespace KDecoration2
@@ -60,7 +59,14 @@ public Q_SLOTS:
     void init();
 
 private:
-    std::vector<KDecoration2::DecorationThemeMetaData> m_plugins;
+    struct Data {
+        QString pluginName;
+        QString themeName;
+        QString visibleName;
+        bool configuration = false;
+        KDecoration2::BorderSize recommendedBorderSize = KDecoration2::BorderSize::Normal;
+    };
+    std::vector<Data> m_plugins;
     QStringList m_knsProviders;
 };
 
--- plugins/kdecorations/aurorae/src/aurorae.cpp.orig	2022-02-03 10:38:21 UTC
+++ plugins/kdecorations/aurorae/src/aurorae.cpp
@@ -60,11 +60,10 @@ along with this program.  If not, see <http://www.gnu.
 K_PLUGIN_FACTORY_WITH_JSON(AuroraeDecoFactory,
                            "aurorae.json",
                            registerPlugin<Aurorae::Decoration>();
-                           registerPlugin<Aurorae::ThemeProvider>();
-                           registerPlugin<Aurorae::ConfigurationModule>();
+                           registerPlugin<Aurorae::ThemeFinder>(QStringLiteral("themes"));
+                           registerPlugin<Aurorae::ConfigurationModule>(QStringLiteral("kcmodule"));
                           )
 
-
 namespace Aurorae
 {
 
@@ -610,33 +609,28 @@ KDecoration2::DecoratedClient *Decoration::clientPoint
     return client().data();
 }
 
-ThemeProvider::ThemeProvider(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
-    : KDecoration2::DecorationThemeProvider(parent, data, args)
-    , m_data(data)
+ThemeFinder::ThemeFinder(QObject *parent, const QVariantList &args)
+    : QObject(parent)
 {
+    Q_UNUSED(args)
     init();
 }
 
-void ThemeProvider::init()
+void ThemeFinder::init()
 {
     findAllQmlThemes();
     findAllSvgThemes();
 }
 
-void ThemeProvider::findAllQmlThemes()
+void ThemeFinder::findAllQmlThemes()
 {
     const auto offers = KPackage::PackageLoader::self()->findPackages(QStringLiteral("KWin/Decoration"), s_qmlPackageFolder);
     for (const auto &offer : offers) {
-        KDecoration2::DecorationThemeMetaData data;
-        data.setPluginId(m_data.pluginId());
-        data.setThemeName(offer.pluginId());
-        data.setVisibleName(offer.name());
-        data.setHasConfiguration(hasConfiguration(offer.pluginId()));
-        m_themes.append(data);
+        m_themes.insert(offer.name(), offer.pluginId());
     }
 }
 
-void ThemeProvider::findAllSvgThemes()
+void ThemeFinder::findAllSvgThemes()
 {
     QStringList themes;
     const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("aurorae/themes/"), QStandardPaths::LocateDirectory);
@@ -664,19 +658,14 @@ void ThemeProvider::findAllSvgThemes()
             name = packageName;
         }
 
-        KDecoration2::DecorationThemeMetaData data;
-        data.setPluginId(m_data.pluginId());
-        data.setThemeName(QLatin1String("__aurorae__svg__") + packageName);
-        data.setVisibleName(name);
-        data.setHasConfiguration(hasConfiguration(data.themeName()));
-        m_themes.append(data);
+        m_themes.insert(name, QString(QLatin1String("__aurorae__svg__") + packageName));
     }
 }
 
 static const QString s_configUiPath = QStringLiteral("kwin/decorations/%1/contents/ui/config.ui");
 static const QString s_configXmlPath = QStringLiteral("kwin/decorations/%1/contents/config/main.xml");
 
-bool ThemeProvider::hasConfiguration(const QString &theme)
+bool ThemeFinder::hasConfiguration(const QString &theme) const
 {
     if (theme.startsWith(QLatin1String("__aurorae__svg__"))) {
         return true;
--- plugins/kdecorations/aurorae/src/aurorae.h.orig	2022-02-03 10:38:21 UTC
+++ plugins/kdecorations/aurorae/src/aurorae.h
@@ -18,12 +18,10 @@ along with this program.  If not, see <http://www.gnu.
 #ifndef AURORAE_H
 #define AURORAE_H
 
-#include <KCModule>
 #include <KDecoration2/Decoration>
-#include <KDecoration2/DecorationThemeProvider>
-#include <KPluginMetaData>
 #include <QElapsedTimer>
 #include <QVariant>
+#include <KCModule>
 
 class QQmlComponent;
 class QQmlContext;
@@ -91,24 +89,25 @@ Q_SIGNALS: (private)
     QElapsedTimer m_doubleClickTimer;
 };
 
-class ThemeProvider : public KDecoration2::DecorationThemeProvider
+class ThemeFinder : public QObject
 {
     Q_OBJECT
+    Q_PROPERTY(QVariantMap themes READ themes)
 public:
-    explicit ThemeProvider(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
+    explicit ThemeFinder(QObject *parent = nullptr, const QVariantList &args = QVariantList());
 
-    QList<KDecoration2::DecorationThemeMetaData> themes() const override
-    {
+    QVariantMap themes() const {
         return m_themes;
     }
 
+public Q_SLOTS:
+    bool hasConfiguration(const QString &theme) const;
+
 private:
     void init();
     void findAllQmlThemes();
     void findAllSvgThemes();
-    bool hasConfiguration(const QString &theme);
-    QList<KDecoration2::DecorationThemeMetaData> m_themes;
-    const KPluginMetaData m_data;
+    QVariantMap m_themes;
 };
 
 class ConfigurationModule : public KCModule