From 2ad20d6c4a6036be70b5d1e73a7e0493b9b05d27 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 28 Nov 2021 23:15:51 +0400 Subject: [PATCH] Instantiate a local dbus server for webview IPC --- .../platform/linux/launcher_linux.cpp | 16 +++------------- .../platform/linux/specific_linux.cpp | 10 ++++++++-- Telegram/lib_webview | 2 +- snap/snapcraft.yaml | 4 ---- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp index 7994350eac..931cbccd1a 100644 --- a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp @@ -13,11 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include -#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION -#include -#include -#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION - #include #include #include @@ -56,15 +51,10 @@ Launcher::Launcher(int argc, char *argv[]) } int Launcher::exec() { -#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION - Glib::init(); - Gio::init(); -#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION - for (auto i = begin(_arguments), e = end(_arguments); i != e; ++i) { - if (*i == "-webviewhelper" && std::distance(i, e) > 2) { - Webview::WebKit2Gtk::SetServiceName(*(i + 2)); - return Webview::WebKit2Gtk::Exec(*(i + 1)); + if (*i == "-webviewhelper" && std::distance(i, e) > 1) { + Webview::WebKit2Gtk::SetSocketPath(*(i + 1)); + return Webview::WebKit2Gtk::Exec(); } } diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 325e464d0e..b0e90e454b 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -709,6 +709,9 @@ void start() { qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1()); #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION + Glib::init(); + Gio::init(); + Glib::set_prgname(cExeName().toStdString()); Glib::set_application_name(std::string(AppName)); @@ -742,8 +745,11 @@ void start() { char h[33] = { 0 }; hashMd5Hex(d.constData(), d.size(), h); - Webview::WebKit2Gtk::SetServiceName( - kWebviewService.utf16().arg(h).arg("%1").toStdString()); + Webview::WebKit2Gtk::SetSocketPath(qsl("%1/%2-%3-webview-%4").arg( + QDir::tempPath(), + h, + cGUIDStr(), + qsl("%1")).toStdString()); } void finish() { diff --git a/Telegram/lib_webview b/Telegram/lib_webview index f82ad9d608..754657aede 160000 --- a/Telegram/lib_webview +++ b/Telegram/lib_webview @@ -1 +1 @@ -Subproject commit f82ad9d608000171ef3822713712346f38aee50d +Subproject commit 754657aededfaa646bc6e8f48a18141982762785 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f4f0065d85..a65d75ead3 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -68,10 +68,6 @@ plugs: default-provider: gtk-common-themes slots: - tdesktop-dbus: - interface: dbus - bus: session - name: org.telegram.desktop tdesktop-mpris: interface: mpris name: tdesktop