1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-01 07:24:29 +00:00

New dep: KWindowSystem and support running in Wayland

This commit adds a new dependency - KWindowSystem, to help
with window system detection. If wayland is detected, then
preferred framebuffer plugin is switched to "pw" (pipewire).
This commit is contained in:
Alexey Min 2019-07-07 14:02:19 +03:00
parent 0cc47b9a06
commit 9828143609
3 changed files with 24 additions and 2 deletions

View File

@ -39,6 +39,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Notifications
Wallet
WidgetsAddons
WindowSystem
XmlGui
)

View File

@ -101,6 +101,7 @@ target_link_libraries (krfb
KF5::Notifications
KF5::Wallet
KF5::WidgetsAddons
KF5::WindowSystem
KF5::XmlGui
${LIBVNCSERVER_LIBRARIES}
)

View File

@ -25,6 +25,7 @@
#include <KDBusService>
#include <KLocalizedString>
#include <KMessageBox>
#include <KWindowSystem>
#include <QDebug>
#include <QPixmap>
@ -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;