diff --git a/CMakeLists.txt b/CMakeLists.txt index bafacdbd..01b66031 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Notifications Wallet WidgetsAddons + WindowSystem XmlGui ) diff --git a/krfb/CMakeLists.txt b/krfb/CMakeLists.txt index 1041c97d..a2922264 100644 --- a/krfb/CMakeLists.txt +++ b/krfb/CMakeLists.txt @@ -101,6 +101,7 @@ target_link_libraries (krfb KF5::Notifications KF5::Wallet KF5::WidgetsAddons + KF5::WindowSystem KF5::XmlGui ${LIBVNCSERVER_LIBRARIES} ) diff --git a/krfb/main.cpp b/krfb/main.cpp index a30123f6..fd778a71 100644 --- a/krfb/main.cpp +++ b/krfb/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -69,6 +70,22 @@ static void checkOldX11PluginConfig() { } } +static void checkWaylandPluginConfig() +{ + if (KrfbConfig::preferredFrameBufferPlugin() != QStringLiteral("pw")) { + qWarning() << "Wayland: Detected invalid configuration: " + "preferredFrameBufferPlugin is not pipewire: " + << KrfbConfig::preferredFrameBufferPlugin(); + KConfigSkeletonItem *config_item = KrfbConfig::self()->findItem( + QStringLiteral("preferredFrameBufferPlugin")); + if (config_item) { + config_item->setProperty(QStringLiteral("pw")); + KrfbConfig::self()->save(); + qDebug() << "Wayland: Fixed preferredFrameBufferPlugin to \"pw\"."; + } + } +} + int main(int argc, char *argv[]) { QApplication app(argc, argv); @@ -118,16 +135,19 @@ int main(int argc, char *argv[]) app.setQuitOnLastWindowClosed(false); - if (QX11Info::isPlatformX11()) { + if (KWindowSystem::isPlatformX11()) { if (!checkX11Capabilities()) { return 1; } // upgrade the configuration checkOldX11PluginConfig(); + } else if (KWindowSystem::isPlatformWayland()) { + // check that default plugin in Wayland is PipeWire + checkWaylandPluginConfig(); } else { KMessageBox::error(nullptr, - i18n("Desktop Sharing is not running under an X11 Server. " + i18n("Desktop Sharing is not running under an X11 Server or Wayland.\n" "Other display servers are currently not supported."), i18n("Desktop Sharing Error")); return 1;