summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2021-02-22 17:41:25 +0400
committerJohn Preston <johnprestonmail@gmail.com>2021-02-22 23:39:00 +0400
commit14b09e88d68a54038d5f1322c66d6c328c459624 (patch)
treeafc331ec87b7c1a777e112f26385c25c22c01685
parenta40a8ac7eeeaab8e686304b18d9ac0bdc2abee49 (diff)
Add DESKTOP_APP_DISABLE_X11_INTEGRATION
-rw-r--r--Telegram/CMakeLists.txt24
-rw-r--r--Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp18
-rw-r--r--Telegram/SourceFiles/platform/linux/main_window_linux.cpp11
-rw-r--r--Telegram/SourceFiles/platform/linux/specific_linux.cpp9
4 files changed, 51 insertions, 11 deletions
diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt
index b14b0aafad..aef5cce012 100644
--- a/Telegram/CMakeLists.txt
+++ b/Telegram/CMakeLists.txt
@@ -73,7 +73,6 @@ PRIVATE
if (LINUX)
target_link_libraries(Telegram
PRIVATE
- desktop-app::external_xcb
desktop-app::external_glib
)
@@ -85,6 +84,13 @@ if (LINUX)
)
endif()
+ if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
+ target_link_libraries(Telegram
+ PRIVATE
+ desktop-app::external_xcb
+ )
+ endif()
+
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
target_link_libraries(Telegram
PRIVATE
@@ -97,17 +103,19 @@ if (LINUX)
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
- pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11)
+ target_link_libraries(Telegram PRIVATE PkgConfig::GTK3)
- target_link_libraries(Telegram
- PRIVATE
- PkgConfig::GTK3
- PkgConfig::X11
- )
+ 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_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
- target_link_libraries(Telegram PRIVATE X11)
+
+ if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
+ target_link_libraries(Telegram PRIVATE X11)
+ endif()
endif()
endif()
endif()
diff --git a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp
index e7440da764..9a067ec805 100644
--- a/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp
+++ b/Telegram/SourceFiles/platform/linux/linux_gdk_helper.cpp
@@ -10,11 +10,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/linux/base_linux_gtk_integration_p.h"
#include "platform/linux/linux_gtk_integration_p.h"
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
extern "C" {
#undef signals
#include <gdk/gdkx.h>
#define signals public
} // extern "C"
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
namespace Platform {
namespace internal {
@@ -29,6 +31,7 @@ enum class GtkLoaded {
GtkLoaded gdk_helper_loaded = GtkLoaded::GtkNone;
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
// To be able to compile with gtk-3.0 headers as well
#define GdkDrawable GdkWindow
@@ -57,8 +60,10 @@ f_gdk_x11_display_get_xdisplay gdk_x11_display_get_xdisplay = nullptr;
using f_gdk_x11_window_get_xid = Window(*)(GdkWindow *window);
f_gdk_x11_window_get_xid gdk_x11_window_get_xid = nullptr;
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
bool GdkHelperLoadGtk2(QLibrary &lib) {
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
#ifdef LINK_TO_GTK
return false;
#else // LINK_TO_GTK
@@ -66,14 +71,21 @@ bool GdkHelperLoadGtk2(QLibrary &lib) {
if (!LOAD_GTK_SYMBOL(lib, "gdk_x11_drawable_get_xid", gdk_x11_drawable_get_xid)) return false;
return true;
#endif // !LINK_TO_GTK
+#else // !DESKTOP_APP_DISABLE_X11_INTEGRATION
+ return false;
+#endif // DESKTOP_APP_DISABLE_X11_INTEGRATION
}
bool GdkHelperLoadGtk3(QLibrary &lib) {
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
if (!LOAD_GTK_SYMBOL(lib, "gdk_x11_window_get_type", gdk_x11_window_get_type)) return false;
if (!LOAD_GTK_SYMBOL(lib, "gdk_window_get_display", gdk_window_get_display)) return false;
if (!LOAD_GTK_SYMBOL(lib, "gdk_x11_display_get_xdisplay", gdk_x11_display_get_xdisplay)) return false;
if (!LOAD_GTK_SYMBOL(lib, "gdk_x11_window_get_xid", gdk_x11_window_get_xid)) return false;
return true;
+#else // !DESKTOP_APP_DISABLE_X11_INTEGRATION
+ return false;
+#endif // DESKTOP_APP_DISABLE_X11_INTEGRATION
}
void GdkHelperLoad(QLibrary &lib) {
@@ -86,10 +98,15 @@ void GdkHelperLoad(QLibrary &lib) {
}
bool GdkHelperLoaded() {
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
return gdk_helper_loaded != GtkLoaded::GtkNone;
+#else // !DESKTOP_APP_DISABLE_X11_INTEGRATION
+ return true;
+#endif // DESKTOP_APP_DISABLE_X11_INTEGRATION
}
void XSetTransientForHint(GdkWindow *window, quintptr winId) {
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
if (gdk_helper_loaded == GtkLoaded::Gtk2) {
::XSetTransientForHint(gdk_x11_drawable_get_xdisplay(window),
gdk_x11_drawable_get_xid(window),
@@ -101,6 +118,7 @@ void XSetTransientForHint(GdkWindow *window, quintptr winId) {
winId);
}
}
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
}
} // namespace internal
diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp
index 367ec0a3e5..23b036f356 100644
--- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp
+++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp
@@ -24,18 +24,21 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h"
#include "window/window_session_controller.h"
#include "base/platform/base_platform_info.h"
-#include "base/platform/linux/base_linux_xcb_utilities.h"
#include "base/call_delayed.h"
#include "ui/widgets/popup_menu.h"
#include "ui/widgets/input_fields.h"
#include "facades.h"
#include "app.h"
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
+#include "base/platform/linux/base_linux_xcb_utilities.h"
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
+
#include <QtCore/QSize>
+#include <QtCore/QTemporaryFile>
#include <QtGui/QWindow>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
-#include <QtCore/QTemporaryFile>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface>
@@ -82,6 +85,7 @@ base::flat_map<int, QImage> TrayIconImageBack;
QIcon TrayIcon;
QString TrayIconThemeName, TrayIconName;
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
bool XCBSkipTaskbar(QWindow *window, bool set) {
const auto connection = base::Platform::XCB::GetConnectionFromQt();
if (!connection) {
@@ -131,11 +135,14 @@ bool XCBSkipTaskbar(QWindow *window, bool set) {
return true;
}
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
bool SkipTaskbar(QWindow *window, bool set) {
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
if (!IsWayland()) {
return XCBSkipTaskbar(window, set);
}
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
return false;
}
diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
index 73d1f94b51..d358cb0e88 100644
--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp
+++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp
@@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/linux/specific_linux.h"
#include "base/platform/base_platform_info.h"
-#include "base/platform/linux/base_linux_xcb_utilities.h"
#include "base/platform/linux/base_linux_gtk_integration.h"
#include "ui/platform/ui_platform_utility.h"
#include "platform/linux/linux_desktop_environment.h"
@@ -24,6 +23,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/update_checker.h"
#include "window/window_controller.h"
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
+#include "base/platform/linux/base_linux_xcb_utilities.h"
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
+
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "platform/linux/linux_notification_service_watcher.h"
#include "platform/linux/linux_gsd_media_keys.h"
@@ -577,8 +580,12 @@ bool TrayIconSupported() {
}
bool SkipTaskbarSupported() {
+#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
return !IsWayland()
&& base::Platform::XCB::IsSupportedByWM("_NET_WM_STATE_SKIP_TASKBAR");
+#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
+
+ return false;
}
} // namespace Platform