commit d952c97a47b6b50cb2a1d793dec93eb1cace1d70
Author: Vitaly Zaitsev <vitaly(a)easycoding.org>
Date: Fri Nov 20 17:12:03 2020 +0100
Backported upstream patches with startup hangs fixes.
telegram-desktop-fix-ibus-hangs.patch | 79 ++++++++++++++++++++++++++++
telegram-desktop-fix-ibus-portal-check.patch | 29 ++++++++++
telegram-desktop.spec | 14 +++--
3 files changed, 118 insertions(+), 4 deletions(-)
---
diff --git a/telegram-desktop-fix-ibus-hangs.patch
b/telegram-desktop-fix-ibus-hangs.patch
new file mode 100644
index 0000000..1143bdd
--- /dev/null
+++ b/telegram-desktop-fix-ibus-hangs.patch
@@ -0,0 +1,79 @@
+From 8846116f0d2ca72425ed77cc8b49fa3e6cb7aec0 Mon Sep 17 00:00:00 2001
+From: Ilya Fedin <fedin-ilja2010(a)ya.ru>
+Date: Tue, 10 Nov 2020 14:00:26 +0400
+Subject: [PATCH 1/2] Fix 30s hang in case ibus portal couldn't be started
+
+---
+ .../platform/linux/specific_linux.cpp | 42 +++++++++++++++++--
+ 1 file changed, 39 insertions(+), 3 deletions(-)
+
+diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp
b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+index 5fff0b83d..42c50074f 100644
+--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp
++++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+@@ -35,6 +35,7 @@
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
+ #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
+ #include <QtDBus/QDBusInterface>
+ #include <QtDBus/QDBusConnection>
++#include <QtDBus/QDBusConnectionInterface>
+ #include <QtDBus/QDBusMessage>
+ #include <QtDBus/QDBusReply>
+ #include <QtDBus/QDBusError>
+@@ -87,6 +88,31 @@ constexpr auto kXCBFrameExtentsAtomName =
"_GTK_FRAME_EXTENTS"_cs;
+ QStringList PlatformThemes;
+
+ #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
++QStringList ListDBusActivatableNames() {
++ static const auto Result = [&] {
++ const auto message = QDBusMessage::createMethodCall(
++ qsl("org.freedesktop.DBus"),
++ qsl("/org/freedesktop/DBus"),
++ qsl("org.freedesktop.DBus"),
++ qsl("ListActivatableNames"));
++
++ const QDBusReply<QStringList> reply = QDBusConnection::sessionBus()
++ .call(message);
++
++ if (reply.isValid()) {
++ return reply.value();
++ } else {
++ LOG(("App Error: %1: %2")
++ .arg(reply.error().name())
++ .arg(reply.error().message()));
++ }
++
++ return QStringList{};
++ }();
++
++ return Result;
++}
++
+ void PortalAutostart(bool autostart, bool silent = false) {
+ if (cExeName().isEmpty()) {
+ return;
+@@ -133,9 +159,19 @@ bool IsXDGDesktopPortalKDEPresent() {
+ }
+
+ bool IsIBusPortalPresent() {
+- static const auto Result = QDBusInterface(
+- qsl("org.freedesktop.portal.IBus"),
+- qsl("/org/freedesktop/IBus")).isValid();
++ static const auto Result = [&] {
++ const auto interface = QDBusConnection::sessionBus().interface();
++ const auto activatableNames = ListDBusActivatableNames();
++
++ const auto serviceRegistered = interface
++ && interface->isServiceRegistered(
++ qsl("org.freedesktop.portal.IBus"));
++
++ const auto serviceActivatable = activatableNames.contains(
++ qsl("org.freedesktop.portal.IBus"));
++
++ return serviceRegistered || serviceActivatable;
++ }();
+
+ return Result;
+ }
+--
+2.28.0
+
diff --git a/telegram-desktop-fix-ibus-portal-check.patch
b/telegram-desktop-fix-ibus-portal-check.patch
new file mode 100644
index 0000000..88c6222
--- /dev/null
+++ b/telegram-desktop-fix-ibus-portal-check.patch
@@ -0,0 +1,29 @@
+From 42f4e8d4fa25170d097db79d572aac5a3f2660d7 Mon Sep 17 00:00:00 2001
+From: Ilya Fedin <fedin-ilja2010(a)ya.ru>
+Date: Thu, 12 Nov 2020 19:10:30 +0400
+Subject: [PATCH 2/2] Since changing the ibus portal check, it is not
+ compatible with snap anymore
+
+---
+ Telegram/SourceFiles/platform/linux/specific_linux.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp
b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+index 42c50074f..14264897a 100644
+--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp
++++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+@@ -1151,7 +1151,10 @@ void start() {
+ // Since tdesktop is distributed in static binary form,
+ // it makes sense to use ibus portal whenever it present
+ // to ensure compatibility with the maximum range of distributions.
+- if (IsIBusPortalPresent()) {
++ if (AreQtPluginsBundled()
++ && !InFlatpak()
++ && !InSnap()
++ && IsIBusPortalPresent()) {
+ LOG(("IBus portal is present! Using it."));
+ qputenv("IBUS_USE_PORTAL", "1");
+ }
+--
+2.28.0
+
diff --git a/telegram-desktop.spec b/telegram-desktop.spec
index 8aa87a7..12242c9 100644
--- a/telegram-desktop.spec
+++ b/telegram-desktop.spec
@@ -29,7 +29,7 @@
Name: telegram-desktop
Version: 2.4.7
-Release: 2%{?dist}
+Release: 3%{?dist}
# Application and 3rd-party modules licensing:
# * Telegram Desktop - GPLv3+ with OpenSSL exception -- main tarball;
@@ -40,6 +40,12 @@ URL:
https://github.com/telegramdesktop/%{appname}
Summary: Telegram Desktop official messaging app
Source0: %{url}/releases/download/v%{version}/%{appname}-%{version}-full.tar.gz
+#
https://github.com/telegramdesktop/tdesktop/commit/21133abe132344bab00f9c...
+Patch100: %{name}-fix-ibus-hangs.patch
+
+#
https://github.com/telegramdesktop/tdesktop/commit/e64f6f72667d1beccd5464...
+Patch101: %{name}-fix-ibus-portal-check.patch
+
# Telegram Desktop require more than 8 GB of RAM on linking stage.
# Disabling all low-memory architectures.
ExclusiveArch: x86_64
@@ -195,11 +201,11 @@ desktop-file-validate
%{buildroot}%{_datadir}/applications/%{launcher}.desktop
%{_metainfodir}/%{launcher}.appdata.xml
%changelog
+* Fri Nov 20 2020 Vitaly Zaitsev <vitaly(a)easycoding.org> - 2.4.7-3
+- Backported upstream patches with startup hangs fixes.
+
* Thu Nov 12 2020 Vitaly Zaitsev <vitaly(a)easycoding.org> - 2.4.7-2
- Rebuilt with bundled version of libtgvoip.
* Thu Nov 05 2020 Vitaly Zaitsev <vitaly(a)easycoding.org> - 2.4.7-1
- Updated to version 2.4.7.
-
-* Mon Nov 02 2020 Vitaly Zaitsev <vitaly(a)easycoding.org> - 2.4.6-1
-- Updated to version 2.4.6.