git: bc5de8f43cbc - main - net-im/telegram-desktop: update to 3.7.1

From: Sergey A. Osokin <osa_at_FreeBSD.org>
Date: Thu, 28 Apr 2022 20:46:09 UTC
The branch main has been updated by osa:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bc5de8f43cbce75ee2ea7b8ecb5eddb2323efb94

commit bc5de8f43cbce75ee2ea7b8ecb5eddb2323efb94
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2022-04-28 20:33:16 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2022-04-28 20:33:16 +0000

    net-im/telegram-desktop: update to 3.7.1
    
    There are several patches have been added.
    
    - https://github.com/desktop-app/lib_ui/commit/d4921ccf5f61be6324bba3b14b25f29e28c5b2bd.patch
    - https://salsa.debian.org/debian/telegram-desktop/-/blob/2fbd71cd75a7d5052f46b61403b0a226b189205a/debian/patches/Compatible-setScreen.patch
---
 net-im/telegram-desktop/Makefile                   |  2 +-
 net-im/telegram-desktop/distinfo                   |  6 +--
 ...les_media_view_media__view__overlay__widget.cpp | 11 +++++
 ...ram_SourceFiles_media_view_media__view__pip.cpp | 11 +++++
 ...irdParty_hunspell_tests_suggestiontest_Makefile | 14 +++++++
 .../files/patch-Telegram_lib__ui_CMakeLists.txt    | 48 ++++++++++++++++++++++
 .../files/patch-Telegram_lib__ui_ui_rp__widget.cpp | 24 +++++++++++
 .../files/patch-Telegram_lib__ui_ui_rp__widget.h   | 13 ++++++
 8 files changed, 125 insertions(+), 4 deletions(-)

diff --git a/net-im/telegram-desktop/Makefile b/net-im/telegram-desktop/Makefile
index b2767d980381..af1da9ac6ea4 100644
--- a/net-im/telegram-desktop/Makefile
+++ b/net-im/telegram-desktop/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	telegram-desktop
-DISTVERSION=	3.6.1
+DISTVERSION=	3.7.1
 CATEGORIES=	net-im
 MASTER_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/v${DISTVERSION}/
 DISTNAME=	tdesktop-${DISTVERSION}-full
