Fix running with QT_QPA_PLATFORMTHEME=gtk2

From: https://bugs.archlinux.org/task/71541

--- tdesktop-2.8.11-full.orig/Telegram/CMakeLists.txt
+++ tdesktop-2.8.11-full/Telegram/CMakeLists.txt
@@ -114,25 +114,16 @@
     endif()
 
     if (NOT DESKTOP_APP_DISABLE_GTK_INTEGRATION)
-        target_link_libraries(Telegram PRIVATE rt)
         find_package(PkgConfig REQUIRED)
 
-        if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
-            pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
-            target_link_libraries(Telegram PRIVATE PkgConfig::GTK3)
-
-            if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
-                pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11)
-                target_link_libraries(Telegram PRIVATE PkgConfig::X11)
-            endif()
-        else()
-            pkg_check_modules(GTK REQUIRED gtk+-3.0)
-            target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
+        pkg_check_modules(GTK REQUIRED gtk+-3.0)
+        target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
 
-            if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
-                target_link_libraries(Telegram PRIVATE X11)
-            endif()
+        if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
+            target_link_libraries(Telegram PRIVATE X11)
         endif()
+
+        target_link_libraries(Telegram PRIVATE rt)
     endif()
 endif()
 
--- tdesktop-2.8.11-full.orig/Telegram/lib_base/CMakeLists.txt
+++ tdesktop-2.8.11-full/Telegram/lib_base/CMakeLists.txt
@@ -254,13 +254,8 @@
     if (NOT DESKTOP_APP_DISABLE_GTK_INTEGRATION)
         find_package(PkgConfig REQUIRED)
 
-        if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
-            pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
-            target_link_libraries(lib_base PUBLIC PkgConfig::GTK3)
-        else()
-            pkg_check_modules(GTK REQUIRED gtk+-3.0)
-            target_include_directories(lib_base PUBLIC ${GTK_INCLUDE_DIRS})
-        endif()
+        pkg_check_modules(GTK REQUIRED gtk+-3.0)
+        target_include_directories(lib_base PUBLIC ${GTK_INCLUDE_DIRS})
     endif()
 endif()
 
--- tdesktop-2.8.11-full.orig/Telegram/lib_base/base/platform/linux/base_linux_gtk_integration_p.h
+++ tdesktop-2.8.11-full/Telegram/lib_base/base/platform/linux/base_linux_gtk_integration_p.h
@@ -13,15 +13,7 @@
 #include <gdk/gdk.h>
 } // extern "C"
 
-#if defined DESKTOP_APP_USE_PACKAGED && !defined DESKTOP_APP_USE_PACKAGED_LAZY
-#define LINK_TO_GTK
-#endif // DESKTOP_APP_USE_PACKAGED && !DESKTOP_APP_USE_PACKAGED_LAZY
-
-#ifdef LINK_TO_GTK
-#define LOAD_GTK_SYMBOL(lib, func) (func = ::func)
-#else // LINK_TO_GTK
 #define LOAD_GTK_SYMBOL LOAD_LIBRARY_SYMBOL
-#endif // !LINK_TO_GTK
 
 namespace base {
 namespace Platform {
@@ -31,11 +23,7 @@
 		QLibrary &lib,
 		const char *name,
 		std::optional<int> version = std::nullopt) {
-#ifdef LINK_TO_GTK
-	return true;
-#else // LINK_TO_GTK
 	return LoadLibrary(lib, name, version);
-#endif // LINK_TO_GTK
 }
 
 inline gboolean (*gtk_init_check)(int *argc, char ***argv) = nullptr;
--- tdesktop-2.8.11-full.orig/Telegram/lib_webview/CMakeLists.txt
+++ tdesktop-2.8.11-full/Telegram/lib_webview/CMakeLists.txt
@@ -51,19 +51,11 @@
     if (NOT DESKTOP_APP_DISABLE_WEBKIT)
         find_package(PkgConfig REQUIRED)
 
-        if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
-            pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
-            target_link_libraries(lib_webview PUBLIC PkgConfig::GTK3)
+        pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
+        target_include_directories(lib_webview PUBLIC ${GTK3_INCLUDE_DIRS})
 
-            pkg_check_modules(WEBKIT REQUIRED IMPORTED_TARGET webkit2gtk-4.0)
-            target_link_libraries(lib_webview PUBLIC PkgConfig::WEBKIT)
-        else()
-            pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
-            target_include_directories(lib_webview PUBLIC ${GTK3_INCLUDE_DIRS})
-
-            pkg_check_modules(WEBKIT REQUIRED webkit2gtk-4.0)
-            target_include_directories(lib_webview PUBLIC ${WEBKIT_INCLUDE_DIRS})
-        endif()
+        pkg_check_modules(WEBKIT REQUIRED webkit2gtk-4.0)
+        target_include_directories(lib_webview PUBLIC ${WEBKIT_INCLUDE_DIRS})
     else()
         remove_target_sources(lib_webview ${src_loc}
             webview/platform/linux/webview_linux_webkit_gtk.cpp
