diff --git a/autotests/fakeeffectplugin_version.cpp b/autotests/fakeeffectplugin_version.cpp index 3a38c6f871..8381f90bbe 100644 --- a/autotests/fakeeffectplugin_version.cpp +++ b/autotests/fakeeffectplugin_version.cpp @@ -24,7 +24,7 @@ public: class FakeEffectPluginFactory : public KWin::EffectPluginFactory { Q_OBJECT - Q_PLUGIN_METADATA(IID KPluginFactory_iid FILE "fakeeffectplugin_version.json") + Q_PLUGIN_METADATA(IID "not_a_valid_version" FILE "fakeeffectplugin_version.json") Q_INTERFACES(KPluginFactory) public: FakeEffectPluginFactory() {} @@ -33,7 +33,6 @@ public: return new KWin::FakeVersionEffect(); } }; -K_EXPORT_PLUGIN_VERSION(quint32(KWIN_EFFECT_API_VERSION) - 1) #include "fakeeffectplugin_version.moc" diff --git a/src/config-kwin.h.cmake b/src/config-kwin.h.cmake index d399e02c15..55f48caac5 100644 --- a/src/config-kwin.h.cmake +++ b/src/config-kwin.h.cmake @@ -1,6 +1,4 @@ -#define KWIN_VERSION_MAJOR ${PROJECT_VERSION_MAJOR} -#define KWIN_VERSION_MINOR ${PROJECT_VERSION_MINOR} -#define KWIN_VERSION_PATCH ${PROJECT_VERSION_PATCH} +#define KWIN_PLUGIN_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" #cmakedefine KWIN_BUILD_DECORATIONS 1 #cmakedefine KWIN_BUILD_TABBOX 1 diff --git a/src/effectloader.cpp b/src/effectloader.cpp index bc3185e37a..b9a4c4461a 100644 --- a/src/effectloader.cpp +++ b/src/effectloader.cpp @@ -12,6 +12,7 @@ #include #include #include "effects/effect_builtins.h" +#include "plugin.h" #include "scripting/scriptedeffect.h" #include "utils.h" // KDE @@ -345,8 +346,8 @@ EffectPluginFactory *PluginEffectLoader::factory(const KPluginMetaData &info) co return nullptr; } KPluginLoader loader(info.fileName()); - if (loader.pluginVersion() != KWIN_EFFECT_API_VERSION) { - qCDebug(KWIN_CORE) << info.pluginId() << " has not matching plugin version, expected " << KWIN_EFFECT_API_VERSION << "got " << loader.pluginVersion(); + if (loader.metaData().value("IID").toString() != EffectPluginFactory_iid) { + qCDebug(KWIN_CORE) << info.pluginId() << " has not matching plugin version, expected " << PluginFactory_iid << "got " << loader.metaData().value("IID"); return nullptr; } KPluginFactory *factory = loader.factory(); diff --git a/src/libkwineffects/kwinconfig.h.cmake b/src/libkwineffects/kwinconfig.h.cmake index e46ceb7a58..d457649472 100644 --- a/src/libkwineffects/kwinconfig.h.cmake +++ b/src/libkwineffects/kwinconfig.h.cmake @@ -9,6 +9,8 @@ #ifndef KWINCONFIG_H #define KWINCONFIG_H +#define KWIN_PLUGIN_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" + /* These should be primarily used to detect what kind of compositing diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index f471215271..2b7378d158 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -726,6 +726,8 @@ public: virtual KWin::Effect *createEffect() const = 0; }; +#define EffectPluginFactory_iid "org.kde.kwin.EffectPluginFactory" KWIN_PLUGIN_VERSION_STRING + /** * Defines an EffectPluginFactory sub class with customized isSupported and enabledByDefault methods. * @@ -733,10 +735,8 @@ public: * the simplified KWIN_EFFECT_FACTORY, KWIN_EFFECT_FACTORY_SUPPORTED or KWIN_EFFECT_FACTORY_ENABLED * macros which create an EffectPluginFactory with a useable default value. * - * The macro also adds a useable K_EXPORT_PLUGIN_VERSION to the definition. KWin will not load - * any Effect with a non-matching plugin version. This API is not providing binary compatibility - * and thus the effect plugin must be compiled against the same kwineffects library version as - * KWin. + * This API is not providing binary compatibility and thus the effect plugin must be compiled against + * the same kwineffects library version as KWin. * * @param factoryName The name to be used for the EffectPluginFactory * @param className The class name of the Effect sub class which is to be created by the factory @@ -748,7 +748,7 @@ public: class factoryName : public KWin::EffectPluginFactory \ { \ Q_OBJECT \ - Q_PLUGIN_METADATA(IID KPluginFactory_iid FILE jsonFile) \ + Q_PLUGIN_METADATA(IID EffectPluginFactory_iid FILE jsonFile) \ Q_INTERFACES(KPluginFactory) \ public: \ explicit factoryName() {} \ @@ -762,8 +762,7 @@ public: KWin::Effect *createEffect() const override { \ return new className(); \ } \ - }; \ - K_EXPORT_PLUGIN_VERSION(quint32(KWIN_EFFECT_API_VERSION)) + }; #define KWIN_EFFECT_FACTORY_ENABLED( factoryName, className, jsonFile, enabled ) \ KWIN_EFFECT_FACTORY_SUPPORTED_ENABLED( factoryName, className, jsonFile, return true;, enabled ) diff --git a/src/plugin.h b/src/plugin.h index 09a7891384..863bd02a92 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -15,11 +15,7 @@ namespace KWin { -#define KWIN_PLUGIN_API_VERSION QT_VERSION_CHECK(KWIN_VERSION_MAJOR, \ - KWIN_VERSION_MINOR, \ - KWIN_VERSION_PATCH) - -#define PluginFactory_iid "org.kde.kwin.PluginFactoryInterface" +#define PluginFactory_iid "org.kde.kwin.PluginFactoryInterface" KWIN_PLUGIN_VERSION_STRING /** * The Plugin class is the baseclass for all binary compositor extensions. diff --git a/src/pluginmanager.cpp b/src/pluginmanager.cpp index 3b7903779f..93710d0908 100644 --- a/src/pluginmanager.cpp +++ b/src/pluginmanager.cpp @@ -145,7 +145,7 @@ bool PluginManager::loadDynamicPlugin(const KPluginMetaData &metadata) const QString pluginId = metadata.pluginId(); KPluginLoader pluginLoader(metadata.fileName()); - if (pluginLoader.pluginVersion() != KWIN_PLUGIN_API_VERSION) { + if (pluginLoader.metaData().value("IID").toString() != PluginFactory_iid) { qCWarning(KWIN_CORE) << pluginId << "has mismatching plugin version"; return false; } diff --git a/src/plugins/colord-integration/main.cpp b/src/plugins/colord-integration/main.cpp index 07dad8f72d..df723b71b9 100644 --- a/src/plugins/colord-integration/main.cpp +++ b/src/plugins/colord-integration/main.cpp @@ -41,6 +41,4 @@ Plugin *ColordIntegrationFactory::create() const } } -K_EXPORT_PLUGIN_VERSION(KWIN_PLUGIN_API_VERSION) - #include "main.moc" diff --git a/src/plugins/krunner-integration/main.cpp b/src/plugins/krunner-integration/main.cpp index a189b02c01..f8ac11fe77 100644 --- a/src/plugins/krunner-integration/main.cpp +++ b/src/plugins/krunner-integration/main.cpp @@ -33,6 +33,4 @@ Plugin *KRunnerIntegrationFactory::create() const return new WindowsRunner(); } -K_EXPORT_PLUGIN_VERSION(KWIN_PLUGIN_API_VERSION) - #include "main.moc" diff --git a/src/plugins/nightcolor/main.cpp b/src/plugins/nightcolor/main.cpp index 0e69b3bac6..4b840973f0 100644 --- a/src/plugins/nightcolor/main.cpp +++ b/src/plugins/nightcolor/main.cpp @@ -32,6 +32,4 @@ Plugin *NightColorManagerFactory::create() const return new NightColorManager(); } -K_EXPORT_PLUGIN_VERSION(KWIN_PLUGIN_API_VERSION) - #include "main.moc" diff --git a/src/plugins/screencast/main.cpp b/src/plugins/screencast/main.cpp index 001c7718a1..99fdd702be 100644 --- a/src/plugins/screencast/main.cpp +++ b/src/plugins/screencast/main.cpp @@ -41,6 +41,4 @@ Plugin *ScreencastManagerFactory::create() const } } -K_EXPORT_PLUGIN_VERSION(KWIN_PLUGIN_API_VERSION) - #include "main.moc"