diff --git a/net-im/telegram-desktop/distinfo b/net-im/telegram-desktop/distinfo
index 913b87189c04..d11eb8071c0e 100644
--- a/net-im/telegram-desktop/distinfo
+++ b/net-im/telegram-desktop/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1647535499
-SHA256 (tdesktop-3.6.1-full.tar.gz) = 1e87df0970b135d566f5af4bc6c2695fc98ba387dc1137100a478f02d48c12e8
-SIZE (tdesktop-3.6.1-full.tar.gz) = 41226549
+TIMESTAMP = 1650723886
+SHA256 (tdesktop-3.7.1-full.tar.gz) = 9d02a5a4c2ac405abb6146d14b3a8d2d303715e43b4a3425a7976b0325f41720
+SIZE (tdesktop-3.7.1-full.tar.gz) = 41363052
diff --git a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_media_view_media__view__overlay__widget.cpp b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_media_view_media__view__overlay__widget.cpp
new file mode 100644
index 000000000000..3ad29281ce5d
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_media_view_media__view__overlay__widget.cpp
@@ -0,0 +1,11 @@
+--- Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp.orig	2022-04-20 09:56:09 UTC
++++ Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
+@@ -499,7 +499,7 @@ void OverlayWidget::moveToScreen(bool inMove) {
+ 		DEBUG_LOG(("Viewer Pos: Currently on screen %1, moving to screen %2")
+ 			.arg(screenList.indexOf(myScreen))
+ 			.arg(screenList.indexOf(activeWindowScreen)));
+-		_widget->setScreen(activeWindowScreen);
++		window()->setScreen(activeWindowScreen);
+ 		DEBUG_LOG(("Viewer Pos: New actual screen: %1")
+ 			.arg(screenList.indexOf(_widget->screen())));
+ 	}
diff --git a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_media_view_media__view__pip.cpp b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_media_view_media__view__pip.cpp
new file mode 100644
index 000000000000..509b4addb73c
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_media_view_media__view__pip.cpp
@@ -0,0 +1,11 @@
+--- Telegram/SourceFiles/media/view/media_view_pip.cpp.orig	2022-04-20 09:56:09 UTC
++++ Telegram/SourceFiles/media/view/media_view_pip.cpp
+@@ -475,7 +475,7 @@ void PipPanel::setPositionDefault() {
+ 	const auto parentScreen = widgetScreen(_parent);
+ 	const auto myScreen = widgetScreen(widget());
+ 	if (parentScreen && myScreen && myScreen != parentScreen) {
+-		widget()->setScreen(parentScreen);
++		widget()->windowHandle()->setScreen(parentScreen);
+ 	}
+ 	auto position = Position();
+ 	position.snapped = RectPart::Top | RectPart::Left;
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_hunspell_tests_suggestiontest_Makefile b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_hunspell_tests_suggestiontest_Makefile
new file mode 100644
index 000000000000..b43f7ce18f54
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_hunspell_tests_suggestiontest_Makefile
@@ -0,0 +1,14 @@
+--- Telegram/ThirdParty/hunspell/tests/suggestiontest/Makefile.orig	2020-03-16 13:55:43 UTC
++++ Telegram/ThirdParty/hunspell/tests/suggestiontest/Makefile
+@@ -1,11 +0,0 @@
+-all:
+-	./prepare
+-	./test
+-
+-single:
+-	./prepare2
+-	./test
+-
+-clean:
+-	rm *.[1-5] result.*
+-
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__ui_CMakeLists.txt b/net-im/telegram-desktop/files/patch-Telegram_lib__ui_CMakeLists.txt
new file mode 100644
index 000000000000..5f9b7cc0b66d
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__ui_CMakeLists.txt
@@ -0,0 +1,48 @@
+--- Telegram/lib_ui/CMakeLists.txt.orig	2022-04-20 07:41:10 UTC
++++ Telegram/lib_ui/CMakeLists.txt
+@@ -4,6 +4,13 @@
+ # For license and copyright information please follow this link:
+ # https://github.com/desktop-app/legal/blob/master/LEGAL
+ 
++if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION AND NOT DESKTOP_APP_QT6)
++    find_package(ECM REQUIRED)
++    set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
++    find_package(QtWaylandScanner REQUIRED)
++    find_package(WaylandProtocols)
++endif()
++
+ add_library(lib_ui STATIC)
+ add_library(desktop-app::lib_ui ALIAS lib_ui)
+ init_target(lib_ui)
+@@ -20,6 +27,12 @@ set(style_files
+     ui/widgets/widgets.style
+ )
+ 
++if (WaylandProtocols_FOUND)
++    set(wayland_protocols_loc ${WaylandProtocols_DATADIR})
++else()
++    set(wayland_protocols_loc ${third_party_loc}/wayland-protocols)
++endif()
++
+ generate_palette(lib_ui ui/colors.palette)
+ generate_styles(lib_ui ${src_loc} "${style_files}" ui/colors.palette)
+ generate_emoji(lib_ui emoji.txt emoji_suggestions/emoji_autocomplete.json)
+@@ -273,10 +286,16 @@ elseif(LINUX)
+     if (DESKTOP_APP_QT6)
+         qt6_generate_wayland_protocol_client_sources(lib_ui
+         FILES
+-            ${third_party_loc}/wayland-protocols/stable/xdg-shell/xdg-shell.xml
++            ${wayland_protocols_loc}/stable/xdg-shell/xdg-shell.xml
+         )
+     else()
+-        message(FATAL_ERROR "This piece of cmake code is not ported to Qt 5")
++        ecm_add_qtwayland_client_protocol(xdg_shell_protocol_srcs
++            PROTOCOL ${wayland_protocols_loc}/stable/xdg-shell/xdg-shell.xml
++            BASENAME xdg-shell
++        )
++
++        target_sources(lib_ui PRIVATE ${xdg_shell_protocol_srcs})
++        target_include_directories(lib_ui PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+     endif()
+ 
+     target_link_libraries(lib_ui
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__ui_ui_rp__widget.cpp b/net-im/telegram-desktop/files/patch-Telegram_lib__ui_ui_rp__widget.cpp
new file mode 100644
index 000000000000..581641a6706d
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__ui_ui_rp__widget.cpp
@@ -0,0 +1,24 @@
+--- Telegram/lib_ui/ui/rp_widget.cpp.orig	2022-04-20 07:41:10 UTC
++++ Telegram/lib_ui/ui/rp_widget.cpp
+@@ -11,6 +11,8 @@
+ #include <QtGui/QWindow>
+ #include <QtGui/QtEvents>
+ 
++#include <private/qwidget_p.h>
++
+ namespace Ui {
+ namespace {
+ 
+@@ -207,3 +209,12 @@ auto RpWidgetWrap::eventStreams() const -> EventStream
+ }
+ 
+ } // namespace Ui
++
++#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
++
++bool TWidget::setScreen(QScreen *next) {
++	// This method becomes public in Qt6. So anyway reveal it right here.
++	return qt_widget_private(this)->setScreen(next);
++}
++
++#endif  // Qt < 6.0.0
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__ui_ui_rp__widget.h b/net-im/telegram-desktop/files/patch-Telegram_lib__ui_ui_rp__widget.h
new file mode 100644
index 000000000000..63c0f4eeeb0e
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__ui_ui_rp__widget.h
@@ -0,0 +1,13 @@
+--- Telegram/lib_ui/ui/rp_widget.h.orig	2022-04-20 07:41:10 UTC
++++ Telegram/lib_ui/ui/rp_widget.h
+@@ -206,6 +206,10 @@ class TWidget : public TWidgetHelper<QWidget> { (publi
+ 		return rectNoMargins().size();
+ 	}
+ 
++#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
++	bool setScreen(QScreen*);
++#endif  // Qt < 6.0.0
++
+ 	// Updates the area that is visible inside the scroll container.
+ 	void setVisibleTopBottom(int visibleTop, int visibleBottom) {
+ 		auto max = height();