mirror of
https://invent.kde.org/network/krfb
synced 2024-07-01 07:24:29 +00:00
Encode supported platforms in the plugin metdata
This way we don't load pipewire on X, or xcb on Wayland regardless if they are configured as preferred or not.
This commit is contained in:
parent
e865b187a2
commit
953cc4218b
5
framebuffers/pipewire/pipewire.json
Normal file
5
framebuffers/pipewire/pipewire.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"X-KDE-OnlyShowOnQtPlatforms": [
|
||||
"wayland"
|
||||
]
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
#include "pw_framebuffer.h"
|
||||
#include <KPluginFactory>
|
||||
|
||||
K_PLUGIN_CLASS(PWFrameBufferPlugin)
|
||||
K_PLUGIN_CLASS_WITH_JSON(PWFrameBufferPlugin, "pipewire.json")
|
||||
|
||||
PWFrameBufferPlugin::PWFrameBufferPlugin(QObject *parent, const QVariantList &args)
|
||||
: FrameBufferPlugin(parent, args)
|
||||
|
|
6
framebuffers/qt/qt.json
Normal file
6
framebuffers/qt/qt.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"X-KDE-OnlyShowOnQtPlatforms": [
|
||||
"xcb"
|
||||
]
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <KPluginFactory>
|
||||
|
||||
K_PLUGIN_CLASS(QtFrameBufferPlugin)
|
||||
K_PLUGIN_CLASS_WITH_JSON(QtFrameBufferPlugin, "qt.json")
|
||||
|
||||
QtFrameBufferPlugin::QtFrameBufferPlugin(QObject *parent, const QVariantList &args)
|
||||
: FrameBufferPlugin(parent, args)
|
||||
|
|
6
framebuffers/xcb/xcb.json
Normal file
6
framebuffers/xcb/xcb.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"X-KDE-OnlyShowOnQtPlatforms": [
|
||||
"xcb"
|
||||
]
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
#include "xcb_framebuffer.h"
|
||||
#include <KPluginFactory>
|
||||
|
||||
K_PLUGIN_CLASS(XCBFrameBufferPlugin)
|
||||
K_PLUGIN_CLASS_WITH_JSON(XCBFrameBufferPlugin, "xcb.json")
|
||||
|
||||
XCBFrameBufferPlugin::XCBFrameBufferPlugin(QObject *parent, const QVariantList &args)
|
||||
: FrameBufferPlugin(parent, args)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "krfbconfig.h"
|
||||
#include "krfbdebug.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QGlobalStatic>
|
||||
|
||||
#include <KPluginFactory>
|
||||
|
@ -40,7 +41,10 @@ Q_GLOBAL_STATIC(FrameBufferManagerStatic, frameBufferManagerStatic)
|
|||
|
||||
FrameBufferManager::FrameBufferManager()
|
||||
{
|
||||
const QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("krfb/framebuffer"), {}, KPluginMetaData::AllowEmptyMetaData);
|
||||
const auto platformFilter = [] (const KPluginMetaData &pluginData) {
|
||||
return pluginData.value(QStringLiteral("X-KDE-OnlyShowOnQtPlatforms"), QStringList()).contains(QGuiApplication::platformName());
|
||||
};
|
||||
const QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("krfb/framebuffer"), platformFilter, KPluginMetaData::AllowEmptyMetaData);
|
||||
for (const KPluginMetaData &data : plugins) {
|
||||
const KPluginFactory::Result<FrameBufferPlugin> result = KPluginFactory::instantiatePlugin<FrameBufferPlugin>(data);
|
||||
if (result.plugin) {
|
||||
|
@ -76,7 +80,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVaria
|
|||
}
|
||||
}
|
||||
|
||||
if (auto preferredPlugin = m_plugins[ KrfbConfig::preferredFrameBufferPlugin() ]) {
|
||||
if (auto preferredPlugin = m_plugins.value(KrfbConfig::preferredFrameBufferPlugin())) {
|
||||
if (auto frameBuffer = QSharedPointer<FrameBuffer>(preferredPlugin->frameBuffer(args))) {
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
|
||||
|
|
Loading…
Reference in New Issue
Block a user