From 8743abd54fdc25d031dcb0c1047008cd21a216028f1c0bf2e9927a4fb32473a1 Mon Sep 17 00:00:00 2001 From: Marcel Kuehlhorn Date: Wed, 6 Nov 2019 10:29:52 +0000 Subject: [PATCH] Accepting request 745561 from home:nuklly:branches:server:messaging - Remove the TDESKTOP_DISABLE_GTK_INTEGRATION macro in patch.py * Enable the native notification on all platforms. * Use GTK 2 theme by default to harmonize the libqt5-prioritise-gtk2-platformtheme.patch (boo#1149986). OBS-URL: https://build.opensuse.org/request/show/745561 OBS-URL: https://build.opensuse.org/package/show/server:messaging/telegram-desktop?expand=0&rev=112 --- default-gtk2.patch | 37 +++++++++++++++++++++++++++++++++++++ patch.py | 3 +-- tdesktop.patch | 4 ++-- telegram-desktop.changes | 8 ++++++++ telegram-desktop.spec | 3 +++ 5 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 default-gtk2.patch diff --git a/default-gtk2.patch b/default-gtk2.patch new file mode 100644 index 0000000..2b33019 --- /dev/null +++ b/default-gtk2.patch @@ -0,0 +1,37 @@ +diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp +index 5071d63..f8c0f20 100644 +--- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp ++++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp +@@ -237,15 +237,15 @@ void start() { + bool indicatorLoaded = false; + bool isWayland = QGuiApplication::platformName().startsWith(qsl("wayland"), Qt::CaseInsensitive); + QLibrary lib_gtk, lib_indicator; +- if (loadLibrary(lib_indicator, "ayatana-appindicator3", 1) || loadLibrary(lib_indicator, "appindicator3", 1)) { +- if (loadLibrary(lib_gtk, "gtk-3", 0)) { ++ if (loadLibrary(lib_indicator, "ayatana-appindicator", 1) || loadLibrary(lib_indicator, "appindicator", 1)) { ++ if (loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) { + gtkLoaded = setupGtkBase(lib_gtk); + indicatorLoaded = setupAppIndicator(lib_indicator); + } + } + if ((!gtkLoaded || !indicatorLoaded) && !isWayland) { +- if (loadLibrary(lib_indicator, "ayatana-appindicator", 1) || loadLibrary(lib_indicator, "appindicator", 1)) { +- if (loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) { ++ if (loadLibrary(lib_indicator, "ayatana-appindicator3", 1) || loadLibrary(lib_indicator, "appindicator3", 1)) { ++ if (loadLibrary(lib_gtk, "gtk-3", 0)) { + gtkLoaded = indicatorLoaded = false; + gtkLoaded = setupGtkBase(lib_gtk); + indicatorLoaded = setupAppIndicator(lib_indicator); +@@ -255,10 +255,10 @@ void start() { + + // If no appindicator, try at least load gtk. + if (!gtkLoaded && !indicatorLoaded) { +- if (loadLibrary(lib_gtk, "gtk-3", 0)) { ++ if (loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) { + gtkLoaded = setupGtkBase(lib_gtk); + } +- if (!gtkLoaded && !isWayland && loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) { ++ if (!gtkLoaded && !isWayland && loadLibrary(lib_gtk, "gtk-3", 0)) { + gtkLoaded = setupGtkBase(lib_gtk); + } + } diff --git a/patch.py b/patch.py index 0b64758..247632f 100644 --- a/patch.py +++ b/patch.py @@ -93,7 +93,6 @@ def load_json(filename): return json.loads(read_file_to_proper_json(open(filename))) def save_json(jsonobj, filename): - # pass j = transform_back(jsonobj) # backup = filename + ".orig" # copyfile(filename, backup) @@ -239,7 +238,7 @@ def process_telegram(jsonobj): child.append("'TDESKTOP_DISABLE_AUTOUPDATE'") child.append("'TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME'") child.append("'TDESKTOP_DISABLE_UNITY_INTEGRATION'") - child.append("'TDESKTOP_DISABLE_GTK_INTEGRATION'") + # child.append("'TDESKTOP_DISABLE_GTK_INTEGRATION'") child.append("'TDESKTOP_DISABLE_OPENAL_EFFECTS'") child.remove("'AL_LIBTYPE_STATIC'") child = jsonobj["'targets'"][0]["'include_dirs'"] diff --git a/tdesktop.patch b/tdesktop.patch index 1bd2390..3395b91 100644 --- a/tdesktop.patch +++ b/tdesktop.patch @@ -19,12 +19,12 @@ index 3ba28309b..e280c44fa 100644 + // I don't know why path is not in QT_PLUGIN_PATH by default + QCoreApplication::addLibraryPath("/usr/lib64/qt5/plugins"); -+ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors ++ // without this Telegram doesn't start on Ubuntu 17.04 due to GTK errors + setenv("QT_STYLE_OVERRIDE", "qwerty", false); + // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943 + unsetenv("QT_QPA_PLATFORMTHEME"); + -+ // unset QT screen scale related envvars ++ // unset QT screen scale related envvars + unsetenv("QT_SCREEN_SCALE_FACTORS"); + unsetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); + unsetenv("QT_SCALE_FACTOR"); diff --git a/telegram-desktop.changes b/telegram-desktop.changes index 01e53b4..dd574e8 100644 --- a/telegram-desktop.changes +++ b/telegram-desktop.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Nov 5 20:51:58 UTC 2019 - Xu Zhao + +- Remove the TDESKTOP_DISABLE_GTK_INTEGRATION macro in patch.py + * Enable the native notification on all platforms. + * Use GTK 2 theme by default to harmonize the + libqt5-prioritise-gtk2-platformtheme.patch (boo#1149986). + ------------------------------------------------------------------- Sat Nov 2 11:54:41 UTC 2019 - Xu Zhao diff --git a/telegram-desktop.spec b/telegram-desktop.spec index 32a5a46..56bd000 100644 --- a/telegram-desktop.spec +++ b/telegram-desktop.spec @@ -64,6 +64,7 @@ Source13: rlottie-master.zip Source14: qt_functions.cpp Patch0: tdesktop.patch +Patch1: default-gtk2.patch BuildRequires: chrpath BuildRequires: cmake BuildRequires: desktop-file-utils @@ -145,6 +146,7 @@ BuildRequires: pkgconfig(zlib) Requires: ffmpeg Requires: hicolor-icon-theme Requires: icu +Requires: libappindicator1 Requires: openssl ExclusiveArch: x86_64 @@ -200,6 +202,7 @@ cp %{_sourcedir}/tdesktop.patch %{_builddir}/tdesktop-%{version} cd %{_builddir}/tdesktop-%{version} %patch0 -p1 +%patch1 -p1 cp %{_sourcedir}/patch.py . && python3 ./patch.py cp %{_sourcedir}/qt_functions.cpp Telegram/SourceFiles/ sed -i '1i<(src_loc)/qt_functions.cpp' Telegram/gyp/telegram/sources.txt