summaryrefslogtreecommitdiff
path: root/net-im/telegram-desktop/files/tdesktop-5.0.1-qt6-no-wayland.patch
blob: 10a8743a0d31c2f0d9f26cf631754d88920e6b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Allow disabling wayland integration for Qt6 builds

Upstream has removed the required toggle for wayland integration, and instead
is forcing it when the program is being built with Qt6 version 6.5.0 or higher.

Currently this is simple to work around, but its future feasibility remains to
be seen, depending on what upstream thinks about this.

https://bugs.gentoo.org/928451
https://github.com/desktop-app/cmake_helpers/commit/a428df5440e76a726abc30924766ac7da0cb381c

--- tdesktop-5.0.1-full.orig/Telegram/lib_base/base/platform/linux/base_linux_xdg_activation_token.cpp
+++ tdesktop-5.0.1-full/Telegram/lib_base/base/platform/linux/base_linux_xdg_activation_token.cpp
@@ -15,7 +15,7 @@
 namespace base::Platform {
 
 void RunWithXdgActivationToken(Fn<void(QString)> callback) {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+#if !defined DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 	const auto window = QGuiApplication::focusWindow();
 	if (!window) {
 		callback({});
--- tdesktop-5.0.1-full.orig/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp
+++ tdesktop-5.0.1-full/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp
@@ -413,7 +413,7 @@
 }
 #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
 
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+#if !defined DESKTOP_APP_DISABLE_X11_INTEGRATION && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 void ShowWaylandWindowMenu(not_null<QWidget*> widget, const QPoint &point) {
 	static const auto wl_proxy_marshal_array = [] {
 		void (*result)(
@@ -533,7 +533,7 @@
 }
 
 bool WindowMarginsSupported() {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+#if !defined DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 	static const auto WaylandResult = [] {
 		using namespace QNativeInterface::Private;
 		QWindow window;
@@ -560,7 +560,7 @@
 }
 
 void SetWindowMargins(not_null<QWidget*> widget, const QMargins &margins) {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+#if !defined DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 	using namespace QNativeInterface::Private;
 	const auto window = not_null(widget->windowHandle());
 	const auto platformWindow = not_null(window->handle());
@@ -582,7 +582,7 @@
 }
 
 void UnsetWindowMargins(not_null<QWidget*> widget) {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+#if !defined DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 	using namespace QNativeInterface::Private;
 	if (const auto native = not_null(widget->windowHandle())
 			->nativeInterface<QWaylandWindow>()) {
@@ -600,7 +600,7 @@
 }
 
 void ShowWindowMenu(not_null<QWidget*> widget, const QPoint &point) {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+#if !defined DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 	if (::Platform::IsWayland()) {
 		ShowWaylandWindowMenu(widget, point);
 		return;
--- tdesktop-5.0.1-full.orig/cmake/options.cmake
+++ tdesktop-5.0.1-full/cmake/options.cmake
@@ -23,6 +23,13 @@
     )
 endif()
 
+if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
+    target_compile_definitions(common_options
+    INTERFACE
+        DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
+    )
+endif()
+
 if (WIN32)
     include(cmake/options_win.cmake)
 elseif (APPLE)
--- tdesktop-5.0.1-full.orig/cmake/variables.cmake
+++ tdesktop-5.0.1-full/cmake/variables.cmake
@@ -21,6 +21,7 @@
 
 option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON)
 cmake_dependent_option(DESKTOP_APP_DISABLE_X11_INTEGRATION "Disable all code for X11 integration." OFF LINUX ON)
+cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF LINUX ON)
 cmake_dependent_option(DESKTOP_APP_USE_ALLOCATION_TRACER "Use simple allocation tracer." OFF LINUX OFF)
 cmake_dependent_option(DESKTOP_APP_USE_PACKAGED_LAZY "Bundle recommended Qt plugins for self-contained packages." OFF LINUX OFF)
 option(DESKTOP_APP_USE_PACKAGED_FONTS "Use preinstalled fonts instead of bundled patched ones." OFF)