diff options
author | Dmitry Porunov | 2019-12-05 19:05:32 +0000 |
---|---|---|
committer | Dmitry Porunov | 2019-12-05 19:05:32 +0000 |
commit | bdf25e954ba734a6ee2a25ba7cdfbe402cfcbcb2 (patch) | |
tree | 199fc6ce0fba97b9010b38fd5f002766d7634daa | |
parent | 7c293b0c667cf6a541f1b83574ff739146ded7c8 (diff) | |
download | aur-bdf25e954ba734a6ee2a25ba7cdfbe402cfcbcb2.tar.gz |
Release k1.1.1
-rw-r--r-- | .SRCINFO | 64 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | PKGBUILD | 240 | ||||
-rw-r--r-- | Parse-Semibold-Fontnames.patch | 83 | ||||
-rw-r--r-- | QtDBus-Notifications-Implementation.patch | 1172 | ||||
-rw-r--r-- | Use-native-notifications-by-default.patch | 13 | ||||
-rw-r--r-- | Use-system-wide-font.patch | 100 | ||||
-rw-r--r-- | linux-autostart.patch | 89 | ||||
-rw-r--r-- | system-tray-icon.patch | 77 | ||||
-rw-r--r-- | tdesktop.patch | 288 |
10 files changed, 1813 insertions, 315 deletions
@@ -1,50 +1,59 @@ pkgbase = kotatogram-desktop pkgdesc = Experimental Telegram Desktop fork with option to select custom fonts. pkgver = 1.1.1 - pkgrel = 2 + pkgrel = 3 url = https://github.com/kotatogram/kotatogram-desktop arch = x86_64 license = GPL3 - makedepends = cmake makedepends = git makedepends = gyp + makedepends = cmake + makedepends = ninja makedepends = range-v3 - makedepends = python - makedepends = libappindicator-gtk3 - depends = ffmpeg - depends = hicolor-icon-theme - depends = minizip - depends = openal depends = qt5-base depends = qt5-imageformats + depends = ffmpeg + depends = openal + depends = xz + depends = lz4 + depends = zlib + depends = minizip depends = openssl - optdepends = libnotify: desktop notifications - provides = kotatogram-desktop + depends = libtgvoip + depends = rlottie-tdesktop + depends = hicolor-icon-theme + depends = desktop-file-utils + optdepends = ttf-opensans: default Open Sans font family conflicts = kotatogram-desktop-bin conflicts = telegram-desktop conflicts = telegram-desktop-bin - source = kotatogram-desktop-1.1.1-2::git+https://github.com/kotatogram/kotatogram-desktop.git#tag=k1.1.1 + source = kotatogram-desktop-1.1.1-3::git+https://github.com/kotatogram/kotatogram-desktop.git#tag=k1.1.1 source = Catch2::git+https://github.com/catchorg/Catch2.git source = crl::git+https://github.com/telegramdesktop/crl.git source = GSL::git+https://github.com/Microsoft/GSL.git - source = libtgvoip::git+https://github.com/telegramdesktop/libtgvoip + source = libtgvoip::git+https://github.com/telegramdesktop/libtgvoip.git source = lz4::git+https://github.com/lz4/lz4.git source = rlottie::git+https://github.com/desktop-app/rlottie.git - source = variant::git+https://github.com/mapbox/variant + source = variant::git+https://github.com/mapbox/variant.git source = xxHash::git+https://github.com/Cyan4973/xxHash.git source = codegen::git+https://github.com/desktop-app/codegen.git source = lib_base::git+https://github.com/desktop-app/lib_base.git - source = lib_crl::git+https://github.com/desktop-app/lib_crl - source = lib_lottie::git+https://github.com/desktop-app/lib_lottie - source = lib_rlottie::git+https://github.com/desktop-app/lib_rlottie - source = lib_rpl::git+https://github.com/desktop-app/lib_rpl - source = lib_spellcheck::git+https://github.com/desktop-app/lib_spellcheck - source = lib_tl::git+https://github.com/desktop-app/lib_tl + source = lib_crl::git+https://github.com/desktop-app/lib_crl.git + source = lib_lottie::git+https://github.com/desktop-app/lib_lottie.git + source = lib_rlottie::git+https://github.com/desktop-app/lib_rlottie.git + source = lib_rpl::git+https://github.com/desktop-app/lib_rpl.git + source = lib_spellcheck::git+https://github.com/desktop-app/lib_spellcheck.git + source = lib_tl::git+https://github.com/desktop-app/lib_tl.git source = lib_ui::git+https://github.com/kotatogram/lib_ui.git - source = CMakeLists.inj - source = no-gtk2.patch source = tdesktop.patch - source = https://raw.githubusercontent.com/kotatogram/kotatogram-desktop/k1.1.1/lib/xdg/tg.protocol + source = Use-system-wide-font.patch + source = Parse-Semibold-Fontnames.patch + source = QtDBus-Notifications-Implementation.patch + source = system-tray-icon.patch + source = linux-autostart.patch + source = Use-native-notifications-by-default.patch + source = https://github.com/kotatogram/kotatogram-desktop/commit/a196b0aba723de85ee573594d9ad420412b6391a.patch + source = CMakeLists.inj sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP @@ -63,10 +72,15 @@ pkgbase = kotatogram-desktop sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP + sha512sums = 5c14fb1fa8f7864f4e9c74dd7f5aa8c6a3dea0029ccf07afbd3bdd8fbf700919d57ca4e5e3faf4950d41458766cf909da6976b6ba49b6268ea8cd9f8e539aad1 + sha512sums = 2548ce368b63e526635060b376e911bd51cd3d2983a8096583f8a71137e9d3f4523f5ee3b3d658d55d7b5497aadc4bee1a2ef53a52f99c67c02be92e0a7ed638 + sha512sums = a239a44a5859d03baad86bbeb46795d829cbcd7e67f0d0d49ef855c0421cf9b6d7c1c6d112a266cfec491e93228025235fefd86716bfd0f1c9da3f060c1604c7 + sha512sums = 8394097bf41e4767b1b3f7978c4f00efa058714f71e8fcec79eae9c2b47849749f307e793fb31c4b35bed5450ad91599f033fc6f360d41ddf01195fffdca817f + sha512sums = 6bdb73dd7ebd8cd50da0f09f2f1fa201e687fee949c4a05f90e62e7e6167ccca877a078021ca611ce8fbb464aab329b92270f07e0cb770c2b7a89a436d37549a + sha512sums = 63d143cc7accf0d953061d19f34debb0209298a05bafa7ebd3851e4cf8f3a2c7beabdfbebd96434738604140c2196b883148e54c333537942d4d3c81e82517a9 + sha512sums = 14064af25fda0fcd31a0dc7626687eaf61c329e9100fb55a8a0a455600a63a761e864056088aa486afdd053eccad0a55f8b332151eeb46c90a2c562a64a0a36e + sha512sums = 067145e8823b330adc91533c4da6c2dd7babd66a22acbe06ad10920e3139467364d9e658ed6c86837cf11e252c1d8c5a2ff1af2feddb46998e4d018328555ff7 sha512sums = 98236f7f161c8bad1152a77505f9c3eebae06ffc0420ed476e101359a92d01438dd6ce6062e0b110b76f2d6d09f59accf4b1969699b8af5a3650ecb0c31929c5 - sha512sums = 117b0c2bae3d3d3aa94d41382621be4e05c3314a2831dba59e1bcfb443e7b8ff4bcd0403544fa0cb6def85b444146bf59eef9da25f96b041d3ce8f5429b4a867 - sha512sums = f667b00f4c2e02799d3a130f1370bbe13866294329164c9fee901fa54655e4ebfaaae4e0f15327b660b10248c6a087dd2fa53d9f72714ba099ea2cbf4d07ca32 - sha512sums = e54c2f5a4cdeff5850828072890679e07da07cfa3663cf9bfb1e6b8f5bca0dc15e6b4b9a2a6c111b796a0440035beea419cda9bf4ec5d476d4fbb54c1b4ad7fd pkgname = kotatogram-desktop diff --git a/.gitignore b/.gitignore index 5193133398c0..e45650954189 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,7 @@ libtgvoip/ lz4/ rlottie/ src/ +pkg/ variant/ xxHash/ +a196b0aba723de85ee573594d9ad420412b6391a.patch @@ -1,63 +1,68 @@ # Maintainer: Auteiy <dmitry@auteiy.me> -# Thanks Nicholas Guriev <guriev-ns@ya.ru> for the patches! -# https://github.com/mymedia2/tdesktop - pkgname=kotatogram-desktop pkgver=1.1.1 -pkgrel=2 +pkgrel=3 pkgdesc="Experimental Telegram Desktop fork with option to select custom fonts." arch=(x86_64) url="https://github.com/kotatogram/kotatogram-desktop" license=(GPL3) depends=( - ffmpeg - hicolor-icon-theme - minizip - openal - qt5-base - qt5-imageformats - openssl - ) + qt5-base + qt5-imageformats + ffmpeg + openal + xz + lz4 + zlib + minizip + openssl + libtgvoip + rlottie-tdesktop + hicolor-icon-theme + desktop-file-utils +) makedepends=( - cmake - git - gyp - range-v3 - python - libappindicator-gtk3 - ) -optdepends=( - 'libnotify: desktop notifications' - ) + git + gyp + cmake + ninja + range-v3 +) +optdepends=('ttf-opensans: default Open Sans font family') conflicts=('kotatogram-desktop-bin' 'telegram-desktop' 'telegram-desktop-bin') -provides=('kotatogram-desktop') source=( - "$pkgname-$pkgver-$pkgrel::git+$url.git#tag=k$pkgver" - "Catch2::git+https://github.com/catchorg/Catch2.git" - "crl::git+https://github.com/telegramdesktop/crl.git" - "GSL::git+https://github.com/Microsoft/GSL.git" - "libtgvoip::git+https://github.com/telegramdesktop/libtgvoip" - "lz4::git+https://github.com/lz4/lz4.git" - "rlottie::git+https://github.com/desktop-app/rlottie.git" - "variant::git+https://github.com/mapbox/variant" - "xxHash::git+https://github.com/Cyan4973/xxHash.git" - "codegen::git+https://github.com/desktop-app/codegen.git" - "lib_base::git+https://github.com/desktop-app/lib_base.git" - "lib_crl::git+https://github.com/desktop-app/lib_crl" - "lib_lottie::git+https://github.com/desktop-app/lib_lottie" - "lib_rlottie::git+https://github.com/desktop-app/lib_rlottie" - "lib_rpl::git+https://github.com/desktop-app/lib_rpl" - "lib_spellcheck::git+https://github.com/desktop-app/lib_spellcheck" - "lib_tl::git+https://github.com/desktop-app/lib_tl" - "lib_ui::git+https://github.com/kotatogram/lib_ui.git" - - "CMakeLists.inj" - "no-gtk2.patch" - "tdesktop.patch" - "https://raw.githubusercontent.com/kotatogram/kotatogram-desktop/k$pkgver/lib/xdg/tg.protocol" - - ) + "$pkgname-$pkgver-$pkgrel::git+$url.git#tag=k$pkgver" + + "Catch2::git+https://github.com/catchorg/Catch2.git" + "crl::git+https://github.com/telegramdesktop/crl.git" + "GSL::git+https://github.com/Microsoft/GSL.git" + "libtgvoip::git+https://github.com/telegramdesktop/libtgvoip.git" + "lz4::git+https://github.com/lz4/lz4.git" + "rlottie::git+https://github.com/desktop-app/rlottie.git" + "variant::git+https://github.com/mapbox/variant.git" + "xxHash::git+https://github.com/Cyan4973/xxHash.git" + "codegen::git+https://github.com/desktop-app/codegen.git" + "lib_base::git+https://github.com/desktop-app/lib_base.git" + "lib_crl::git+https://github.com/desktop-app/lib_crl.git" + "lib_lottie::git+https://github.com/desktop-app/lib_lottie.git" + "lib_rlottie::git+https://github.com/desktop-app/lib_rlottie.git" + "lib_rpl::git+https://github.com/desktop-app/lib_rpl.git" + "lib_spellcheck::git+https://github.com/desktop-app/lib_spellcheck.git" + "lib_tl::git+https://github.com/desktop-app/lib_tl.git" + "lib_ui::git+https://github.com/kotatogram/lib_ui.git" + + "tdesktop.patch" + "Use-system-wide-font.patch" + "Parse-Semibold-Fontnames.patch" + "QtDBus-Notifications-Implementation.patch" + "system-tray-icon.patch" + "linux-autostart.patch" + "Use-native-notifications-by-default.patch" + "https://github.com/kotatogram/kotatogram-desktop/commit/a196b0aba723de85ee573594d9ad420412b6391a.patch" + + "CMakeLists.inj" +) # Checksums automatically set in CI, see: /.gitlab-ci.yml sha512sums=('SKIP' 'SKIP' @@ -77,85 +82,86 @@ sha512sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' - '98236f7f161c8bad1152a77505f9c3eebae06ffc0420ed476e101359a92d01438dd6ce6062e0b110b76f2d6d09f59accf4b1969699b8af5a3650ecb0c31929c5' - '117b0c2bae3d3d3aa94d41382621be4e05c3314a2831dba59e1bcfb443e7b8ff4bcd0403544fa0cb6def85b444146bf59eef9da25f96b041d3ce8f5429b4a867' - 'f667b00f4c2e02799d3a130f1370bbe13866294329164c9fee901fa54655e4ebfaaae4e0f15327b660b10248c6a087dd2fa53d9f72714ba099ea2cbf4d07ca32' - 'e54c2f5a4cdeff5850828072890679e07da07cfa3663cf9bfb1e6b8f5bca0dc15e6b4b9a2a6c111b796a0440035beea419cda9bf4ec5d476d4fbb54c1b4ad7fd') - + '5c14fb1fa8f7864f4e9c74dd7f5aa8c6a3dea0029ccf07afbd3bdd8fbf700919d57ca4e5e3faf4950d41458766cf909da6976b6ba49b6268ea8cd9f8e539aad1' + '2548ce368b63e526635060b376e911bd51cd3d2983a8096583f8a71137e9d3f4523f5ee3b3d658d55d7b5497aadc4bee1a2ef53a52f99c67c02be92e0a7ed638' + 'a239a44a5859d03baad86bbeb46795d829cbcd7e67f0d0d49ef855c0421cf9b6d7c1c6d112a266cfec491e93228025235fefd86716bfd0f1c9da3f060c1604c7' + '8394097bf41e4767b1b3f7978c4f00efa058714f71e8fcec79eae9c2b47849749f307e793fb31c4b35bed5450ad91599f033fc6f360d41ddf01195fffdca817f' + '6bdb73dd7ebd8cd50da0f09f2f1fa201e687fee949c4a05f90e62e7e6167ccca877a078021ca611ce8fbb464aab329b92270f07e0cb770c2b7a89a436d37549a' + '63d143cc7accf0d953061d19f34debb0209298a05bafa7ebd3851e4cf8f3a2c7beabdfbebd96434738604140c2196b883148e54c333537942d4d3c81e82517a9' + '14064af25fda0fcd31a0dc7626687eaf61c329e9100fb55a8a0a455600a63a761e864056088aa486afdd053eccad0a55f8b332151eeb46c90a2c562a64a0a36e' + '067145e8823b330adc91533c4da6c2dd7babd66a22acbe06ad10920e3139467364d9e658ed6c86837cf11e252c1d8c5a2ff1af2feddb46998e4d018328555ff7' + '98236f7f161c8bad1152a77505f9c3eebae06ffc0420ed476e101359a92d01438dd6ce6062e0b110b76f2d6d09f59accf4b1969699b8af5a3650ecb0c31929c5') prepare() { - cd "$srcdir/$pkgname-$pkgver-$pkgrel" - git submodule init - - git config submodule.Telegram/ThirdParty/Catch.url "$srcdir/Catch2" - git config submodule.Telegram/ThirdParty/crl.url "$srcdir/crl" - git config submodule.Telegram/ThirdParty/GSL.url "$srcdir/GSL" - git config submodule.Telegram/ThirdParty/libtgvoip.url "$srcdir/libtgvoip" - git config submodule.Telegram/ThirdParty/lz4.url "$srcdir/lz4" - git config submodule.Telegram/ThirdParty/minizip.url "$srcdir/minizip" - git config submodule.Telegram/ThirdParty/rlottie.url "$srcdir/rlottie" - git config submodule.Telegram/ThirdParty/SPMediaKeyTap.url "$srcdir/SPMediaKeyTap" - git config submodule.Telegram/ThirdParty/variant.url "$srcdir/variant" - git config submodule.Telegram/ThirdParty/xxHash.url "$srcdir/xxHash" - - git config submodule.Telegram/codegen.url "$srcdir/codegen" - git config submodule.Telegram/lib_base.url "$srcdir/lib_base" - git config submodule.Telegram/lib_crl.url "$srcdir/lib_crl" - git config submodule.Telegram/lib_lottie.url "$srcdir/lib_lottie" - git config submodule.Telegram/lib_rlottie.url "$srcdir/lib_rlottie" - git config submodule.Telegram/lib_rpl.url "$srcdir/lib_rpl" - git config submodule.Telegram/lib_spellcheck.url "$srcdir/lib_spellcheck" - git config submodule.Telegram/lib_tl.url "$srcdir/lib_tl" - git config submodule.Telegram/lib_ui.url "$srcdir/lib_ui" - - git submodule update - - patch -Np1 -i "$srcdir/no-gtk2.patch" - patch -Np1 -i "$srcdir/tdesktop.patch" + cd "$srcdir/$pkgname-$pkgver-$pkgrel" + git submodule init + + git config submodule.Telegram/ThirdParty/Catch.url "$srcdir/Catch2" + git config submodule.Telegram/ThirdParty/crl.url "$srcdir/crl" + git config submodule.Telegram/ThirdParty/GSL.url "$srcdir/GSL" + git config submodule.Telegram/ThirdParty/libtgvoip.url "$srcdir/libtgvoip" + git config submodule.Telegram/ThirdParty/lz4.url "$srcdir/lz4" + git config submodule.Telegram/ThirdParty/rlottie.url "$srcdir/rlottie" + git config submodule.Telegram/ThirdParty/SPMediaKeyTap.url "$srcdir/SPMediaKeyTap" + git config submodule.Telegram/ThirdParty/variant.url "$srcdir/variant" + git config submodule.Telegram/ThirdParty/xxHash.url "$srcdir/xxHash" + + git config submodule.Telegram/codegen.url "$srcdir/codegen" + git config submodule.Telegram/lib_base.url "$srcdir/lib_base" + git config submodule.Telegram/lib_crl.url "$srcdir/lib_crl" + git config submodule.Telegram/lib_lottie.url "$srcdir/lib_lottie" + git config submodule.Telegram/lib_rlottie.url "$srcdir/lib_rlottie" + git config submodule.Telegram/lib_rpl.url "$srcdir/lib_rpl" + git config submodule.Telegram/lib_spellcheck.url "$srcdir/lib_spellcheck" + git config submodule.Telegram/lib_tl.url "$srcdir/lib_tl" + git config submodule.Telegram/lib_ui.url "$srcdir/lib_ui" + + git submodule update + + for i in $srcdir/*.patch; do + patch -Np1 -i "$i" + done } build() { - cd "$srcdir/$pkgname-$pkgver-$pkgrel" - export LANG=en_US.UTF-8 - export GYP_DEFINES="DESKTOP_APP_DISABLE_CRASH_REPORTS,TDESKTOP_DISABLE_AUTOUPDATE,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME,TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION" - export EXTRA_FLAGS="-Winvalid-pch" - export CPPFLAGS="$CPPFLAGS $EXTRA_FLAGS" - export CXXFLAGS="$CXXFLAGS $EXTRA_FLAGS" - -# Telegram requires us to set API_ID and API_HASH for some reason but they do not provide a way to receive a pair -# See https://github.com/telegramdesktop/tdesktop/commit/65b2db216033aa08b7bc846df27843e566f08981 and -# https://github.com/telegramdesktop/tdesktop/issues/4717 -# The official API_ID seems to be 2040 while the API_HASH is "b18441a1ff607e10a989891a5462e627". -# We're going to use the defaults for now but might at some point use the official ones from the official binaries as noted above. - - gyp \ - -Dapi_id=17349 \ - -Dapi_hash=344583e45741c457fe1862106095a5eb \ - -Dbuild_defines=${GYP_DEFINES} \ - -Gconfig=Release \ - --depth=Telegram/gyp --generator-output=../.. -Goutput_dir=out Telegram/gyp/Telegram.gyp --format=cmake - NUM=$((`wc -l < out/Release/CMakeLists.txt` - 2)) - sed -i "$NUM r ../CMakeLists.inj" out/Release/CMakeLists.txt - cd "$srcdir/$pkgname-$pkgver-$pkgrel/out/Release" - cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -UTDESKTOP_OFFICIAL_TARGET - make + cd "$srcdir/$pkgname-$pkgver-$pkgrel" + export GYP_DEFINES="DESKTOP_APP_DISABLE_CRASH_REPORTS,TDESKTOP_DISABLE_AUTOUPDATE,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME,TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION,TDESKTOP_DISABLE_GTK_INTEGRATION" + + # Telegram requires us to set API_ID and API_HASH for some reason but they do not provide a way to receive a pair + # See https://github.com/telegramdesktop/tdesktop/commit/65b2db216033aa08b7bc846df27843e566f08981 and + # https://github.com/telegramdesktop/tdesktop/issues/4717 + # The official API_ID seems to be 2040 while the API_HASH is "b18441a1ff607e10a989891a5462e627". + # We're going to use the defaults for now but might at some point use the official ones from the official binaries as noted above. + + gyp \ + -Dapi_id=17349 \ + -Dapi_hash=344583e45741c457fe1862106095a5eb \ + -Dbuild_defines=${GYP_DEFINES} \ + -Dlottie_use_cache=1 \ + -Gconfig=Release \ + --depth=Telegram/gyp --generator-output=../.. -Goutput_dir=out Telegram/gyp/Telegram.gyp --format=cmake + NUM=$((`wc -l < out/Release/CMakeLists.txt` - 2)) + sed -i "$NUM r ../CMakeLists.inj" out/Release/CMakeLists.txt + cd "$srcdir/$pkgname-$pkgver-$pkgrel/out/Release" + cmake -G Ninja . + cmake --build . } package() { - install -dm755 "$pkgdir/usr/bin" - install -m755 "$srcdir/$pkgname-$pkgver-$pkgrel/out/Release/Telegram" "$pkgdir/usr/bin/kotatogram-desktop" + install -dm755 "$pkgdir/usr/bin" + install -m755 "$srcdir/$pkgname-$pkgver-$pkgrel/out/Release/Telegram" "$pkgdir/usr/bin/kotatogram-desktop" - install -d "$pkgdir/usr/share/applications" - install -m644 "$srcdir/$pkgname-$pkgver-$pkgrel/lib/xdg/kotatogramdesktop.desktop" "$pkgdir/usr/share/applications/kotatogramdesktop.desktop" + install -d "$pkgdir/usr/share/applications" + install -m644 "$srcdir/$pkgname-$pkgver-$pkgrel/lib/xdg/kotatogramdesktop.desktop" "$pkgdir/usr/share/applications/kotatogramdesktop.desktop" - install -d "$pkgdir/usr/share/kservices5" - install -m644 "$srcdir/tg.protocol" "$pkgdir/usr/share/kservices5/tg.protocol" + install -d "$pkgdir/usr/share/kservices5" + install -m644 "$srcdir/$pkgname-$pkgver-$pkgrel/lib/xdg/tg.protocol" "$pkgdir/usr/share/kservices5/tg.protocol" - local icon_size icon_dir - for icon_size in 16 32 48 64 128 256 512; do - icon_dir="$pkgdir/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps" + local icon_size icon_dir + for icon_size in 16 32 48 64 128 256 512; do + icon_dir="$pkgdir/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps" - install -d "$icon_dir" - install -m644 "$srcdir/$pkgname-$pkgver-$pkgrel/Telegram/Resources/art/icon${icon_size}.png" "$icon_dir/kotatogram.png" - done + install -d "$icon_dir" + install -m644 "$srcdir/$pkgname-$pkgver-$pkgrel/Telegram/Resources/art/icon${icon_size}.png" "$icon_dir/kotatogram.png" + done } diff --git a/Parse-Semibold-Fontnames.patch b/Parse-Semibold-Fontnames.patch new file mode 100644 index 000000000000..6ff255035c11 --- /dev/null +++ b/Parse-Semibold-Fontnames.patch @@ -0,0 +1,83 @@ +Submodule Telegram/lib_ui contains modified content +diff --git a/Telegram/lib_ui/ui/style/style_core_font.cpp b/Telegram/lib_ui/ui/style/style_core_font.cpp +index ad3a9e3..3cdf07a 100644 +--- a/Telegram/lib_ui/ui/style/style_core_font.cpp ++++ b/Telegram/lib_ui/ui/style/style_core_font.cpp +@@ -37,15 +37,55 @@ uint32 fontKey(int size, uint32 flags, int family) { + return (((uint32(family) << 10) | uint32(size)) << 4) | flags; + } + ++QString RemoveSemiboldFromName(const QString &familyName) { ++ auto removedSemibold = familyName; ++ removedSemibold.remove("Semibold", Qt::CaseInsensitive); ++ return removedSemibold.trimmed(); ++} ++ ++bool IsRealSemibold(const QString &familyName) { ++ const auto removedSemibold = RemoveSemiboldFromName(familyName); ++ ++ QFont originalFont(familyName); ++ QFont withoutSemiboldFont(removedSemibold); ++ withoutSemiboldFont.setStyleName("Semibold"); ++ ++ QFontInfo originalFontInfo(originalFont); ++ QFontInfo withoutSemiboldInfo(withoutSemiboldFont); ++ ++ if (originalFontInfo.family().trimmed().compare(familyName, Qt::CaseInsensitive) && ++ !withoutSemiboldInfo.family().trimmed().compare(removedSemibold, Qt::CaseInsensitive) && ++ !withoutSemiboldInfo.styleName().trimmed().compare("Semibold", Qt::CaseInsensitive)) { ++ return true; ++ } else { ++ return false; ++ } ++} ++ ++QString ParseFamilyName(const QString &familyName) { ++ if (IsRealSemibold(familyName)) { ++ return RemoveSemiboldFromName(familyName); ++ } else { ++ return familyName; ++ } ++} ++ + bool ValidateFont(const QString &familyName, int flags = 0) { +- QFont checkFont(familyName); ++ const auto parsedFamily = ParseFamilyName(familyName); ++ ++ QFont checkFont(parsedFamily); + checkFont.setPixelSize(13); + checkFont.setBold(flags & style::internal::FontBold); + checkFont.setItalic(flags & style::internal::FontItalic); + checkFont.setUnderline(flags & style::internal::FontUnderline); + checkFont.setStyleStrategy(QFont::PreferQuality); ++ ++ if (IsRealSemibold(familyName)) { ++ checkFont.setStyleName("Semibold"); ++ } ++ + auto realFamily = QFontInfo(checkFont).family(); +- if (realFamily.trimmed().compare(familyName, Qt::CaseInsensitive)) { ++ if (realFamily.trimmed().compare(parsedFamily, Qt::CaseInsensitive)) { + UI_LOG(("Font Error: could not resolve '%1' font, got '%2'.").arg(familyName).arg(realFamily)); + return false; + } +@@ -238,7 +278,7 @@ int registerFontFamily(const QString &family) { + } + + FontData::FontData(int size, uint32 flags, int family, Font *other) +-: f(GetFontOverride(fontFamilies[family], flags)) ++: f(ParseFamilyName(GetFontOverride(fontFamilies[family], flags))) + , m(f) + , _size(size) + , _flags(flags) +@@ -261,6 +301,10 @@ FontData::FontData(int size, uint32 flags, int family, Font *other) + f.setStrikeOut(_flags & FontStrikeOut); + f.setStyleStrategy(QFont::PreferQuality); + ++ if (IsRealSemibold(GetFontOverride(fontFamilies[family], flags))) { ++ f.setStyleName("Semibold"); ++ } ++ + m = QFontMetrics(f); + height = m.height(); + ascent = m.ascent(); diff --git a/QtDBus-Notifications-Implementation.patch b/QtDBus-Notifications-Implementation.patch new file mode 100644 index 000000000000..559adc3d49ea --- /dev/null +++ b/QtDBus-Notifications-Implementation.patch @@ -0,0 +1,1172 @@ +diff --git a/Telegram/SourceFiles/platform/linux/linux_libnotify.cpp b/Telegram/SourceFiles/platform/linux/linux_libnotify.cpp +deleted file mode 100644 +index 657c46075..000000000 +--- a/Telegram/SourceFiles/platform/linux/linux_libnotify.cpp ++++ /dev/null +@@ -1,110 +0,0 @@ +-/* +-This file is part of Telegram Desktop, +-the official desktop application for the Telegram messaging service. +- +-For license and copyright information please follow this link: +-https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +-*/ +-#include "platform/linux/linux_libnotify.h" +- +-#include "platform/linux/linux_libs.h" +- +-namespace Platform { +-namespace Libs { +-namespace { +- +-bool loadLibrary(QLibrary &lib, const char *name, int version) { +- DEBUG_LOG(("Loading '%1' with version %2...").arg(QLatin1String(name)).arg(version)); +- lib.setFileNameAndVersion(QLatin1String(name), version); +- if (lib.load()) { +- DEBUG_LOG(("Loaded '%1' with version %2!").arg(QLatin1String(name)).arg(version)); +- return true; +- } +- lib.setFileNameAndVersion(QLatin1String(name), QString()); +- if (lib.load()) { +- DEBUG_LOG(("Loaded '%1' without version!").arg(QLatin1String(name))); +- return true; +- } +- LOG(("Could not load '%1' with version %2 :(").arg(QLatin1String(name)).arg(version)); +- return false; +-} +- +-} // namespace +- +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +-f_notify_init notify_init = nullptr; +-f_notify_uninit notify_uninit = nullptr; +-f_notify_is_initted notify_is_initted = nullptr; +-//f_notify_get_app_name notify_get_app_name = nullptr; +-//f_notify_set_app_name notify_set_app_name = nullptr; +-f_notify_get_server_caps notify_get_server_caps = nullptr; +-f_notify_get_server_info notify_get_server_info = nullptr; +- +-f_notify_notification_new notify_notification_new = nullptr; +-//f_notify_notification_update notify_notification_update = nullptr; +-f_notify_notification_show notify_notification_show = nullptr; +-//f_notify_notification_set_app_name notify_notification_set_app_name = nullptr; +-f_notify_notification_set_timeout notify_notification_set_timeout = nullptr; +-//f_notify_notification_set_category notify_notification_set_category = nullptr; +-//f_notify_notification_set_urgency notify_notification_set_urgency = nullptr; +-//f_notify_notification_set_icon_from_pixbuf notify_notification_set_icon_from_pixbuf = nullptr; +-f_notify_notification_set_image_from_pixbuf notify_notification_set_image_from_pixbuf = nullptr; +-//f_notify_notification_set_hint notify_notification_set_hint = nullptr; +-//f_notify_notification_set_hint_int32 notify_notification_set_hint_int32 = nullptr; +-//f_notify_notification_set_hint_uint32 notify_notification_set_hint_uint32 = nullptr; +-//f_notify_notification_set_hint_double notify_notification_set_hint_double = nullptr; +-f_notify_notification_set_hint_string notify_notification_set_hint_string = nullptr; +-//f_notify_notification_set_hint_byte notify_notification_set_hint_byte = nullptr; +-//f_notify_notification_set_hint_byte_array notify_notification_set_hint_byte_array = nullptr; +-//f_notify_notification_clear_hints notify_notification_clear_hints = nullptr; +-f_notify_notification_add_action notify_notification_add_action = nullptr; +-f_notify_notification_clear_actions notify_notification_clear_actions = nullptr; +-f_notify_notification_close notify_notification_close = nullptr; +-f_notify_notification_get_closed_reason notify_notification_get_closed_reason = nullptr; +- +-void startLibNotify() { +- DEBUG_LOG(("Loading libnotify")); +- +- QLibrary lib_notify; +- if (!loadLibrary(lib_notify, "notify", 4)) { +- if (!loadLibrary(lib_notify, "notify", 5)) { +- if (!loadLibrary(lib_notify, "notify", 1)) { +- return; +- } +- } +- } +- +- load(lib_notify, "notify_init", notify_init); +- load(lib_notify, "notify_uninit", notify_uninit); +- load(lib_notify, "notify_is_initted", notify_is_initted); +-// load(lib_notify, "notify_get_app_name", notify_get_app_name); +-// load(lib_notify, "notify_set_app_name", notify_set_app_name); +- load(lib_notify, "notify_get_server_caps", notify_get_server_caps); +- load(lib_notify, "notify_get_server_info", notify_get_server_info); +- +- load(lib_notify, "notify_notification_new", notify_notification_new); +-// load(lib_notify, "notify_notification_update", notify_notification_update); +- load(lib_notify, "notify_notification_show", notify_notification_show); +-// load(lib_notify, "notify_notification_set_app_name", notify_notification_set_app_name); +- load(lib_notify, "notify_notification_set_timeout", notify_notification_set_timeout); +-// load(lib_notify, "notify_notification_set_category", notify_notification_set_category); +-// load(lib_notify, "notify_notification_set_urgency", notify_notification_set_urgency); +-// load(lib_notify, "notify_notification_set_icon_from_pixbuf", notify_notification_set_icon_from_pixbuf); +- load(lib_notify, "notify_notification_set_image_from_pixbuf", notify_notification_set_image_from_pixbuf); +-// load(lib_notify, "notify_notification_set_hint", notify_notification_set_hint); +-// load(lib_notify, "notify_notification_set_hint_int32", notify_notification_set_hint_int32); +-// load(lib_notify, "notify_notification_set_hint_uint32", notify_notification_set_hint_uint32); +-// load(lib_notify, "notify_notification_set_hint_double", notify_notification_set_hint_double); +- load(lib_notify, "notify_notification_set_hint_string", notify_notification_set_hint_string); +-// load(lib_notify, "notify_notification_set_hint_byte", notify_notification_set_hint_byte); +-// load(lib_notify, "notify_notification_set_hint_byte_array", notify_notification_set_hint_byte_array); +-// load(lib_notify, "notify_notification_clear_hints", notify_notification_clear_hints); +- load(lib_notify, "notify_notification_add_action", notify_notification_add_action); +- load(lib_notify, "notify_notification_clear_actions", notify_notification_clear_actions); +- load(lib_notify, "notify_notification_close", notify_notification_close); +- load(lib_notify, "notify_notification_get_closed_reason", notify_notification_get_closed_reason); +-} +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION +- +-} // namespace Libs +-} // namespace Platform +diff --git a/Telegram/SourceFiles/platform/linux/linux_libnotify.h b/Telegram/SourceFiles/platform/linux/linux_libnotify.h +deleted file mode 100644 +index 6dcfd676a..000000000 +--- a/Telegram/SourceFiles/platform/linux/linux_libnotify.h ++++ /dev/null +@@ -1,120 +0,0 @@ +-/* +-This file is part of Telegram Desktop, +-the official desktop application for the Telegram messaging service. +- +-For license and copyright information please follow this link: +-https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +-*/ +-#pragma once +- +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +-extern "C" { +-#undef signals +-#include <gtk/gtk.h> +-#define signals public +-} // extern "C" +- +-namespace Platform { +-namespace Libs { +- +-void startLibNotify(); +- +-constexpr gint NOTIFY_EXPIRES_DEFAULT = -1; +-constexpr gint NOTIFY_EXPIRES_NEVER = 0; +- +-struct NotifyNotification; +-typedef enum { +- NOTIFY_URGENCY_LOW, +- NOTIFY_URGENCY_NORMAL, +- NOTIFY_URGENCY_CRITICAL, +-} NotifyUrgency; +- +-using NotifyActionCallback = void (*)(NotifyNotification *notification, char *action, gpointer user_data); +- +-using f_notify_init = gboolean (*)(const char *app_name); +-extern f_notify_init notify_init; +- +-using f_notify_uninit = void (*)(void); +-extern f_notify_uninit notify_uninit; +- +-using f_notify_is_initted = gboolean (*)(void); +-extern f_notify_is_initted notify_is_initted; +- +-//using f_notify_get_app_name = const char* (*)(void); +-//extern f_notify_get_app_name notify_get_app_name; +- +-//using f_notify_set_app_name = void (*)(const char *app_name); +-//extern f_notify_set_app_name notify_set_app_name; +- +-using f_notify_get_server_caps = GList* (*)(void); +-extern f_notify_get_server_caps notify_get_server_caps; +- +-using f_notify_get_server_info = gboolean (*)(char **ret_name, char **ret_vendor, char **ret_version, char **ret_spec_version); +-extern f_notify_get_server_info notify_get_server_info; +- +-using f_notify_notification_new = NotifyNotification* (*)(const char *summary, const char *body, const char *icon); +-extern f_notify_notification_new notify_notification_new; +- +-//using f_notify_notification_update = gboolean (*)(NotifyNotification *notification, const char *summary, const char *body, const char *icon); +-//extern f_notify_notification_update notify_notification_update; +- +-using f_notify_notification_show = gboolean (*)(NotifyNotification *notification, GError **error); +-extern f_notify_notification_show notify_notification_show; +- +-//using f_notify_notification_set_app_name = void (*)(NotifyNotification *notification, const char *app_name); +-//extern f_notify_notification_set_app_name notify_notification_set_app_name; +- +-using f_notify_notification_set_timeout = void (*)(NotifyNotification *notification, gint timeout); +-extern f_notify_notification_set_timeout notify_notification_set_timeout; +- +-//using f_notify_notification_set_category = void (*)(NotifyNotification *notification, const char *category); +-//extern f_notify_notification_set_category notify_notification_set_category; +- +-//using f_notify_notification_set_urgency = void (*)(NotifyNotification *notification, NotifyUrgency urgency); +-//extern f_notify_notification_set_urgency notify_notification_set_urgency; +- +-//using f_notify_notification_set_icon_from_pixbuf = void (*)(NotifyNotification *notification, GdkPixbuf *icon); +-//extern f_notify_notification_set_icon_from_pixbuf notify_notification_set_icon_from_pixbuf; +- +-using f_notify_notification_set_image_from_pixbuf = void (*)(NotifyNotification *notification, GdkPixbuf *pixbuf); +-extern f_notify_notification_set_image_from_pixbuf notify_notification_set_image_from_pixbuf; +- +-//using f_notify_notification_set_hint = void (*)(NotifyNotification *notification, const char *key, GVariant *value); +-//extern f_notify_notification_set_hint notify_notification_set_hint; +- +-//using f_notify_notification_set_hint_int32 = void (*)(NotifyNotification *notification, const char *key, gint value); +-//extern f_notify_notification_set_hint_int32 notify_notification_set_hint_int32; +- +-//using f_notify_notification_set_hint_uint32 = void (*)(NotifyNotification *notification, const char *key, guint value); +-//extern f_notify_notification_set_hint_uint32 notify_notification_set_hint_uint32; +- +-//using f_notify_notification_set_hint_double = void (*)(NotifyNotification *notification, const char *key, gdouble value); +-//extern f_notify_notification_set_hint_double notify_notification_set_hint_double; +- +-using f_notify_notification_set_hint_string = void (*)(NotifyNotification *notification, const char *key, const char *value); +-extern f_notify_notification_set_hint_string notify_notification_set_hint_string; +- +-//using f_notify_notification_set_hint_byte = void (*)(NotifyNotification *notification, const char *key, guchar value); +-//extern f_notify_notification_set_hint_byte notify_notification_set_hint_byte; +- +-//using f_notify_notification_set_hint_byte_array = void (*)(NotifyNotification *notification, const char *key, const guchar *value, gsize len); +-//extern f_notify_notification_set_hint_byte_array notify_notification_set_hint_byte_array; +- +-//using f_notify_notification_clear_hints = void (*)(NotifyNotification *notification); +-//extern f_notify_notification_clear_hints notify_notification_clear_hints; +- +-using f_notify_notification_add_action = void (*)(NotifyNotification *notification, const char *action, const char *label, NotifyActionCallback callback, gpointer user_data, GFreeFunc free_func); +-extern f_notify_notification_add_action notify_notification_add_action; +- +-using f_notify_notification_clear_actions = void (*)(NotifyNotification *notification); +-extern f_notify_notification_clear_actions notify_notification_clear_actions; +- +-using f_notify_notification_close = gboolean (*)(NotifyNotification *notification, GError **error); +-extern f_notify_notification_close notify_notification_close; +- +-using f_notify_notification_get_closed_reason = gint (*)(const NotifyNotification *notification); +-extern f_notify_notification_get_closed_reason notify_notification_get_closed_reason; +- +-} // namespace Libs +-} // namespace Platform +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION +diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp +index 5071d63d1..d60734e7c 100644 +--- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp ++++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp +@@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #include "platform/linux/linux_libs.h" + + #include "platform/linux/linux_gdk_helper.h" +-#include "platform/linux/linux_libnotify.h" + #include "platform/linux/linux_desktop_environment.h" + + #include <QtGui/QGuiApplication> +@@ -290,10 +289,6 @@ void start() { + } else { + LOG(("Could not load gtk-x11-2.0!")); + } +- +- if (gtkLoaded) { +- startLibNotify(); +- } + #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION + } + +diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +index d076b90f3..13c9d20aa 100644 +--- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +@@ -264,13 +264,6 @@ void MainWindow::psSetupTrayIcon() { + } + trayIcon->setIcon(icon); + +- // This is very important for native notifications via libnotify! +- // Some notification servers compose several notifications with a "Reply" +- // action into one and after that a click on "Reply" button does not call +- // the specified callback from any of the sent notification - libnotify +- // just ignores ibus messages, but Qt tray icon at least emits this signal. +- connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray())); +- + attachToTrayIcon(trayIcon); + } + updateIconCounters(); +diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +index 9b0dc1d65..211abf9fc 100644 +--- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +@@ -7,389 +7,244 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ + #include "platform/linux/notifications_manager_linux.h" + +-#include "window/notifications_utilities.h" +-#include "platform/linux/linux_libnotify.h" +-#include "platform/linux/linux_libs.h" + #include "history/history.h" + #include "lang/lang_keys.h" + #include "facades.h" + ++#include <QtCore/QBuffer> ++#include <QtDBus/QDBusConnection> ++#include <QtDBus/QDBusReply> ++ + namespace Platform { + namespace Notifications { +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +-namespace { +- +-bool LibNotifyLoaded() { +- return (Libs::notify_init != nullptr) +- && (Libs::notify_uninit != nullptr) +- && (Libs::notify_is_initted != nullptr) +-// && (Libs::notify_get_app_name != nullptr) +-// && (Libs::notify_set_app_name != nullptr) +- && (Libs::notify_get_server_caps != nullptr) +- && (Libs::notify_get_server_info != nullptr) +- && (Libs::notify_notification_new != nullptr) +-// && (Libs::notify_notification_update != nullptr) +- && (Libs::notify_notification_show != nullptr) +-// && (Libs::notify_notification_set_app_name != nullptr) +- && (Libs::notify_notification_set_timeout != nullptr) +-// && (Libs::notify_notification_set_category != nullptr) +-// && (Libs::notify_notification_set_urgency != nullptr) +-// && (Libs::notify_notification_set_icon_from_pixbuf != nullptr) +- && (Libs::notify_notification_set_image_from_pixbuf != nullptr) +-// && (Libs::notify_notification_set_hint != nullptr) +-// && (Libs::notify_notification_set_hint_int32 != nullptr) +-// && (Libs::notify_notification_set_hint_uint32 != nullptr) +-// && (Libs::notify_notification_set_hint_double != nullptr) +- && (Libs::notify_notification_set_hint_string != nullptr) +-// && (Libs::notify_notification_set_hint_byte != nullptr) +-// && (Libs::notify_notification_set_hint_byte_array != nullptr) +-// && (Libs::notify_notification_clear_hints != nullptr) +- && (Libs::notify_notification_add_action != nullptr) +- && (Libs::notify_notification_clear_actions != nullptr) +- && (Libs::notify_notification_close != nullptr) +- && (Libs::notify_notification_get_closed_reason != nullptr) +- && (Libs::g_object_ref_sink != nullptr) +- && (Libs::g_object_unref != nullptr) +- && (Libs::g_list_free_full != nullptr) +- && (Libs::g_error_free != nullptr) +- && (Libs::g_signal_connect_data != nullptr) +- && (Libs::g_signal_handler_disconnect != nullptr) +-// && (Libs::gdk_pixbuf_new_from_data != nullptr) +- && (Libs::gdk_pixbuf_new_from_file != nullptr); +-} +- +-QString escapeHtml(const QString &text) { +- auto result = QString(); +- auto copyFrom = 0, textSize = text.size(); +- auto data = text.constData(); +- for (auto i = 0; i != textSize; ++i) { +- auto ch = data[i]; +- if (ch == '<' || ch == '>' || ch == '&') { +- if (!copyFrom) { +- result.reserve(textSize * 5); +- } +- if (i > copyFrom) { +- result.append(data + copyFrom, i - copyFrom); +- } +- switch (ch.unicode()) { +- case '<': result.append(qstr("<")); break; +- case '>': result.append(qstr(">")); break; +- case '&': result.append(qstr("&")); break; +- } +- copyFrom = i + 1; +- } +- } +- if (copyFrom > 0) { +- result.append(data + copyFrom, textSize - copyFrom); +- return result; +- } +- return text; +-} + +-class NotificationData { +-public: +- NotificationData(const std::shared_ptr<Manager*> &guarded, const QString &title, const QString &body, const QStringList &capabilities, PeerId peerId, MsgId msgId) +- : _data(Libs::notify_notification_new(title.toUtf8().constData(), body.toUtf8().constData(), nullptr)) { +- if (valid()) { +- init(guarded, capabilities, peerId, msgId); +- } +- } +- bool valid() const { +- return (_data != nullptr); +- } +- NotificationData(const NotificationData &other) = delete; +- NotificationData &operator=(const NotificationData &other) = delete; +- NotificationData(NotificationData &&other) = delete; +- NotificationData &operator=(NotificationData &&other) = delete; +- +- void setImage(const QString &imagePath) { +- auto imagePathNative = QFile::encodeName(imagePath); +- if (auto pixbuf = Libs::gdk_pixbuf_new_from_file(imagePathNative.constData(), nullptr)) { +- Libs::notify_notification_set_image_from_pixbuf(_data, pixbuf); +- Libs::g_object_unref(Libs::g_object_cast(pixbuf)); +- } +- } +- bool show() { +- if (valid()) { +- GError *error = nullptr; ++constexpr auto kService = str_const("org.freedesktop.Notifications"); ++constexpr auto kObjectPath = str_const("/org/freedesktop/Notifications"); ++constexpr auto kInterface = kService; + +- Libs::notify_notification_show(_data, &error); +- if (!error) { +- return true; +- } ++NotificationData::NotificationData(const std::shared_ptr<Manager*> &guarded, const QString &title, const QString &subtitle, const QString &msg, PeerId peerId, MsgId msgId) ++: _notificationInterface(str_const_toString(kService), str_const_toString(kObjectPath), str_const_toString(kInterface)) ++, _specificationVersion(parseSpecificationVersion(getServerInformation())) ++, _weak(guarded) ++, _title(title) ++, _peerId(peerId) ++, _msgId(msgId) { ++ auto capabilities = getCapabilities(); ++ auto capabilitiesEnd = capabilities.end(); + +- logError(error); +- } +- return false; ++ if (!_specificationVersion.isNull()) { ++ DEBUG_LOG(("Notification daemon specification version: %1").arg(_specificationVersion.toString())); + } + +- bool close() { +- if (valid()) { +- GError *error = nullptr; +- Libs::notify_notification_close(_data, &error); +- if (!error) { +- return true; ++ if (!capabilities.empty()) { ++ QString capabilitiesString; ++ ++ for (const auto &capability : capabilities) { ++ if (!capabilitiesString.isEmpty()) { ++ capabilitiesString += qstr(", "); + } + +- logError(error); ++ capabilitiesString += capability; + } +- return false; +- } + +- ~NotificationData() { +- if (valid()) { +-// if (_handlerId > 0) { +-// Libs::g_signal_handler_disconnect(Libs::g_object_cast(_data), _handlerId); +-// } +-// Libs::notify_notification_clear_actions(_data); +- Libs::g_object_unref(Libs::g_object_cast(_data)); +- } ++ DEBUG_LOG(("Notification daemon capabilities: %1").arg(capabilitiesString)); + } + +-private: +- void init(const std::shared_ptr<Manager*> &guarded, const QStringList &capabilities, PeerId peerId, MsgId msgId) { +- if (capabilities.contains(qsl("append"))) { +- Libs::notify_notification_set_hint_string(_data, "append", "true"); +- } else if (capabilities.contains(qsl("x-canonical-append"))) { +- Libs::notify_notification_set_hint_string(_data, "x-canonical-append", "true"); +- } ++ if (ranges::find(capabilities, qsl("body-markup")) != capabilitiesEnd) { ++ _body = subtitle.isEmpty() ++ ? msg.toHtmlEscaped() ++ : qsl("<b>%1</b>\n%2").arg(subtitle.toHtmlEscaped()).arg(msg.toHtmlEscaped()); ++ } else { ++ _body = subtitle.isEmpty() ++ ? msg ++ : qsl("%1\n%2").arg(subtitle).arg(msg); ++ } + +- Libs::notify_notification_set_hint_string(_data, "desktop-entry", "kotatogramdesktop"); +- +- auto signalReceiver = Libs::g_object_cast(_data); +- auto signalHandler = G_CALLBACK(NotificationData::notificationClosed); +- auto signalName = "closed"; +- auto signalDataFreeMethod = &NotificationData::notificationDataFreeClosure; +- auto signalData = new NotificationDataStruct(guarded, peerId, msgId); +- _handlerId = Libs::g_signal_connect_helper(signalReceiver, signalName, signalHandler, signalData, signalDataFreeMethod); +- +- Libs::notify_notification_set_timeout(_data, Libs::NOTIFY_EXPIRES_DEFAULT); +- +- if ((*guarded)->hasActionsSupport()) { +- auto label = tr::lng_notification_reply(tr::now).toUtf8(); +- auto actionReceiver = _data; +- auto actionHandler = &NotificationData::notificationClicked; +- auto actionLabel = label.constData(); +- auto actionName = "default"; +- auto actionDataFreeMethod = &NotificationData::notificationDataFree; +- auto actionData = new NotificationDataStruct(guarded, peerId, msgId); +- Libs::notify_notification_add_action(actionReceiver, actionName, actionLabel, actionHandler, actionData, actionDataFreeMethod); +- } ++ if (ranges::find(capabilities, qsl("actions")) != capabilitiesEnd) { ++ // icon name according to https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html ++ _actions << "mail-reply-sender" << tr::lng_notification_reply(tr::now); ++ connect(&_notificationInterface, SIGNAL(ActionInvoked(uint, QString)), this, SLOT(notificationClicked(uint))); + } + +- void logError(GError *error) { +- LOG(("LibNotify Error: domain %1, code %2, message '%3'").arg(error->domain).arg(error->code).arg(QString::fromUtf8(error->message))); +- Libs::g_error_free(error); ++ if (ranges::find(capabilities, qsl("action-icons")) != capabilitiesEnd) { ++ _hints["action-icons"] = true; + } + +- struct NotificationDataStruct { +- NotificationDataStruct(const std::shared_ptr<Manager*> &guarded, PeerId peerId, MsgId msgId) +- : weak(guarded) +- , peerId(peerId) +- , msgId(msgId) { ++ // suppress system sound if telegram sound activated, otherwise use system sound ++ if (ranges::find(capabilities, qsl("sound")) != capabilitiesEnd) { ++ if (Global::SoundNotify()) { ++ _hints["suppress-sound"] = true; ++ } else { ++ // sound name according to http://0pointer.de/public/sound-naming-spec.html ++ _hints["sound-name"] = "message-new-instant"; + } +- +- std::weak_ptr<Manager*> weak; +- PeerId peerId = 0; +- MsgId msgId = 0; +- }; +- static void performOnMainQueue(NotificationDataStruct *data, FnMut<void(Manager *manager)> task) { +- const auto weak = data->weak; +- crl::on_main(weak, [=, task = std::move(task)]() mutable { +- task(*weak.lock()); +- }); +- } +- static void notificationDataFree(gpointer data) { +- auto notificationData = static_cast<NotificationDataStruct*>(data); +- delete notificationData; +- } +- static void notificationDataFreeClosure(gpointer data, GClosure *closure) { +- auto notificationData = static_cast<NotificationDataStruct*>(data); +- delete notificationData; +- } +- static void notificationClosed(Libs::NotifyNotification *notification, gpointer data) { +- auto closedReason = Libs::notify_notification_get_closed_reason(notification); +- auto notificationData = static_cast<NotificationDataStruct*>(data); +- performOnMainQueue(notificationData, [peerId = notificationData->peerId, msgId = notificationData->msgId](Manager *manager) { +- manager->clearNotification(peerId, msgId); +- }); +- } +- static void notificationClicked(Libs::NotifyNotification *notification, char *action, gpointer data) { +- auto notificationData = static_cast<NotificationDataStruct*>(data); +- performOnMainQueue(notificationData, [peerId = notificationData->peerId, msgId = notificationData->msgId](Manager *manager) { +- manager->notificationActivated(peerId, msgId); +- }); + } + +- Libs::NotifyNotification *_data = nullptr; +- gulong _handlerId = 0; ++ if (ranges::find(capabilities, qsl("x-canonical-append")) != capabilitiesEnd) { ++ _hints["x-canonical-append"] = "true"; ++ } + +-}; ++ _hints["category"] = "im.received"; ++ _hints["desktop-entry"] = "kotatogramdesktop"; + +-using Notification = std::shared_ptr<NotificationData>; ++ connect(&_notificationInterface, SIGNAL(NotificationClosed(uint, uint)), this, SLOT(notificationClosed(uint))); ++} + +-QString GetServerName() { +- if (!LibNotifyLoaded()) { +- return QString(); +- } +- if (!Libs::notify_is_initted() && !Libs::notify_init("Kotatogram Desktop")) { +- LOG(("LibNotify Error: failed to init!")); +- return QString(); +- } ++bool NotificationData::show() { ++ QDBusReply<uint> notifyReply = _notificationInterface.call("Notify", str_const_toString(AppName), uint(0), "kotatogram", _title, _body, _actions, _hints, -1); + +- gchar *name = nullptr; +- auto guard = gsl::finally([&name] { +- if (name) Libs::g_free(name); +- }); +- +- if (!Libs::notify_get_server_info(&name, nullptr, nullptr, nullptr)) { +- LOG(("LibNotify Error: could not get server name!")); +- return QString(); +- } +- if (!name) { +- LOG(("LibNotify Error: successfully got empty server name!")); +- return QString(); ++ if (notifyReply.isValid()) { ++ _notificationId = notifyReply.value(); ++ } else { ++ LOG(("Native notification error: %1").arg(notifyReply.error().message())); + } + +- auto result = QString::fromUtf8(static_cast<const char*>(name)); +- LOG(("Notifications Server: %1").arg(result)); +- +- return result; ++ return notifyReply.isValid(); + } + +-auto LibNotifyServerName = QString(); ++bool NotificationData::close() { ++ QDBusReply<void> closeReply = _notificationInterface.call("CloseNotification", _notificationId); + +-} // namespace +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION +- +-bool Supported() { +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +- static auto Checked = false; +- if (!Checked) { +- Checked = true; +- LibNotifyServerName = GetServerName(); ++ if (!closeReply.isValid()) { ++ LOG(("Native notification error: %1").arg(closeReply.error().message())); + } + +- return !LibNotifyServerName.isEmpty(); +-#else +- return false; +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION ++ return closeReply.isValid(); + } + +-std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::System *system) { +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +- if (Global::NativeNotifications() && Supported()) { +- return std::make_unique<Manager>(system); +- } +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION +- return nullptr; +-} ++void NotificationData::setImage(const QString &imagePath) { ++ QString imageKey; + +-void Finish() { +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +- if (Libs::notify_is_initted && Libs::notify_uninit) { +- if (Libs::notify_is_initted()) { +- Libs::notify_uninit(); ++ if (!_specificationVersion.isNull()) { ++ const auto majorVersion = _specificationVersion.majorVersion(); ++ const auto minorVersion = _specificationVersion.majorVersion(); ++ ++ if ((majorVersion == 1 && minorVersion >= 2) || majorVersion > 1) { ++ imageKey = "image-data"; ++ } else if (majorVersion == 1 && minorVersion) { ++ imageKey = "image_data"; ++ } else if ((majorVersion == 1 && minorVersion < 1) || majorVersion < 1) { ++ imageKey = "icon_data"; ++ } else { ++ LOG(("Native notification error: unknown specification version")); ++ return; + } ++ } else { ++ LOG(("Native notification error: specification version is null")); ++ return; + } +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION +-} + +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +-class Manager::Private { +-public: +- using Type = Window::Notifications::CachedUserpics::Type; +- explicit Private(Type type) +- : _cachedUserpics(type) { +- } ++ auto image = QImage(imagePath).convertToFormat(QImage::Format_RGBA8888); ++ QByteArray imageBytes((const char*)image.constBits(), image.sizeInBytes()); + +- void init(Manager *manager); ++ ImageData imageData; ++ imageData.width = image.width(); ++ imageData.height = image.height(); ++ imageData.rowStride = image.bytesPerLine(); ++ imageData.hasAlpha = true; ++ imageData.bitsPerSample = 8; ++ imageData.channels = 4; ++ imageData.data = imageBytes; + +- void showNotification( +- not_null<PeerData*> peer, +- MsgId msgId, +- const QString &title, +- const QString &subtitle, +- const QString &msg, +- bool hideNameAndPhoto, +- bool hideReplyButton); +- void clearAll(); +- void clearFromHistory(not_null<History*> history); +- void clearNotification(PeerId peerId, MsgId msgId); ++ _hints[imageKey] = QVariant::fromValue(imageData); ++} + +- bool hasPoorSupport() const { +- return _poorSupported; +- } +- bool hasActionsSupport() const { +- return _actionsSupported; ++std::vector<QString> NotificationData::getServerInformation() { ++ std::vector<QString> serverInformation; ++ auto serverInformationReply = _notificationInterface.call("GetServerInformation"); ++ ++ if (serverInformationReply.type() == QDBusMessage::ReplyMessage) { ++ for (const auto &arg : serverInformationReply.arguments()) { ++ if (static_cast<QMetaType::Type>(arg.type()) == QMetaType::QString) { ++ serverInformation.push_back(arg.toString()); ++ } else { ++ LOG(("Native notification error: all elements in GetServerInformation should be strings")); ++ } ++ } ++ } else if (serverInformationReply.type() == QDBusMessage::ErrorMessage) { ++ LOG(("Native notification error: %1").arg(QDBusError(serverInformationReply).message())); ++ } else { ++ LOG(("Native notification error: error while getting information about notification daemon")); + } + +- ~Private(); ++ return serverInformation; ++} + +-private: +- QString escapeNotificationText(const QString &text) const; +- void showNextNotification(); ++std::vector<QString> NotificationData::getCapabilities() { ++ QDBusReply<QStringList> capabilitiesReply = _notificationInterface.call("GetCapabilities"); + +- struct QueuedNotification { +- PeerData *peer = nullptr; +- MsgId msgId = 0; +- QString title; +- QString body; +- bool hideNameAndPhoto = false; +- }; ++ if (capabilitiesReply.isValid()) { ++ return capabilitiesReply.value().toVector().toStdVector(); ++ } else { ++ LOG(("Native notification error: %1").arg(capabilitiesReply.error().message())); ++ } + +- QString _serverName; +- QStringList _capabilities; ++ return std::vector<QString>(); ++} + +- using QueuedNotifications = QList<QueuedNotification>; +- QueuedNotifications _queuedNotifications; ++QVersionNumber NotificationData::parseSpecificationVersion(const std::vector<QString> &serverInformation) { ++ if (serverInformation.size() >= 4) { ++ return QVersionNumber::fromString(serverInformation[3]); ++ } else { ++ LOG(("Native notification error: server information should have 4 elements")); ++ } + +- using Notifications = QMap<PeerId, QMap<MsgId, Notification>>; +- Notifications _notifications; ++ return QVersionNumber(); ++} + +- Window::Notifications::CachedUserpics _cachedUserpics; +- bool _actionsSupported = false; +- bool _markupSupported = false; +- bool _poorSupported = false; ++void NotificationData::performOnMainQueue(FnMut<void(Manager *manager)> task) { ++ const auto weak = _weak; ++ crl::on_main(weak, [=, task = std::move(task)]() mutable { ++ task(*weak.lock()); ++ }); ++} + +- std::shared_ptr<Manager*> _guarded; ++void NotificationData::notificationClosed(uint id) { ++ if (id == _notificationId) { ++ performOnMainQueue([peerId = _peerId, msgId = _msgId](Manager *manager) { ++ manager->clearNotification(peerId, msgId); ++ }); ++ } ++} + +-}; +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION ++void NotificationData::notificationClicked(uint id) { ++ if (id == _notificationId) { ++ performOnMainQueue([peerId = _peerId, msgId = _msgId](Manager *manager) { ++ manager->notificationActivated(peerId, msgId); ++ }); ++ } ++} + +-#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +-void Manager::Private::init(Manager *manager) { +- _guarded = std::make_shared<Manager*>(manager); ++QDBusArgument &operator<<(QDBusArgument &argument, const NotificationData::ImageData &imageData) { ++ argument.beginStructure(); ++ argument << imageData.width << imageData.height << imageData.rowStride << imageData.hasAlpha << imageData.bitsPerSample << imageData.channels << imageData.data; ++ argument.endStructure(); ++ return argument; ++} + +- if (auto capabilities = Libs::notify_get_server_caps()) { +- for (auto capability = capabilities; capability; capability = capability->next) { +- auto capabilityText = QString::fromUtf8(static_cast<const char*>(capability->data)); +- _capabilities.push_back(capabilityText); +- } +- Libs::g_list_free_full(capabilities, g_free); ++const QDBusArgument &operator>>(const QDBusArgument &argument, NotificationData::ImageData &imageData) { ++ argument.beginStructure(); ++ argument >> imageData.width >> imageData.height >> imageData.rowStride >> imageData.hasAlpha >> imageData.bitsPerSample >> imageData.channels >> imageData.data;; ++ argument.endStructure(); ++ return argument; ++} + +- LOG(("LibNotify capabilities: %1").arg(_capabilities.join(qstr(", ")))); +- if (_capabilities.contains(qsl("actions"))) { +- _actionsSupported = true; +- } else if (_capabilities.contains(qsl("body-markup"))) { +- _markupSupported = true; +- } +- } else { +- LOG(("LibNotify Error: could not get capabilities!")); ++auto NotificationDaemonRunning = false; ++bool Supported() { ++ static auto Checked = false; ++ if (!Checked) { ++ Checked = true; ++ NotificationDaemonRunning = QDBusInterface(str_const_toString(kService), str_const_toString(kObjectPath), str_const_toString(kInterface)).isValid(); + } + +- // Unity and other Notify OSD users handle desktop notifications +- // extremely poor, even without the ability to close() them. +- _serverName = LibNotifyServerName; +- Assert(!_serverName.isEmpty()); +- if (_serverName == qstr("notify-osd")) { +-// _poorSupported = true; +- _actionsSupported = false; +- } ++ return NotificationDaemonRunning; + } + +-QString Manager::Private::escapeNotificationText(const QString &text) const { +- return _markupSupported ? escapeHtml(text) : text; ++std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::System *system) { ++ if (Global::NativeNotifications() && Supported()) { ++ return std::make_unique<Manager>(system); ++ } ++ return nullptr; + } + + void Manager::Private::showNotification( +@@ -400,93 +255,43 @@ void Manager::Private::showNotification( + const QString &msg, + bool hideNameAndPhoto, + bool hideReplyButton) { +- auto titleText = escapeNotificationText(title); +- auto subtitleText = escapeNotificationText(subtitle); +- auto msgText = escapeNotificationText(msg); +- if (_markupSupported && !subtitleText.isEmpty()) { +- subtitleText = qstr("<b>") + subtitleText + qstr("</b>"); +- } +- auto bodyText = subtitleText.isEmpty() ? msgText : (subtitleText + '\n' + msgText); +- +- QueuedNotification notification; +- notification.peer = peer; +- notification.msgId = msgId; +- notification.title = titleText; +- notification.body = bodyText; +- notification.hideNameAndPhoto = hideNameAndPhoto; +- _queuedNotifications.push_back(notification); +- +- showNextNotification(); +-} +- +-void Manager::Private::showNextNotification() { +- // Show only one notification at a time in Unity / Notify OSD. +- if (_poorSupported) { +- for (auto b = _notifications.begin(); !_notifications.isEmpty() && b->isEmpty();) { +- _notifications.erase(b); +- } +- if (!_notifications.isEmpty()) { +- return; +- } +- } +- +- QueuedNotification data; +- while (!_queuedNotifications.isEmpty()) { +- data = _queuedNotifications.front(); +- _queuedNotifications.pop_front(); +- if (data.peer) { +- break; +- } +- } +- if (!data.peer) { +- return; +- } +- +- auto peerId = data.peer->id; +- auto msgId = data.msgId; + auto notification = std::make_shared<NotificationData>( + _guarded, +- data.title, +- data.body, +- _capabilities, +- peerId, ++ title, ++ subtitle, ++ msg, ++ peer->id, + msgId); +- if (!notification->valid()) { +- return; +- } + +- const auto key = data.hideNameAndPhoto ++ const auto key = hideNameAndPhoto + ? InMemoryKey() +- : data.peer->userpicUniqueKey(); +- notification->setImage(_cachedUserpics.get(key, data.peer)); ++ :peer->userpicUniqueKey(); ++ notification->setImage(_cachedUserpics.get(key, peer)); + +- auto i = _notifications.find(peerId); ++ auto i = _notifications.find(peer->id); + if (i != _notifications.cend()) { + auto j = i->find(msgId); + if (j != i->cend()) { + auto oldNotification = j.value(); + i->erase(j); + oldNotification->close(); +- i = _notifications.find(peerId); ++ i = _notifications.find(peer->id); + } + } + if (i == _notifications.cend()) { +- i = _notifications.insert(peerId, QMap<MsgId, Notification>()); ++ i = _notifications.insert(peer->id, QMap<MsgId, Notification>()); + } +- _notifications[peerId].insert(msgId, notification); ++ _notifications[peer->id].insert(msgId, notification); + if (!notification->show()) { +- i = _notifications.find(peerId); ++ i = _notifications.find(peer->id); + if (i != _notifications.cend()) { + i->remove(msgId); + if (i->isEmpty()) _notifications.erase(i); + } +- showNextNotification(); + } + } + + void Manager::Private::clearAll() { +- _queuedNotifications.clear(); +- + auto temp = base::take(_notifications); + for_const (auto ¬ifications, temp) { + for_const (auto notification, notifications) { +@@ -496,14 +301,6 @@ void Manager::Private::clearAll() { + } + + void Manager::Private::clearFromHistory(not_null<History*> history) { +- for (auto i = _queuedNotifications.begin(); i != _queuedNotifications.end();) { +- if (i->peer == history->peer) { +- i = _queuedNotifications.erase(i); +- } else { +- ++i; +- } +- } +- + auto i = _notifications.find(history->peer->id); + if (i != _notifications.cend()) { + auto temp = base::take(i.value()); +@@ -513,8 +310,6 @@ void Manager::Private::clearFromHistory(not_null<History*> history) { + notification->close(); + } + } +- +- showNextNotification(); + } + + void Manager::Private::clearNotification(PeerId peerId, MsgId msgId) { +@@ -525,8 +320,6 @@ void Manager::Private::clearNotification(PeerId peerId, MsgId msgId) { + _notifications.erase(i); + } + } +- +- showNextNotification(); + } + + Manager::Private::~Private() { +@@ -534,22 +327,13 @@ Manager::Private::~Private() { + } + + Manager::Manager(Window::Notifications::System *system) : NativeManager(system) +-, _private(std::make_unique<Private>(Private::Type::Rounded)) { +- _private->init(this); ++, _private(std::make_unique<Private>(this, Private::Type::Rounded)) { + } + + void Manager::clearNotification(PeerId peerId, MsgId msgId) { + _private->clearNotification(peerId, msgId); + } + +-bool Manager::hasPoorSupport() const { +- return _private->hasPoorSupport(); +-} +- +-bool Manager::hasActionsSupport() const { +- return _private->hasActionsSupport(); +-} +- + Manager::~Manager() = default; + + void Manager::doShowNativeNotification( +@@ -577,7 +361,6 @@ void Manager::doClearAllFast() { + void Manager::doClearFromHistory(not_null<History*> history) { + _private->clearFromHistory(history); + } +-#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION + + } // namespace Notifications + } // namespace Platform +diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h +index f40204a56..1f87dbe28 100644 +--- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h ++++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h +@@ -8,6 +8,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #pragma once + + #include "platform/platform_notifications_manager.h" ++#include "window/notifications_utilities.h" ++ ++#include <QtDBus/QDBusInterface> ++#include <QtDBus/QDBusArgument> ++#include <QtDBus/QDBusMetaType> + + namespace Platform { + namespace Notifications { +@@ -23,16 +28,62 @@ inline bool SkipToast() { + inline void FlashBounce() { + } + +-void Finish(); ++class NotificationData : public QObject { ++ Q_OBJECT ++ ++public: ++ NotificationData(const std::shared_ptr<Manager*> &guarded, const QString &title, const QString &subtitle, const QString &msg, PeerId peerId, MsgId msgId); ++ ++ NotificationData(const NotificationData &other) = delete; ++ NotificationData &operator=(const NotificationData &other) = delete; ++ NotificationData(NotificationData &&other) = delete; ++ NotificationData &operator=(NotificationData &&other) = delete; ++ ++ bool show(); ++ bool close(); ++ void setImage(const QString &imagePath); ++ ++ struct ImageData { ++ int width, height, rowStride; ++ bool hasAlpha; ++ int bitsPerSample, channels; ++ QByteArray data; ++ }; ++ ++private: ++ QDBusInterface _notificationInterface; ++ QVersionNumber _specificationVersion; ++ std::weak_ptr<Manager*> _weak; ++ ++ QString _title; ++ QString _body; ++ QStringList _actions; ++ QVariantMap _hints; ++ ++ uint _notificationId; ++ PeerId _peerId; ++ MsgId _msgId; ++ ++ std::vector<QString> getServerInformation(); ++ std::vector<QString> getCapabilities(); ++ QVersionNumber parseSpecificationVersion(const std::vector<QString> &serverInformation); ++ ++ void performOnMainQueue(FnMut<void(Manager *manager)> task); ++ ++private slots: ++ void notificationClosed(uint id); ++ void notificationClicked(uint id); ++}; ++ ++using Notification = std::shared_ptr<NotificationData>; ++ ++QDBusArgument &operator<<(QDBusArgument &argument, const NotificationData::ImageData &imageData); ++const QDBusArgument &operator>>(const QDBusArgument &argument, NotificationData::ImageData &imageData); + + class Manager : public Window::Notifications::NativeManager { + public: + Manager(Window::Notifications::System *system); +- + void clearNotification(PeerId peerId, MsgId msgId); +- bool hasPoorSupport() const; +- bool hasActionsSupport() const; +- + ~Manager(); + + protected: +@@ -53,5 +104,38 @@ private: + + }; + ++class Manager::Private { ++public: ++ using Type = Window::Notifications::CachedUserpics::Type; ++ explicit Private(Manager *manager, Type type) ++ : _cachedUserpics(type) ++ , _guarded(std::make_shared<Manager*>(manager)) { ++ qDBusRegisterMetaType<NotificationData::ImageData>(); ++ } ++ ++ void showNotification( ++ not_null<PeerData*> peer, ++ MsgId msgId, ++ const QString &title, ++ const QString &subtitle, ++ const QString &msg, ++ bool hideNameAndPhoto, ++ bool hideReplyButton); ++ void clearAll(); ++ void clearFromHistory(not_null<History*> history); ++ void clearNotification(PeerId peerId, MsgId msgId); ++ ++ ~Private(); ++ ++private: ++ using Notifications = QMap<PeerId, QMap<MsgId, Notification>>; ++ Notifications _notifications; ++ ++ Window::Notifications::CachedUserpics _cachedUserpics; ++ std::shared_ptr<Manager*> _guarded; ++}; ++ + } // namespace Notifications + } // namespace Platform ++ ++Q_DECLARE_METATYPE(Platform::Notifications::NotificationData::ImageData) +diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +index 68d07a55b..cc70426a1 100644 +--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +@@ -229,7 +229,6 @@ void start() { + } + + void finish() { +- Notifications::Finish(); + } + + void RegisterCustomScheme() { +diff --git a/Telegram/gyp/telegram/sources.txt b/Telegram/gyp/telegram/sources.txt +index e3ccb66db..1977e6f2f 100644 +--- a/Telegram/gyp/telegram/sources.txt ++++ b/Telegram/gyp/telegram/sources.txt +@@ -605,8 +605,6 @@ + <(src_loc)/platform/linux/linux_desktop_environment.h + <(src_loc)/platform/linux/linux_gdk_helper.cpp + <(src_loc)/platform/linux/linux_gdk_helper.h +-<(src_loc)/platform/linux/linux_libnotify.cpp +-<(src_loc)/platform/linux/linux_libnotify.h + <(src_loc)/platform/linux/linux_libs.cpp + <(src_loc)/platform/linux/linux_libs.h + <(src_loc)/platform/linux/file_utilities_linux.cpp diff --git a/Use-native-notifications-by-default.patch b/Use-native-notifications-by-default.patch new file mode 100644 index 000000000000..4fe8f2ee3eec --- /dev/null +++ b/Use-native-notifications-by-default.patch @@ -0,0 +1,13 @@ +diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp +index 7f1a9505b..9500a37ba 100644 +--- a/Telegram/SourceFiles/facades.cpp ++++ b/Telegram/SourceFiles/facades.cpp +@@ -378,7 +378,7 @@ struct Data { + bool DesktopNotify = true; + bool RestoreSoundNotifyFromTray = false; + DBINotifyView NotifyView = dbinvShowPreview; +- bool NativeNotifications = false; ++ bool NativeNotifications = Platform::IsLinux(); + int NotificationsCount = 3; + Notify::ScreenCorner NotificationsCorner = Notify::ScreenCorner::BottomRight; + bool NotificationsDemoIsShown = false; diff --git a/Use-system-wide-font.patch b/Use-system-wide-font.patch new file mode 100644 index 000000000000..a90ebcd3a470 --- /dev/null +++ b/Use-system-wide-font.patch @@ -0,0 +1,100 @@ +Submodule Telegram/lib_ui contains modified content +diff --git a/Telegram/lib_ui/gyp/qrc_rule.gypi b/Telegram/lib_ui/gyp/qrc_rule.gypi +index eb4654c..f22d752 100644 +--- a/Telegram/lib_ui/gyp/qrc_rule.gypi ++++ b/Telegram/lib_ui/gyp/qrc_rule.gypi +@@ -5,11 +5,6 @@ + # https://github.com/desktop-app/legal/blob/master/LEGAL + + { +- 'variables': { +- 'qrc_files': [ +- '<(submodules_loc)/lib_ui/fonts/fonts.qrc', +- ], +- }, + 'conditions': [ + [ 'build_linux', { + 'variables': { +diff --git a/Telegram/lib_ui/ui/style/style_core_font.cpp b/Telegram/lib_ui/ui/style/style_core_font.cpp +index ad3a9e3..bf3d89f 100644 +--- a/Telegram/lib_ui/ui/style/style_core_font.cpp ++++ b/Telegram/lib_ui/ui/style/style_core_font.cpp +@@ -15,7 +15,6 @@ + #include <QtGui/QFontDatabase> + + void style_InitFontsResource() { +- Q_INIT_RESOURCE(fonts); + #ifdef Q_OS_WIN + Q_INIT_RESOURCE(win); + #elif defined Q_OS_MAC // Q_OS_WIN +@@ -93,14 +92,6 @@ enum { + + FontTypesCount, + }; +-QString FontTypeNames[FontTypesCount] = { +- "DAOpenSansRegular", +- "DAOpenSansRegularItalic", +- "DAOpenSansBold", +- "DAOpenSansBoldItalic", +- "DAOpenSansSemibold", +- "DAOpenSansSemiboldItalic", +-}; + int32 FontTypeFlags[FontTypesCount] = { + 0, + FontItalic, +@@ -109,14 +100,6 @@ int32 FontTypeFlags[FontTypesCount] = { + 0, + FontItalic, + }; +-QString FontTypeWindowsFallback[FontTypesCount] = { +- "Segoe UI", +- "Segoe UI", +- "Segoe UI", +- "Segoe UI", +- "Segoe UI Semibold", +- "Segoe UI Semibold", +-}; + + bool Started = false; + QString Overrides[FontTypesCount]; +@@ -147,40 +130,6 @@ void StartFonts() { + + style_InitFontsResource(); + +- bool areGood[FontTypesCount] = { false }; +- for (auto i = 0; i != FontTypesCount; ++i) { +- const auto name = FontTypeNames[i]; +- const auto flags = FontTypeFlags[i]; +- areGood[i] = LoadCustomFont(":/gui/fonts/" + name + ".ttf", name, flags); +- Overrides[i] = name; +-#ifdef Q_OS_WIN +- // Attempt to workaround a strange font bug with Open Sans Semibold not loading. +- // See https://github.com/telegramdesktop/tdesktop/issues/3276 for details. +- // Crash happens on "options.maxh / _t->_st->font->height" with "division by zero". +- // In that place "_t->_st->font" is "semiboldFont" is "font(13 "Open Sans Semibold"). +- const auto fallback = FontTypeWindowsFallback[i]; +- if (!areGood[i]) { +- if (ValidateFont(fallback, flags)) { +- Overrides[i] = fallback; +- UI_LOG(("Fonts Info: Using '%1' instead of '%2'.").arg(fallback).arg(name)); +- } +- } +- // Disable default fallbacks to Segoe UI, see: +- // https://github.com/telegramdesktop/tdesktop/issues/5368 +- // +- //QFont::insertSubstitution(name, fallback); +-#endif // Q_OS_WIN +- } +-#ifdef Q_OS_MAC +- auto list = QStringList(); +- list.append(".SF NS Text"); +- list.append("Helvetica Neue"); +- list.append("Lucida Grande"); +- for (const auto &name : FontTypeNames) { +- QFont::insertSubstitutions(name, list); +- } +-#endif // Q_OS_MAC +- + if (!CustomMainFont.isEmpty() && ValidateFont(CustomMainFont)) { + Overrides[FontTypeRegular] = CustomMainFont; + Overrides[FontTypeRegularItalic] = CustomMainFont; diff --git a/linux-autostart.patch b/linux-autostart.patch new file mode 100644 index 000000000000..18044a2d2f7c --- /dev/null +++ b/linux-autostart.patch @@ -0,0 +1,89 @@ +diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +index 68d07a55b..a967950f7 100644 +--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +@@ -393,6 +393,48 @@ bool psShowOpenWithMenu(int x, int y, const QString &file) { + } + + void psAutoStart(bool start, bool silent) { ++ auto home = getHomeDir(); ++ if (home.isEmpty() || cAlphaVersion() || cExeName().isEmpty()) return; ++ ++ if(start) { ++ DEBUG_LOG(("App Info: placing autostart .desktop file")); ++ if (QDir(home + qsl(".config/")).exists()) { ++ QString autostart = home + qsl(".config/autostart/"); ++ if (!QDir(autostart).exists()) QDir().mkpath(autostart); ++ ++ QString path = cWorkingDir() + qsl("tdata/"), file = path + qsl("kotatogramdesktop.desktop"); ++ QDir().mkpath(path); ++ QFile f(file); ++ if (f.open(QIODevice::WriteOnly)) { ++ QTextStream s(&f); ++ s.setCodec("UTF-8"); ++ s << "[Desktop Entry]\n"; ++ s << "Version=1.0\n"; ++ s << "Name=" << str_const_toString(AppName) << "\n"; ++ s << "Comment=Experimental Telegram Desktop fork\n"; ++ s << "TryExec=" << EscapeShell(QFile::encodeName(cExeDir() + cExeName())) << "\n"; ++ s << "Exec=" << EscapeShell(QFile::encodeName(cExeDir() + cExeName())) << " -autostart\n"; ++ s << "Icon=kotatogram\n"; ++ s << "Terminal=false\n"; ++ s << "StartupWMClass=" << QCoreApplication::instance()->applicationName() << "\n"; ++ s << "Type=Application\n"; ++ s << "Categories=Network;InstantMessaging;Qt;\n"; ++ s << "MimeType=x-scheme-handler/tg;\n"; ++ s << "Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;\n"; ++ s << "X-GNOME-UsesNotifications=true\n"; ++ f.close(); ++ ++ ++ if (RunShellCommand("desktop-file-install --dir=" + EscapeShell(QFile::encodeName(home + qsl(".config/autostart"))) + " --delete-original " + EscapeShell(QFile::encodeName(file)))) { ++ RunShellCommand("update-desktop-database " + EscapeShell(QFile::encodeName(home + qsl(".config/autostart")))); ++ } ++ } else { ++ LOG(("App Error: Could not open '%1' for write").arg(file)); ++ } ++ } ++ } else { ++ QFile::remove(home + qsl(".config/autostart/kotatogramdesktop.desktop")); ++ } + } + + void psSendToMenu(bool send, bool silent) { +diff --git a/Telegram/SourceFiles/settings/settings_advanced.cpp b/Telegram/SourceFiles/settings/settings_advanced.cpp +index 0a41abef7..529be612e 100644 +--- a/Telegram/SourceFiles/settings/settings_advanced.cpp ++++ b/Telegram/SourceFiles/settings/settings_advanced.cpp +@@ -354,7 +354,7 @@ void SetupTrayContent(not_null<Ui::VerticalLayout*> container) { + } + + #ifndef OS_WIN_STORE +- if (Platform::IsWindows()) { ++ if (Platform::IsWindows() || Platform::IsLinux()) { + const auto minimizedToggled = [] { + return cStartMinimized() && !Global::LocalPasscode(); + }; +@@ -365,9 +365,6 @@ void SetupTrayContent(not_null<Ui::VerticalLayout*> container) { + const auto minimized = addSlidingCheckbox( + tr::lng_settings_start_min(tr::now), + minimizedToggled()); +- const auto sendto = addCheckbox( +- tr::ktg_settings_add_sendto(tr::now), +- cSendToMenu()); + + autostart->checkedChanges( + ) | rpl::filter([](bool checked) { +@@ -404,6 +401,12 @@ void SetupTrayContent(not_null<Ui::VerticalLayout*> container) { + ) | rpl::start_with_next([=] { + minimized->entity()->setChecked(minimizedToggled()); + }, minimized->lifetime()); ++ } ++ ++ if (Platform::IsWindows()) { ++ const auto sendto = addCheckbox( ++ tr::ktg_settings_add_sendto(tr::now), ++ cSendToMenu()); + + sendto->checkedChanges( + ) | rpl::filter([](bool checked) { diff --git a/system-tray-icon.patch b/system-tray-icon.patch new file mode 100644 index 000000000000..51a8e370d0ad --- /dev/null +++ b/system-tray-icon.patch @@ -0,0 +1,77 @@ +diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +index d076b90f3..7c40ecb90 100644 +--- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +@@ -42,6 +42,7 @@ int32 _trayIconSize = 22; + bool _trayIconMuted = true; + int32 _trayIconCount = 0; + QImage _trayIconImageBack, _trayIconImage; ++QString _trayIconThemeName, _trayIconName; + QString _desktopFile; + QString _dbusPath = "/"; + +@@ -83,17 +84,32 @@ QImage _trayIconImageGen() { + const auto counterSlice = (counter >= 1000) + ? (1000 + (counter % 100)) + : counter; +- if (_trayIconImage.isNull() || _trayIconImage.width() != _trayIconSize || muted != _trayIconMuted || counterSlice != _trayIconCount) { +- if (_trayIconImageBack.isNull() || _trayIconImageBack.width() != _trayIconSize) { +- _trayIconImageBack = Core::App().logo().scaled(_trayIconSize, _trayIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ++ ++ QString iconThemeName = QIcon::themeName(); ++ QString iconName = (counter > 0) ? (muted ? "telegram-mute-panel" : "telegram-attention-panel") ++ : "telegram-panel"; ++ ++ if (_trayIconImage.isNull() || _trayIconImage.width() != _trayIconSize || ++ iconThemeName != _trayIconThemeName || iconName != _trayIconName || ++ muted != _trayIconMuted || counterSlice != _trayIconCount) { ++ if (_trayIconImageBack.isNull() || _trayIconImageBack.width() != _trayIconSize || ++ iconThemeName != _trayIconThemeName || iconName != _trayIconName) { ++ _trayIconImageBack = QIcon::fromTheme(iconName, QIcon::fromTheme("kotatogram", QIcon(QPixmap::fromImage(Core::App().logo())))) ++ .pixmap(256, 256).toImage(); ++ _trayIconImageBack = _trayIconImageBack.scaled(_trayIconSize, _trayIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + _trayIconImageBack = _trayIconImageBack.convertToFormat(QImage::Format_ARGB32); + } ++ + _trayIconImage = _trayIconImageBack; + _trayIconMuted = muted; + _trayIconCount = counterSlice; ++ _trayIconThemeName = iconThemeName; ++ _trayIconName = iconName; ++ + if (counter > 0) { + QPainter p(&_trayIconImage); + int32 layerSize = -16; ++ + if (_trayIconSize >= 48) { + layerSize = -32; + } else if (_trayIconSize >= 36) { +@@ -101,12 +117,15 @@ QImage _trayIconImageGen() { + } else if (_trayIconSize >= 32) { + layerSize = -20; + } ++ + auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg); + auto &fg = st::trayCounterFg; + auto layer = App::wnd()->iconWithCounter(layerSize, counter, bg, fg, false); ++ + p.drawImage(_trayIconImage.width() - layer.width() - 1, _trayIconImage.height() - layer.height() - 1, layer); + } + } ++ + return _trayIconImage; + } + +@@ -115,7 +134,11 @@ QString _trayIconImageFile() { + const auto muted = Core::App().unreadBadgeMuted(); + const auto counterSlice = (counter >= 1000) ? (1000 + (counter % 100)) : counter; + +- QString name = cWorkingDir() + qsl("tdata/ticons/icon%1_%2_%3.png").arg(muted ? "mute" : "").arg(_trayIconSize).arg(counterSlice); ++ QString iconThemeName = QIcon::themeName(); ++ ++ QString name = cWorkingDir() + qsl("tdata/ticons/icon%1_%2_%3_%4.png").arg(muted ? "mute" : "").arg(iconThemeName) ++ .arg(_trayIconSize).arg(counterSlice); ++ + QFileInfo info(name); + if (info.exists()) return name; + diff --git a/tdesktop.patch b/tdesktop.patch index 4b89cf6e1398..301d42a88b94 100644 --- a/tdesktop.patch +++ b/tdesktop.patch @@ -1,27 +1,9 @@ -diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp -index 7768510a0..a832d023f 100644 ---- a/Telegram/SourceFiles/core/launcher.cpp -+++ b/Telegram/SourceFiles/core/launcher.cpp -@@ -278,6 +278,13 @@ int Launcher::exec() { - Platform::start(); - Ui::DisableCustomScaling(); - -+ // I don't know why path is not in QT_PLUGIN_PATH by default -+ QCoreApplication::addLibraryPath("/usr/lib/qt/plugins"); -+ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors -+ setenv("QT_STYLE_OVERRIDE", "breeze", false); -+ // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943 -+ unsetenv("QT_QPA_PLATFORMTHEME"); -+ - auto result = executeApplication(); - - DEBUG_LOG(("Kotatogram finished, result: %1").arg(result)); diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp new file mode 100644 -index 000000000..4fdbe0b68 +index 000000000..5a9117773 --- /dev/null +++ b/Telegram/SourceFiles/qt_functions.cpp -@@ -0,0 +1,97 @@ +@@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. @@ -58,6 +40,7 @@ index 000000000..4fdbe0b68 +// For QTextItemInt declaraion +#include <private/qtextengine_p.h> + ++#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION +/* TODO: find a dynamic library with these symbols. */ + +/* Debian maintainer: this function is taken from qfiledialog.cpp */ @@ -83,6 +66,7 @@ index 000000000..4fdbe0b68 + + return f.split(sep); +} ++#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION + +/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */ +QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) @@ -119,79 +103,24 @@ index 000000000..4fdbe0b68 + if (f->d->strikeOut || charFormat.fontStrikeOut()) + flags |= QTextItem::StrikeOut; +} -diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp -index cc1a767cf..1f2330cb5 100644 ---- a/Telegram/SourceFiles/qt_static_plugins.cpp -+++ b/Telegram/SourceFiles/qt_static_plugins.cpp -@@ -7,26 +7,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL - */ - #include <QtCore/QtPlugin> - -+#ifdef Q_OS_WIN || Q_OS_MAC - Q_IMPORT_PLUGIN(QWebpPlugin) - - #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) - Q_IMPORT_PLUGIN(QJpegPlugin) - Q_IMPORT_PLUGIN(QGifPlugin) - #endif // Qt 5.8.0 -+#endif // Q_OS_WIN | Q_OS_MAC - - #ifdef Q_OS_WIN - Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) - #elif defined Q_OS_MAC // Q_OS_WIN - Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) - Q_IMPORT_PLUGIN(QGenericEnginePlugin) --#elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC --Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) --Q_IMPORT_PLUGIN(QConnmanEnginePlugin) --Q_IMPORT_PLUGIN(QGenericEnginePlugin) --Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) --Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) --Q_IMPORT_PLUGIN(NimfInputContextPlugin) --#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX -+#endif // Q_OS_WIN | Q_OS_MAC -Submodule Telegram/ThirdParty/libtgvoip contains modified content -diff --git a/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp b/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp -index 1d03579..f48c18e 100644 ---- a/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp -+++ b/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp -@@ -14,7 +14,7 @@ - 'variables': { - 'tgvoip_src_loc': '.', - 'special_build_target%': '', -- 'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include', -+ 'linux_path_opus_include%': '/usr/include/opus', - }, - 'include_dirs': [ - '<(tgvoip_src_loc)/webrtc_dsp', +diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp +index b141322a9..f2da2eb3d 100644 +--- a/Telegram/gyp/Telegram.gyp ++++ b/Telegram/gyp/Telegram.gyp +@@ -75,10 +75,7 @@ + '<(submodules_loc)/codegen/codegen.gyp:codegen_style', + '<(submodules_loc)/lib_base/lib_base.gyp:lib_base', + '<(submodules_loc)/lib_ui/lib_ui.gyp:lib_ui', +- '<(third_party_loc)/libtgvoip/libtgvoip.gyp:libtgvoip', + '<(submodules_loc)/lib_lottie/lib_lottie.gyp:lib_lottie', +- 'tests/tests.gyp:tests', +- 'utils.gyp:Updater', + 'lib_export.gyp:lib_export', + 'lib_storage.gyp:lib_storage', + 'lib_ffmpeg.gyp:lib_ffmpeg', Submodule Telegram/gyp/helpers contains modified content -diff --git a/Telegram/gyp/helpers/PrecompiledHeader.cmake b/Telegram/gyp/helpers/PrecompiledHeader.cmake -index 9508bd8..15952e5 100644 ---- a/Telegram/gyp/helpers/PrecompiledHeader.cmake -+++ b/Telegram/gyp/helpers/PrecompiledHeader.cmake -@@ -114,7 +114,7 @@ function(add_precompiled_header _target _input) - set(_compiler_FLAGS "@${_pch_c_flags_file}") - add_custom_command( - OUTPUT "${_output_c}" -- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}" -+ COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}" - DEPENDS "${_pchfile}" "${_pch_c_flags_file}" - IMPLICIT_DEPENDS C "${_pch_header}" - COMMENT "Precompiling ${_name} for ${_target} (C)") -@@ -125,7 +125,7 @@ function(add_precompiled_header _target _input) - set(_compiler_FLAGS "@${_pch_cpp_flags_file}") - add_custom_command( - OUTPUT "${_output_cxx}" -- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}" -+ COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}" - DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}" - IMPLICIT_DEPENDS CXX "${_pch_header}" - COMMENT "Precompiling header ${_name} for ${_target} (C++)") diff --git a/Telegram/gyp/helpers/common/linux.gypi b/Telegram/gyp/helpers/common/linux.gypi -index 12b91b0..507a6b9 100644 +index 12b91b0..28a4a13 100644 --- a/Telegram/gyp/helpers/common/linux.gypi +++ b/Telegram/gyp/helpers/common/linux.gypi @@ -11,7 +11,6 @@ @@ -202,7 +131,15 @@ index 12b91b0..507a6b9 100644 '-W', '-fPIC', '-Wno-unused-variable', -@@ -87,7 +86,6 @@ +@@ -42,6 +41,7 @@ + '<(linux_path_breakpad)/include/breakpad', + '<(linux_path_opus_include)', + '<(linux_path_range)/include', ++ '/usr/include/tgvoip', + ], + 'library_dirs': [ + '/usr/local/lib', +@@ -87,7 +87,6 @@ ], 'defines': [ '_REENTRANT', @@ -210,21 +147,8 @@ index 12b91b0..507a6b9 100644 'QT_PLUGIN', ], 'cflags_c': [ -diff --git a/Telegram/gyp/helpers/modules/openssl.gypi b/Telegram/gyp/helpers/modules/openssl.gypi -index 91f1a99..03c4533 100644 ---- a/Telegram/gyp/helpers/modules/openssl.gypi -+++ b/Telegram/gyp/helpers/modules/openssl.gypi -@@ -58,7 +58,7 @@ - }]], - }], [ 'build_linux', { - 'include_dirs': [ -- '/usr/local/desktop-app/openssl-1.1.1/include', -+ '/usr/include/openssl', - ], - }], - ], diff --git a/Telegram/gyp/helpers/modules/qt.gypi b/Telegram/gyp/helpers/modules/qt.gypi -index e329211..5e67752 100644 +index e329211..e7f7db9 100644 --- a/Telegram/gyp/helpers/modules/qt.gypi +++ b/Telegram/gyp/helpers/modules/qt.gypi @@ -14,27 +14,17 @@ @@ -232,7 +156,7 @@ index e329211..5e67752 100644 'qt_version%': '5.6.2', }, { - 'qt_version%': '5.12.5', -+ 'qt_version%': '<!(pkg-config --modversion Qt5Core)', ++ 'qt_version%': '<!(pkg-config 2> /dev/null --modversion Qt5Core)', }] ], }, @@ -328,9 +252,13 @@ index e329211..5e67752 100644 ], 'library_dirs': [ '<(qt_loc)/lib', -@@ -236,24 +202,12 @@ - '<(DEPTH)/helpers/platform/linux/linux_glibc_wraps.gyp:linux_glibc_wraps', +@@ -232,36 +198,17 @@ + 'library_dirs': [ + '<(qt_loc)/plugins/platforminputcontexts', ], +- 'dependencies': [ +- '<(DEPTH)/helpers/platform/linux/linux_glibc_wraps.gyp:linux_glibc_wraps', +- ], 'libraries': [ - '-lcomposeplatforminputcontextplugin', - '-libusplatforminputcontextplugin', @@ -340,20 +268,20 @@ index e329211..5e67752 100644 '<@(qt_libs_release)', - '<(linux_path_xkbcommon)/lib/libxkbcommon.a', - '<(linux_path_xkbcommon)/lib/libxkbcommon-x11.a', - '<(PRODUCT_DIR)/obj.target/helpers/platform/linux/liblinux_glibc_wraps.a', +- '<(PRODUCT_DIR)/obj.target/helpers/platform/linux/liblinux_glibc_wraps.a', #'<(linux_lib_ssl)', # added in lib_ton #'<(linux_lib_crypto)', # added in lib_ton - '<!@(python -c "for s in \'<(linux_lib_icu)\'.split(\' \'): print(s)")', - '-lxcb', - '-lX11', +- '-lX11', - '-lX11-xcb', - '-ldbus-1', '-ldl', - '-lgthread-2.0', - '-lglib-2.0', +- '-lglib-2.0', '-lpthread', ], -@@ -261,7 +215,6 @@ + 'include_dirs': [ '<(qt_loc)/mkspecs/linux-g++', ], 'ldflags': [ @@ -375,29 +303,26 @@ index 33cc236..de933d3 100644 # Silence "Note: No relevant classes found. No output generated." '--no-notes', diff --git a/Telegram/gyp/telegram/linux.gypi b/Telegram/gyp/telegram/linux.gypi -index ba6bc45e8..73af2b27d 100644 +index ba6bc45e8..3808592ac 100644 --- a/Telegram/gyp/telegram/linux.gypi +++ b/Telegram/gyp/telegram/linux.gypi -@@ -19,9 +19,11 @@ - #'xkbcommon', +@@ -20,28 +20,20 @@ ], }, -+ 'library_dirs': [ -+ '/usr/lib', -+ '/usr/lib/openssl', -+ ], 'libraries': [ - '-Wl,-Bstatic', - '-lbreakpad_client', ++ '-ltgvoip', ++ '-lrlottie', '-llzma', ++ '-llz4', '-lopenal', '-lavformat', -@@ -29,19 +31,10 @@ + '-lavcodec', '-lswresample', '-lswscale', '-lavutil', -+ '-lminizip', - '-lopus', +- '-lopus', - '-lva-x11', - '-lva-drm', - '-lva', @@ -410,78 +335,94 @@ index ba6bc45e8..73af2b27d 100644 - '-lXrender', - '<(linux_lib_ssl)', - '<(linux_lib_crypto)', ++ '-lminizip', ++ '-lssl', + '-lcrypto', # '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))', ], 'cflags_cc': [ -@@ -53,7 +46,6 @@ - '-Wl,-wrap,secure_getenv', - '-Wl,-wrap,clock_gettime', +@@ -49,11 +41,7 @@ + '-Wno-maybe-uninitialized', + ], + 'ldflags': [ +- '-Wl,-wrap,aligned_alloc', +- '-Wl,-wrap,secure_getenv', +- '-Wl,-wrap,clock_gettime', '-Wl,--no-as-needed,-lrt', - '-Wl,-Bstatic', ], 'configurations': { 'Release': { -@@ -77,9 +69,8 @@ +@@ -71,15 +59,12 @@ + }, + }, + 'conditions': [ +- [ '"<!(uname -p)" != "x86_64"', { +- 'ldflags': [ +- '-Wl,-wrap,__divmoddi4', ++ ['not_need_gtk!="True"', { ++ 'libraries': [ ++ '-lX11', ], - }], ['not_need_gtk!="True"', { +- }], ['not_need_gtk!="True"', { 'cflags_cc': [ - '<!(pkg-config 2> /dev/null --cflags gtk+-2.0)', - '<!(pkg-config 2> /dev/null --cflags glib-2.0)', - '<!(pkg-config 2> /dev/null --cflags dee-1.0)', -+ '<!(pkg-config 2> /dev/null --cflags appindicator3-0.1)', + '<!(pkg-config 2> /dev/null --cflags gtk+-3.0)', ], }], ['<!(pkg-config ayatana-appindicator3-0.1; echo $?) == 0', { 'cflags_cc': [ '<!(pkg-config --cflags ayatana-appindicator3-0.1)' ], diff --git a/Telegram/gyp/telegram/sources.txt b/Telegram/gyp/telegram/sources.txt -index e3ccb66db..1bf5886d8 100644 +index e3ccb66db..4d8181281 100644 --- a/Telegram/gyp/telegram/sources.txt +++ b/Telegram/gyp/telegram/sources.txt -@@ -842,7 +842,7 @@ +@@ -838,19 +838,10 @@ + <(src_loc)/mainwindow.h + <(src_loc)/observer_peer.cpp + <(src_loc)/observer_peer.h +-<(src_loc)/qt_static_plugins.cpp ++<(src_loc)/qt_functions.cpp <(src_loc)/settings.cpp <(src_loc)/settings.h -platforms: !win -+platforms: win mac osx - <(minizip_loc)/crypt.h - <(minizip_loc)/ioapi.c - <(minizip_loc)/ioapi.h -@@ -859,3 +859,6 @@ platforms: mac - <(sp_media_key_tap_loc)/SPMediaKeyTap.h - <(sp_media_key_tap_loc)/SPInvocationGrabbing/NSObject+SPInvocationGrabbing.m - <(sp_media_key_tap_loc)/SPInvocationGrabbing/NSObject+SPInvocationGrabbing.h -+ -+platforms: linux -+<(src_loc)/qt_functions.cpp -diff --git a/Telegram/gyp/tests/tests.gyp b/Telegram/gyp/tests/tests.gyp -index 43ae1d696..05fe0fbba 100644 ---- a/Telegram/gyp/tests/tests.gyp -+++ b/Telegram/gyp/tests/tests.gyp -@@ -140,8 +140,7 @@ - ], - }], [ 'build_linux', { - 'libraries': [ -- '<(linux_lib_ssl)', -- '<(linux_lib_crypto)', -+ 'crypto', +-<(minizip_loc)/crypt.h +-<(minizip_loc)/ioapi.c +-<(minizip_loc)/ioapi.h +-<(minizip_loc)/zip.c +-<(minizip_loc)/zip.h +-<(minizip_loc)/unzip.c +-<(minizip_loc)/unzip.h +- + platforms: win + <(res_loc)/winrc/Telegram.rc + +Submodule Telegram/lib_lottie contains modified content +diff --git a/Telegram/lib_lottie/lib_lottie.gyp b/Telegram/lib_lottie/lib_lottie.gyp +index 74ce7de..812b094 100644 +--- a/Telegram/lib_lottie/lib_lottie.gyp ++++ b/Telegram/lib_lottie/lib_lottie.gyp +@@ -21,11 +21,9 @@ + }, + 'dependencies': [ + '<(submodules_loc)/lib_base/lib_base.gyp:lib_base', +- '<(submodules_loc)/lib_rlottie/lib_rlottie.gyp:lib_rlottie', + ], + 'export_dependent_settings': [ + '<(submodules_loc)/lib_base/lib_base.gyp:lib_base', +- '<(submodules_loc)/lib_rlottie/lib_rlottie.gyp:lib_rlottie', + ], + 'direct_dependent_settings': { + 'include_dirs': [ +@@ -57,7 +55,6 @@ + 'conditions': [['lottie_use_cache', { + 'dependencies': [ + '../gyp/lib_ffmpeg.gyp:lib_ffmpeg', +- '../gyp/lib_lz4.gyp:lib_lz4', ], - }]], - }], -diff --git a/Telegram/gyp/utils.gyp b/Telegram/gyp/utils.gyp -index 7d5dafaba..e250edb2b 100644 ---- a/Telegram/gyp/utils.gyp -+++ b/Telegram/gyp/utils.gyp -@@ -73,8 +73,7 @@ - }], - [ 'build_linux', { - 'libraries': [ -- '<(linux_lib_ssl)', -- '<(linux_lib_crypto)', -+ 'crypto', - 'lzma', - ], - }], + 'export_dependent_settings': [ + '../gyp/lib_ffmpeg.gyp:lib_ffmpeg', Submodule Telegram/lib_ui contains modified content diff --git a/Telegram/lib_ui/gyp/qrc_rule.gypi b/Telegram/lib_ui/gyp/qrc_rule.gypi index eb4654c..22cb8f5 100644 @@ -497,13 +438,14 @@ index eb4654c..22cb8f5 100644 '-no-compress', '<(RULE_INPUT_PATH)', diff --git a/Telegram/lib_ui/qt_conf/linux.qrc b/Telegram/lib_ui/qt_conf/linux.qrc -index b9f5692..990e7fa 100644 +index b9f5692..8a9bbb3 100644 --- a/Telegram/lib_ui/qt_conf/linux.qrc +++ b/Telegram/lib_ui/qt_conf/linux.qrc -@@ -1,6 +1,5 @@ +@@ -1,7 +1,4 @@ <RCC> - <qresource prefix="/qt/etc"> +- <qresource prefix="/qt/etc"> - <file alias="qt.conf">qt_linux.conf</file> - </qresource> +- </qresource> <qresource prefix="/fc"> <file>fc-custom.conf</file> + </qresource> |