x11-wm/kwinft: drop Plasma 5.23 workaround after 12994bed8f

This commit is contained in:
Jan Beich 2022-02-08 17:35:31 +00:00
parent d187db4415
commit 38b03554e6

View file

@ -1,301 +0,0 @@
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