diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.9.4.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.9.9.patchset similarity index 92% rename from net-im/telegram-desktop/patches/telegram_desktop-1.9.4.patchset rename to net-im/telegram-desktop/patches/telegram_desktop-1.9.9.patchset index 8c005cab9..c0a16c0e8 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.9.4.patchset +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.9.9.patchset @@ -1,6 +1,6 @@ -From d2757681df66652ba0b7732fdb4010bb1792860c Mon Sep 17 00:00:00 2001 +From 11be30aa20a4c6adf6f1ca15945fdedc2fee8a6f Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sat, 18 Jan 2020 18:31:20 +1000 +Date: Wed, 29 Jan 2020 20:58:11 +1000 Subject: Add Haiku support @@ -40,7 +40,7 @@ index d427ad0..73ef023 100644 add_subdirectory(cmake) add_subdirectory(Telegram) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt -index 5c89cc1..5904898 100644 +index ceaf120..f046af1 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -94,7 +94,7 @@ PRIVATE @@ -52,7 +52,7 @@ index 5c89cc1..5904898 100644 desktop-app::external_auto_updates tdesktop::lib_tgvoip desktop-app::external_openssl -@@ -762,6 +762,18 @@ PRIVATE +@@ -766,6 +766,18 @@ PRIVATE platform/win/windows_event_filter.cpp platform/win/windows_event_filter.h platform/win/wrapper_wrl_implements_h.h @@ -71,7 +71,7 @@ index 5c89cc1..5904898 100644 platform/platform_audio.h platform/platform_file_utilities.h platform/platform_launcher.h -@@ -1142,7 +1154,7 @@ endif() +@@ -1152,7 +1164,7 @@ endif() set_target_properties(Telegram PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder}) @@ -120,6 +120,50 @@ index 160571e..842ac9b 100644 #endif // Q_OS_LINUX if (!updater.exists()) { QFileInfo current(curUpdater); +diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp +index 1d6420c..5fe02ad 100644 +--- a/Telegram/SourceFiles/data/data_session.cpp ++++ b/Telegram/SourceFiles/data/data_session.cpp +@@ -196,7 +196,7 @@ Session::Session(not_null session) + _cache->open(Local::cacheKey()); + _bigFileCache->open(Local::cacheBigFileKey()); + +- if constexpr (Platform::IsLinux()) { ++ if constexpr (Platform::IsLinux() || Platform::IsHaiku()) { + const auto wasVersion = Local::oldMapVersion(); + if (wasVersion >= 1007011 && wasVersion < 1007015) { + _bigFileCache->clear(); +diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp +index ad106e5..924e995 100644 +--- a/Telegram/SourceFiles/mainwindow.cpp ++++ b/Telegram/SourceFiles/mainwindow.cpp +@@ -142,7 +142,7 @@ void MainWindow::firstShow() { + ? tr::lng_disable_notifications_from_tray(tr::now) + : tr::lng_enable_notifications_from_tray(tr::now); + +- if (Platform::IsLinux()) { ++ if (Platform::IsLinux() || Platform::IsHaiku()) { + trayIconMenu->addAction(tr::lng_open_from_tray(tr::now), this, SLOT(showFromTray())); + trayIconMenu->addAction(tr::lng_minimize_to_tray(tr::now), this, SLOT(minimizeToTray())); + trayIconMenu->addAction(notificationActionText, this, SLOT(toggleDisplayNotifyFromTray())); +@@ -562,7 +562,7 @@ void MainWindow::updateTrayMenu(bool force) { + + auto iconMenu = trayIconMenu; + auto actions = iconMenu->actions(); +- if (Platform::IsLinux()) { ++ if (Platform::IsLinux() || Platform::IsHaiku()) { + auto minimizeAction = actions.at(1); + minimizeAction->setDisabled(!isVisible()); + } else { +@@ -582,7 +582,7 @@ void MainWindow::updateTrayMenu(bool force) { + iconMenu = nullptr; + } + } +- auto notificationAction = actions.at(Platform::IsLinux() ? 2 : 1); ++ auto notificationAction = actions.at(Platform::IsLinux() || Platform::IsHaiku() ? 2 : 1); + auto notificationActionText = Global::DesktopNotify() + ? tr::lng_disable_notifications_from_tray(tr::now) + : tr::lng_enable_notifications_from_tray(tr::now); diff --git a/Telegram/SourceFiles/media/audio/media_audio.cpp b/Telegram/SourceFiles/media/audio/media_audio.cpp index c1234c4..4a4f89f 100644 --- a/Telegram/SourceFiles/media/audio/media_audio.cpp @@ -141,6 +185,19 @@ index c1234c4..4a4f89f 100644 if (auto device = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER)) { LOG(("Audio Playback Default Device: %1").arg(QString::fromLocal8Bit(device))); } else { +diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +index 965b402..d5b635d 100644 +--- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp ++++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +@@ -289,7 +289,7 @@ OverlayWidget::OverlayWidget() + + hide(); + createWinId(); +- if (Platform::IsLinux()) { ++ if (Platform::IsLinux() || Platform::IsHaiku()) { + windowHandle()->setTransientParent(App::wnd()->windowHandle()); + setWindowModality(Qt::WindowModal); + } diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp new file mode 100644 index 0000000..6b37269 @@ -1304,10 +1361,10 @@ index 0000000..e2218b8 +} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp new file mode 100644 -index 0000000..200bc1c +index 0000000..5b7bd3b --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -@@ -0,0 +1,249 @@ +@@ -0,0 +1,254 @@ +/* +This file is part of Telegram Desktop for Haiku, + @@ -1353,6 +1410,11 @@ index 0000000..200bc1c + return argc ? QFile::decodeName(argv[0]) : QString(); +} + ++QString SingleInstanceLocalServerName(const QString &hash) { ++ return QStandardPaths::writableLocation(QStandardPaths::TempLocation) ++ + '/' + hash + '-' + cGUIDStr(); ++} ++ +} // namespace Platform + +namespace { @@ -1559,10 +1621,10 @@ index 0000000..200bc1c +} diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.h b/Telegram/SourceFiles/platform/haiku/specific_haiku.h new file mode 100644 -index 0000000..b59c98d +index 0000000..35a5655 --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.h -@@ -0,0 +1,115 @@ +@@ -0,0 +1,117 @@ +/* +This file is part of Telegram Desktop for Haiku, + @@ -1602,6 +1664,8 @@ index 0000000..b59c98d + +QString CurrentExecutablePath(int argc, char *argv[]); + ++QString SingleInstanceLocalServerName(const QString &hash); ++ +inline std::optional LastUserInputTime() { + return std::nullopt; +} @@ -1801,7 +1865,7 @@ index 6aea663..a5c46ef 100644 -#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX +#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX || Q_OS_HAIKU diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp -index 31d16e3..e592a75 100644 +index 56acbb9..ef16c47 100644 --- a/Telegram/SourceFiles/settings/settings_calls.cpp +++ b/Telegram/SourceFiles/settings/settings_calls.cpp @@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service. @@ -1826,8 +1890,34 @@ index 31d16e3..e592a75 100644 #include #ifdef NEED_TO_RESTORE_SLOTS +diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp +index 9ec30eb..53152ee 100644 +--- a/Telegram/SourceFiles/settings/settings_notifications.cpp ++++ b/Telegram/SourceFiles/settings/settings_notifications.cpp +@@ -622,7 +622,7 @@ void SetupNotificationsContent( + return QString(); + } else if (Platform::IsWindows()) { + return tr::lng_settings_use_windows(tr::now); +- } else if (Platform::IsLinux()) { ++ } else if (Platform::IsLinux() || Platform::IsHaiku()) { + return tr::lng_settings_use_native_notifications(tr::now); + } + return QString(); +diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp +index c4d4802..070ac91 100644 +--- a/Telegram/SourceFiles/window/main_window.cpp ++++ b/Telegram/SourceFiles/window/main_window.cpp +@@ -117,7 +117,7 @@ QIcon CreateOfficialIcon(Main::Account *account) { + + QIcon CreateIcon(Main::Account *account) { + auto result = CreateOfficialIcon(account); +- if (Platform::IsLinux()) { ++ if (Platform::IsLinux() || Platform::IsHaiku()) { + return QIcon::fromTheme("telegram", result); + } + return result; diff --git a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp -index b7eecdb..ea65861 100644 +index 88a8260..dfc6478 100644 --- a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp +++ b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp @@ -8,6 +8,9 @@ @@ -1840,7 +1930,7 @@ index b7eecdb..ea65861 100644 #include #include #include -@@ -3057,6 +3060,10 @@ double VoIPController::GetCurrentTime(){ +@@ -3009,6 +3012,10 @@ double VoIPController::GetCurrentTime(){ struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec+(double)ts.tv_nsec/1000000000.0; @@ -1875,7 +1965,7 @@ index 2c16ca7..e00c731 100644 #ifndef WITHOUT_ALSA #ifndef WITHOUT_PULSE diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp -index dae647a..4bab98c 100644 +index 4d5b573..239406c 100644 --- a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp +++ b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp @@ -33,6 +33,8 @@ @@ -1888,7 +1978,7 @@ index dae647a..4bab98c 100644 #error "Unsupported operating system" #endif diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp -index 458e8a5..1890350 100644 +index dc7b61a..b075925 100644 --- a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp +++ b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp @@ -37,6 +37,8 @@ @@ -2586,7 +2676,7 @@ index 0000000..01f6096 + +#endif diff --git a/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp -index 52eef76..c480dfb 100644 +index 78e0583..81bf9fc 100644 --- a/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp +++ b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp @@ -248,12 +248,13 @@ void NetworkSocketPosix::Open(){ @@ -2616,7 +2706,7 @@ index 52eef76..c480dfb 100644 diff --git a/Telegram/ThirdParty/libtgvoip/threading.h b/Telegram/ThirdParty/libtgvoip/threading.h old mode 100755 new mode 100644 -index 52a09ff..f26ff21 +index f6163e9..23e6b48 --- a/Telegram/ThirdParty/libtgvoip/threading.h +++ b/Telegram/ThirdParty/libtgvoip/threading.h @@ -9,7 +9,7 @@ @@ -2705,10 +2795,10 @@ index 0bc42eb..c87cde9 100644 typedef pid_t PlatformThreadId; typedef pthread_t PlatformThreadRef; diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake -index bb76f03..f4cabae 100644 +index 215ac73..c247275 100644 --- a/Telegram/cmake/lib_tgvoip.cmake +++ b/Telegram/cmake/lib_tgvoip.cmake -@@ -118,6 +118,14 @@ else() +@@ -120,6 +120,14 @@ else() os/linux/AudioPulse.cpp os/linux/AudioPulse.h @@ -2723,7 +2813,7 @@ index bb76f03..f4cabae 100644 # POSIX os/posix/NetworkSocketPosix.cpp os/posix/NetworkSocketPosix.h -@@ -759,6 +767,20 @@ else() +@@ -762,6 +770,20 @@ else() TGVOIP_NO_OSX_PRIVATE_API ) endif() @@ -2806,6 +2896,28 @@ index a02c9b0..cffaec4 100644 // Compiler detection. #if defined(__clang__) +diff --git a/Telegram/lib_base/base/crash_report_writer.cpp b/Telegram/lib_base/base/crash_report_writer.cpp +index 963a720..d67d6c3 100644 +--- a/Telegram/lib_base/base/crash_report_writer.cpp ++++ b/Telegram/lib_base/base/crash_report_writer.cpp +@@ -107,6 +107,8 @@ const char *PlatformString() { + return "Linux32Bit"; + } else if (Platform::IsLinux64Bit()) { + return "Linux64bit"; ++ } else if (Platform::IsHaiku()) { ++ return "Haiku"; + } + Unexpected("Platform in CrashReports::PlatformString."); + } +@@ -243,7 +245,7 @@ void SignalHandler(int signum) { + ReportingThreadId = nullptr; + } + +-bool SetSignalHandlers = Platform::IsLinux() || Platform::IsMac(); ++bool SetSignalHandlers = Platform::IsLinux() || Platform::IsMac() || Platform::IsHaiku(); + bool CrashLogged = false; + + #ifdef USE_BREAKPAD diff --git a/Telegram/lib_base/base/platform/base_platform_file_utilities.h b/Telegram/lib_base/base/platform/base_platform_file_utilities.h index d9ec560..e5076b5 100644 --- a/Telegram/lib_base/base/platform/base_platform_file_utilities.h @@ -2825,10 +2937,19 @@ index d9ec560..e5076b5 100644 -#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN +#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN || Q_OS_HAIKU diff --git a/Telegram/lib_base/base/platform/base_platform_info.h b/Telegram/lib_base/base/platform/base_platform_info.h -index 37b0b76..b3bcd43 100644 +index 37b0b76..d7a5a2c 100644 --- a/Telegram/lib_base/base/platform/base_platform_info.h +++ b/Telegram/lib_base/base/platform/base_platform_info.h -@@ -53,8 +53,10 @@ void Finish(); +@@ -46,6 +46,8 @@ namespace Platform { + [[nodiscard]] constexpr bool IsLinux32Bit(); + [[nodiscard]] constexpr bool IsLinux64Bit(); + ++[[nodiscard]] constexpr bool IsHaiku(); ++ + void Start(QJsonObject settings); + void Finish(); + +@@ -53,8 +55,10 @@ void Finish(); #ifdef Q_OS_MAC #include "base/platform/mac/base_info_mac.h" @@ -2844,17 +2965,17 @@ index 37b0b76..b3bcd43 100644 +#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN || Q_OS_HAIKU diff --git a/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.cpp new file mode 100644 -index 0000000..f1936d9 +index 0000000..2e18272 --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.cpp -@@ -0,0 +1,118 @@ +@@ -0,0 +1,77 @@ +/* +This file is part of Telegram Desktop for Haiku, + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#include "base/platform/haiku/base_file_utilities_haiku.h" @@ -2876,57 +2997,19 @@ index 0000000..f1936d9 +bool ShowInFolder(const QString &filepath) { + const auto absolutePath = QFileInfo(filepath).absoluteFilePath(); + QProcess process; -+ process.start( -+ "xdg-mime", -+ QStringList() << "query" << "default" << "inode/directory"); -+ process.waitForFinished(); -+ auto output = QString::fromLatin1(process.readLine().simplified()); -+ auto command = QString("xdg-open"); ++ auto command = QString("open"); + auto arguments = QStringList(); -+ if (output == qstr("dolphin.desktop") -+ || output == qstr("org.kde.dolphin.desktop")) { -+ command = "dolphin"; -+ arguments << "--select" << absolutePath; -+ } else if (output == qstr("nautilus.desktop") -+ || output == qstr("org.gnome.Nautilus.desktop") -+ || output == qstr("nautilus-folder-handler.desktop")) { -+ command = "nautilus"; -+ arguments << absolutePath; -+ } else if (output == qstr("nemo.desktop")) { -+ command = "nemo"; -+ arguments << "--no-desktop" << absolutePath; -+ } else if (output == qstr("konqueror.desktop") -+ || output == qstr("kfmclient_dir.desktop")) { -+ command = "konqueror"; -+ arguments << "--select" << absolutePath; -+ } else { -+ arguments << QFileInfo(filepath).absoluteDir().absolutePath(); -+ } ++ arguments << QFileInfo(filepath).absoluteDir().absolutePath(); + return process.startDetached(command, arguments); +} + +QString CurrentExecutablePath(int argc, char *argv[]) { -+ constexpr auto kMaxPath = 1024; -+ char result[kMaxPath] = { 0 }; -+ auto count = readlink("/proc/self/exe", result, kMaxPath); -+ if (count > 0) { -+ auto filename = QFile::decodeName(result); -+ auto deletedPostfix = qstr(" (deleted)"); -+ if (filename.endsWith(deletedPostfix) -+ && !QFileInfo(filename).exists()) { -+ filename.chop(deletedPostfix.size()); -+ } -+ return filename; -+ } -+ -+ // Fallback to the first command line argument. + return argc ? QFile::decodeName(argv[0]) : QString(); +} + +void RemoveQuarantine(const QString &path) { +} + -+// From http://stackoverflow.com/questions/2256945/removing-a-non-empty-directory-programmatically-in-c-or-c +bool DeleteDirectory(QString path) { + if (path.endsWith('/')) { + path.chop(1); @@ -2938,11 +3021,8 @@ index 0000000..f1936d9 + } + + while (struct dirent *p = readdir(d)) { -+ // Skip the names "." and ".." as we don't want to recurse on them. -+ if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) { ++ if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) + continue; -+ } -+ + const auto fname = path + '/' + p->d_name; + const auto encoded = QFile::encodeName(fname); + struct stat statbuf; @@ -2968,7 +3048,7 @@ index 0000000..f1936d9 +} // namespace base::Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.h b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.h new file mode 100644 -index 0000000..05f6cd3 +index 0000000..3b2d42b --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.h @@ -0,0 +1,20 @@ @@ -2978,7 +3058,7 @@ index 0000000..05f6cd3 +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#pragma once @@ -2994,7 +3074,7 @@ index 0000000..05f6cd3 +} // namespace base::Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_info_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_info_haiku.cpp new file mode 100644 -index 0000000..a11b47e +index 0000000..cce9d25 --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_info_haiku.cpp @@ -0,0 +1,75 @@ @@ -3004,7 +3084,7 @@ index 0000000..a11b47e +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#include "base/platform/haiku/base_info_haiku.h" @@ -3075,17 +3155,17 @@ index 0000000..a11b47e +} // namespace Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_info_haiku.h b/Telegram/lib_base/base/platform/haiku/base_info_haiku.h new file mode 100644 -index 0000000..bbb80a2 +index 0000000..a3a44e4 --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_info_haiku.h -@@ -0,0 +1,57 @@ +@@ -0,0 +1,42 @@ +/* +This file is part of Telegram Desktop for Haiku, + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#pragma once @@ -3094,26 +3174,11 @@ index 0000000..bbb80a2 + +namespace Platform { + -+inline constexpr bool IsLinux() { -+ return true; -+} -+ -+inline constexpr bool IsLinux32Bit() { -+#ifdef Q_OS_LINUX32 -+ return true; -+#else // Q_OS_LINUX32 -+ return false; -+#endif // Q_OS_LINUX32 -+} -+ -+inline constexpr bool IsLinux64Bit() { -+#ifdef Q_OS_LINUX64 -+ return true; -+#else // Q_OS_LINUX64 -+ return false; -+#endif // Q_OS_LINUX64 -+} ++inline constexpr bool IsHaiku() { return true;} + ++inline constexpr bool IsLinux() { return false;} ++inline constexpr bool IsLinux32Bit() { return false; } ++inline constexpr bool IsLinux64Bit() { return false; } +inline constexpr bool IsWindows() { return false; } +inline constexpr bool IsWindowsStoreBuild() { return false; } +inline bool IsWindowsXPOrGreater() { return false; } @@ -3138,7 +3203,7 @@ index 0000000..bbb80a2 +} // namespace Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.cpp new file mode 100644 -index 0000000..550444b +index 0000000..8fa3e9f --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.cpp @@ -0,0 +1,20 @@ @@ -3148,7 +3213,7 @@ index 0000000..550444b +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#include "base/platform/haiku/base_last_input_haiku.h" @@ -3164,7 +3229,7 @@ index 0000000..550444b +} // namespace base::Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.h b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.h new file mode 100644 -index 0000000..d9ce6f6 +index 0000000..a24adad --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.h @@ -0,0 +1,11 @@ @@ -3174,14 +3239,14 @@ index 0000000..d9ce6f6 +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#pragma once + diff --git a/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.cpp new file mode 100644 -index 0000000..7f9e74b +index 0000000..533b8ea --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.cpp @@ -0,0 +1,18 @@ @@ -3191,7 +3256,7 @@ index 0000000..7f9e74b +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#include "base/platform/haiku/base_layout_switch_haiku.h" @@ -3205,7 +3270,7 @@ index 0000000..7f9e74b +} // namespace base::Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.h b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.h new file mode 100644 -index 0000000..d9ce6f6 +index 0000000..a24adad --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.h @@ -0,0 +1,11 @@ @@ -3215,14 +3280,14 @@ index 0000000..d9ce6f6 +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#pragma once + diff --git a/Telegram/lib_base/base/platform/haiku/base_process_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_process_haiku.cpp new file mode 100644 -index 0000000..032d3c1 +index 0000000..6e88f99 --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_process_haiku.cpp @@ -0,0 +1,20 @@ @@ -3232,7 +3297,7 @@ index 0000000..032d3c1 +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#include "base/platform/haiku/base_process_haiku.h" @@ -3248,7 +3313,7 @@ index 0000000..032d3c1 +} // namespace base::Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_process_haiku.h b/Telegram/lib_base/base/platform/haiku/base_process_haiku.h new file mode 100644 -index 0000000..74b2a9d +index 0000000..4d0bce3 --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_process_haiku.h @@ -0,0 +1,12 @@ @@ -3258,7 +3323,7 @@ index 0000000..74b2a9d +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#pragma once @@ -3266,17 +3331,17 @@ index 0000000..74b2a9d +#include "base/platform/base_platform_process.h" diff --git a/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.cpp new file mode 100644 -index 0000000..85f1b4f +index 0000000..2aec193 --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.cpp -@@ -0,0 +1,192 @@ +@@ -0,0 +1,74 @@ +/* +This file is part of Telegram Desktop for Haiku, + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#include "base/platform/haiku/base_url_scheme_haiku.h" @@ -3334,137 +3399,19 @@ index 0000000..85f1b4f + return result; +} + -+bool RegisterDesktopFile(const UrlSchemeDescriptor &descriptor) { -+ const auto home = GetHomeDir(); -+ if (home.isEmpty() || descriptor.executable.isEmpty() || descriptor.skipDesktopFileRegistration) { -+ return false; -+ } -+ -+ if (!QDir(home + ".local/").exists()) { -+ return false; -+ } -+ const auto apps = home + ".local/share/applications/"; -+ const auto icons = home + ".local/share/icons/"; -+ if (!QDir(apps).exists()) { -+ QDir().mkpath(apps); -+ } -+ if (!QDir(icons).exists()) { -+ QDir().mkpath(icons); -+ } -+ -+ const auto path = descriptor.desktopFileDir; -+ const auto file = path + descriptor.desktopFileName + ".desktop"; -+ QDir().mkpath(path); -+ auto f = QFile(file); -+ if (!f.open(QIODevice::WriteOnly)) { -+ return false; -+ } -+ const auto icon = icons + descriptor.iconFileName + ".png"; -+ if (descriptor.forceUpdateIcon) { -+ QFile(icon).remove(); -+ } -+ if (descriptor.forceUpdateIcon || !QFile(icon).exists()) { -+ QFile(":/gui/art/logo.png").copy(icon); -+ } -+ -+ auto s = QTextStream(&f); -+ s.setCodec("UTF-8"); -+ s << "[Desktop Entry]\n"; -+ s << "Version=1.0\n"; -+ s << "Name=" << descriptor.displayAppName << "\n"; -+ s << "Comment=" << descriptor.displayAppDescription << "\n"; -+ s << "TryExec=" << EscapeShell(QFile::encodeName(descriptor.executable)) << "\n"; -+ s << "Exec=" << EscapeShell(QFile::encodeName(descriptor.executable)) << " -- %u\n"; -+ s << "Icon=" << descriptor.iconFileName << "\n"; -+ s << "Terminal=false\n"; -+ s << "StartupWMClass=" + QCoreApplication::instance()->applicationName() << "\n"; -+ s << "Type=Application\n"; -+ s << "MimeType=x-scheme-handler/" << descriptor.protocol << ";\n"; -+ s << "X-GNOME-UsesNotifications=true\n"; -+ f.close(); -+ -+ if (!RunShellCommand("desktop-file-install --dir=" + EscapeShell(QFile::encodeName(home + ".local/share/applications")) + " --delete-original " + EscapeShell(QFile::encodeName(file)))) { -+ return false; -+ } -+ RunShellCommand("update-desktop-database " + EscapeShell(QFile::encodeName(home + ".local/share/applications"))); -+ RunShellCommand("xdg-mime default telegramdesktop.desktop x-scheme-handler/tg"); -+ return true; -+} -+ -+bool RegisterGnomeHandler(const UrlSchemeDescriptor &descriptor) { -+ const auto protocolUtf = descriptor.protocol.toUtf8(); -+ if (!RunShellCommand("gconftool-2 -t string -s /desktop/gnome/url-handlers/" + protocolUtf + "/command " + EscapeShell(EscapeShell(QFile::encodeName(descriptor.executable)) + " -- %s"))) { -+ return false; -+ } -+ RunShellCommand("gconftool-2 -t bool -s /desktop/gnome/url-handlers/" + protocolUtf + "/needs_terminal false"); -+ RunShellCommand("gconftool-2 -t bool -s /desktop/gnome/url-handlers/" + protocolUtf + "/enabled true"); -+ return true; -+} -+ -+bool RegisterKdeHandler(const UrlSchemeDescriptor &descriptor) { -+ const auto home = GetHomeDir(); -+ if (home.isEmpty() || descriptor.executable.isEmpty()) { -+ return false; -+ } -+ -+ const auto services = [&] { -+ if (QDir(home + ".kde4/").exists()) { -+ return home + ".kde4/share/kde4/services/"; -+ } else if (QDir(home + ".kde/").exists()) { -+ return home + ".kde/share/kde4/services/"; -+ } -+ return QString(); -+ }(); -+ if (services.isEmpty()) { -+ return false; -+ } -+ if (!QDir(services).exists()) { -+ QDir().mkpath(services); -+ } -+ -+ const auto path = services; -+ const auto file = path + descriptor.protocol + ".protocol"; -+ auto f = QFile(file); -+ if (!f.open(QIODevice::WriteOnly)) { -+ return false; -+ } -+ auto s = QTextStream(&f); -+ s.setCodec("UTF-8"); -+ s << "[Protocol]\n"; -+ s << "exec=" << QFile::decodeName(EscapeShell(QFile::encodeName(descriptor.executable))) << " -- %u\n"; -+ s << "protocol=" << descriptor.protocol << "\n"; -+ s << "input=none\n"; -+ s << "output=none\n"; -+ s << "helper=true\n"; -+ s << "listing=false\n"; -+ s << "reading=false\n"; -+ s << "writing=false\n"; -+ s << "makedir=false\n"; -+ s << "deleting=false\n"; -+ f.close(); -+ return true; -+} -+ +} // namespace + +bool CheckUrlScheme(const UrlSchemeDescriptor &descriptor) { + return false; +} + -+void RegisterUrlScheme(const UrlSchemeDescriptor &descriptor) { -+ RegisterDesktopFile(descriptor); -+ RegisterGnomeHandler(descriptor); -+ RegisterKdeHandler(descriptor); -+} -+ -+void UnregisterUrlScheme(const UrlSchemeDescriptor &descriptor) { -+ // TODO -+} ++void RegisterUrlScheme(const UrlSchemeDescriptor &descriptor) { } ++void UnregisterUrlScheme(const UrlSchemeDescriptor &descriptor) { } + +} // namespace base::Platform diff --git a/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.h b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.h new file mode 100644 -index 0000000..177a2a1 +index 0000000..6402509 --- /dev/null +++ b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.h @@ -0,0 +1,12 @@ @@ -3474,14 +3421,14 @@ index 0000000..177a2a1 +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL + -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com +*/ + +#pragma once + +#include "base/platform/base_platform_url_scheme.h" diff --git a/Telegram/lib_crl/CMakeLists.txt b/Telegram/lib_crl/CMakeLists.txt -index d241fb6..4d81e67 100644 +index 5e8f33f..bc87ddb 100644 --- a/Telegram/lib_crl/CMakeLists.txt +++ b/Telegram/lib_crl/CMakeLists.txt @@ -32,6 +32,7 @@ PRIVATE @@ -4275,10 +4222,10 @@ index 6ad7201..333d642 100644 -#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX +#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_WINRT || Q_OS_LINUX || defined Q_OS_HAIKU diff --git a/Telegram/lib_ui/CMakeLists.txt b/Telegram/lib_ui/CMakeLists.txt -index 81bf4d1..4b462bd 100644 +index 88c28e6..53599c6 100644 --- a/Telegram/lib_ui/CMakeLists.txt +++ b/Telegram/lib_ui/CMakeLists.txt -@@ -85,6 +85,10 @@ PRIVATE +@@ -84,6 +84,10 @@ PRIVATE ui/platform/win/ui_window_win.h ui/platform/win/ui_utility_win.cpp ui/platform/win/ui_utility_win.h @@ -4291,16 +4238,19 @@ index 81bf4d1..4b462bd 100644 ui/style/style_core.cpp diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.cpp b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.cpp new file mode 100644 -index 0000000..0bd8f94 +index 0000000..7a1188b --- /dev/null +++ b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.cpp -@@ -0,0 +1,47 @@ -+// This file is part of Desktop App Toolkit, -+// a set of libraries for developing nice desktop applications. -+// -+// For license and copyright information please follow this link: -+// https://github.com/desktop-app/legal/blob/master/LEGAL -+// +@@ -0,0 +1,32 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ +#include "ui/platform/linux/ui_utility_linux.h" + +#include "base/flat_set.h" @@ -4319,24 +4269,6 @@ index 0000000..0bd8f94 +} + +bool TranslucentWindowsSupported(QPoint globalPosition) { -+ if (const auto native = QGuiApplication::platformNativeInterface()) { -+ if (const auto desktop = QApplication::desktop()) { -+ const auto index = desktop->screenNumber(globalPosition); -+ const auto screens = QGuiApplication::screens(); -+ if (const auto screen = (index >= 0 && index < screens.size()) ? screens[index] : QGuiApplication::primaryScreen()) { -+ if (native->nativeResourceForScreen(QByteArray("compositingEnabled"), screen)) { -+ return true; -+ } -+ static auto WarnedAbout = base::flat_set(); -+ if (!WarnedAbout.contains(index)) { -+ WarnedAbout.emplace(index); -+ UI_LOG(("WARNING: Compositing is disabled for screen index %1 (for position %2,%3)").arg(index).arg(globalPosition.x()).arg(globalPosition.y())); -+ } -+ } else { -+ UI_LOG(("WARNING: Could not get screen for index %1 (for position %2,%3)").arg(index).arg(globalPosition.x()).arg(globalPosition.y())); -+ } -+ } -+ } + return false; +} + @@ -4344,16 +4276,19 @@ index 0000000..0bd8f94 +} // namespace Ui diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.h b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.h new file mode 100644 -index 0000000..c2f49dc +index 0000000..37a2871 --- /dev/null +++ b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.h -@@ -0,0 +1,41 @@ -+// This file is part of Desktop App Toolkit, -+// a set of libraries for developing nice desktop applications. -+// -+// For license and copyright information please follow this link: -+// https://github.com/desktop-app/legal/blob/master/LEGAL -+// +@@ -0,0 +1,44 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ +#pragma once + +class QPainter; @@ -4391,17 +4326,20 @@ index 0000000..c2f49dc +} // namespace Ui diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.cpp b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.cpp new file mode 100644 -index 0000000..8e2a83a +index 0000000..e7a032f --- /dev/null +++ b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.cpp -@@ -0,0 +1,18 @@ -+// This file is part of Desktop App Toolkit, -+// a set of libraries for developing nice desktop applications. -+// -+// For license and copyright information please follow this link: -+// https://github.com/desktop-app/legal/blob/master/LEGAL -+// -+#include "ui/platform/linux/ui_window_linux.h" +@@ -0,0 +1,21 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ ++#include "ui/platform/haiku/ui_window_haiku.h" + +namespace Ui { +namespace Platform { @@ -4415,16 +4353,19 @@ index 0000000..8e2a83a +} // namespace Ui diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.h b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.h new file mode 100644 -index 0000000..b4f4fe2 +index 0000000..ecb1277 --- /dev/null +++ b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.h -@@ -0,0 +1,9 @@ -+// This file is part of Desktop App Toolkit, -+// a set of libraries for developing nice desktop applications. -+// -+// For license and copyright information please follow this link: -+// https://github.com/desktop-app/legal/blob/master/LEGAL -+// +@@ -0,0 +1,12 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ +#pragma once + +#include "ui/platform/ui_platform_window.h" @@ -4623,10 +4564,10 @@ index 2ac58d4..6aed2b8 100644 set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE) set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE) diff --git a/cmake/options.cmake b/cmake/options.cmake -index a207f28..f76f093 100644 +index 47102c0..4cce463 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake -@@ -30,6 +30,8 @@ if (WIN32) +@@ -37,6 +37,8 @@ if (WIN32) include(cmake/options_win.cmake) elseif (APPLE) include(cmake/options_mac.cmake) @@ -4672,10 +4613,10 @@ index 0000000..063f1ce + $,,-Ofast> +) diff --git a/cmake/variables.cmake b/cmake/variables.cmake -index d53ed08..f0ad4ad 100644 +index 9d3b075..53448ac 100644 --- a/cmake/variables.cmake +++ b/cmake/variables.cmake -@@ -34,6 +34,7 @@ set(build_osx 0) +@@ -41,6 +41,7 @@ set(build_osx 0) set(build_macstore 0) set(build_winstore 0) set(build_linux32 0) @@ -4683,8 +4624,8 @@ index d53ed08..f0ad4ad 100644 if (WIN32) if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") -@@ -45,6 +46,12 @@ elseif (APPLE) - elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "mas") +@@ -52,6 +53,12 @@ elseif (APPLE) + elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") set(build_macstore 1) endif() +elseif (HAIKU) @@ -4694,9 +4635,9 @@ index d53ed08..f0ad4ad 100644 + set(CMAKE_RANLIB gcc-ranlib) + set(CMAKE_NM gcc-nm) else() - execute_process(COMMAND uname -m OUTPUT_VARIABLE machine_uname) if (CMAKE_SIZEOF_VOID_P EQUAL 4) -@@ -66,8 +73,8 @@ else() + set(build_linux32 1) +@@ -72,8 +79,8 @@ else() endif() endif() diff --git a/net-im/telegram-desktop/telegram_desktop-1.9.4.recipe b/net-im/telegram-desktop/telegram_desktop-1.9.9.recipe similarity index 97% rename from net-im/telegram-desktop/telegram_desktop-1.9.4.recipe rename to net-im/telegram-desktop/telegram_desktop-1.9.9.recipe index 855827b44..30555187d 100644 --- a/net-im/telegram-desktop/telegram_desktop-1.9.4.recipe +++ b/net-im/telegram-desktop/telegram_desktop-1.9.9.recipe @@ -6,7 +6,7 @@ LICENSE="GNU GPL v3" REVISION="1" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz" -CHECKSUM_SHA256="9ef7ac0e97629dec7ff68aea54f517a40c4a41fa9197f205bd4431d0e37abad1" +CHECKSUM_SHA256="260678b1e2c9638fa5d500880ddd9b6cd8338b1d235aee93c43ec9ab22a67d21" SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz" SOURCE_DIR="tdesktop-$portVersion-full" srcGitRev_2="0663103551379b958b2e79c51d51d163ec484300" @@ -138,7 +138,7 @@ INSTALL() { mkdir -p $appsDir $prefix/bin cp build/tg-notify-gate $prefix/bin - cp build/bin/Telegram $appsDir + cp build/bin/telegram-desktop $appsDir/Telegram strip $appsDir/Telegram local APP_SIGNATURE="application/x-vnd.telegram"