mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Add DESKTOP_APP_DISABLE_X11_INTEGRATION
This commit is contained in:
parent
a40a8ac7ee
commit
14b09e88d6
4 changed files with 51 additions and 11 deletions
|
@ -73,7 +73,6 @@ PRIVATE
|
||||||
if (LINUX)
|
if (LINUX)
|
||||||
target_link_libraries(Telegram
|
target_link_libraries(Telegram
|
||||||
PRIVATE
|
PRIVATE
|
||||||
desktop-app::external_xcb
|
|
||||||
desktop-app::external_glib
|
desktop-app::external_glib
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -85,6 +84,13 @@ if (LINUX)
|
||||||
)
|
)
|
||||||
endif()
|
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)
|
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||||
target_link_libraries(Telegram
|
target_link_libraries(Telegram
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
@ -97,20 +103,22 @@ if (LINUX)
|
||||||
|
|
||||||
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_USE_PACKAGED_LAZY)
|
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(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
|
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
|
||||||
PRIVATE
|
pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11)
|
||||||
PkgConfig::GTK3
|
target_link_libraries(Telegram PRIVATE PkgConfig::X11)
|
||||||
PkgConfig::X11
|
endif()
|
||||||
)
|
|
||||||
else()
|
else()
|
||||||
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
|
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
|
||||||
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
|
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
|
||||||
target_link_libraries(Telegram PRIVATE X11)
|
target_link_libraries(Telegram PRIVATE X11)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
target_precompile_headers(Telegram PRIVATE ${src_loc}/stdafx.h)
|
target_precompile_headers(Telegram PRIVATE ${src_loc}/stdafx.h)
|
||||||
nice_target_sources(Telegram ${src_loc}
|
nice_target_sources(Telegram ${src_loc}
|
||||||
|
|
|
@ -10,11 +10,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/platform/linux/base_linux_gtk_integration_p.h"
|
#include "base/platform/linux/base_linux_gtk_integration_p.h"
|
||||||
#include "platform/linux/linux_gtk_integration_p.h"
|
#include "platform/linux/linux_gtk_integration_p.h"
|
||||||
|
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#undef signals
|
#undef signals
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#define signals public
|
#define signals public
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
@ -29,6 +31,7 @@ enum class GtkLoaded {
|
||||||
|
|
||||||
GtkLoaded gdk_helper_loaded = GtkLoaded::GtkNone;
|
GtkLoaded gdk_helper_loaded = GtkLoaded::GtkNone;
|
||||||
|
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
// To be able to compile with gtk-3.0 headers as well
|
// To be able to compile with gtk-3.0 headers as well
|
||||||
#define GdkDrawable GdkWindow
|
#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);
|
using f_gdk_x11_window_get_xid = Window(*)(GdkWindow *window);
|
||||||
f_gdk_x11_window_get_xid gdk_x11_window_get_xid = nullptr;
|
f_gdk_x11_window_get_xid gdk_x11_window_get_xid = nullptr;
|
||||||
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
bool GdkHelperLoadGtk2(QLibrary &lib) {
|
bool GdkHelperLoadGtk2(QLibrary &lib) {
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
#ifdef LINK_TO_GTK
|
#ifdef LINK_TO_GTK
|
||||||
return false;
|
return false;
|
||||||
#else // LINK_TO_GTK
|
#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;
|
if (!LOAD_GTK_SYMBOL(lib, "gdk_x11_drawable_get_xid", gdk_x11_drawable_get_xid)) return false;
|
||||||
return true;
|
return true;
|
||||||
#endif // !LINK_TO_GTK
|
#endif // !LINK_TO_GTK
|
||||||
|
#else // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
return false;
|
||||||
|
#endif // DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GdkHelperLoadGtk3(QLibrary &lib) {
|
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_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_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_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;
|
if (!LOAD_GTK_SYMBOL(lib, "gdk_x11_window_get_xid", gdk_x11_window_get_xid)) return false;
|
||||||
return true;
|
return true;
|
||||||
|
#else // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
return false;
|
||||||
|
#endif // DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdkHelperLoad(QLibrary &lib) {
|
void GdkHelperLoad(QLibrary &lib) {
|
||||||
|
@ -86,10 +98,15 @@ void GdkHelperLoad(QLibrary &lib) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GdkHelperLoaded() {
|
bool GdkHelperLoaded() {
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
return gdk_helper_loaded != GtkLoaded::GtkNone;
|
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) {
|
void XSetTransientForHint(GdkWindow *window, quintptr winId) {
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
if (gdk_helper_loaded == GtkLoaded::Gtk2) {
|
if (gdk_helper_loaded == GtkLoaded::Gtk2) {
|
||||||
::XSetTransientForHint(gdk_x11_drawable_get_xdisplay(window),
|
::XSetTransientForHint(gdk_x11_drawable_get_xdisplay(window),
|
||||||
gdk_x11_drawable_get_xid(window),
|
gdk_x11_drawable_get_xid(window),
|
||||||
|
@ -101,6 +118,7 @@ void XSetTransientForHint(GdkWindow *window, quintptr winId) {
|
||||||
winId);
|
winId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
|
@ -24,18 +24,21 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/platform/linux/base_linux_xcb_utilities.h"
|
|
||||||
#include "base/call_delayed.h"
|
#include "base/call_delayed.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "facades.h"
|
#include "facades.h"
|
||||||
#include "app.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/QSize>
|
||||||
|
#include <QtCore/QTemporaryFile>
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
#include <QtCore/QTemporaryFile>
|
|
||||||
#include <QtDBus/QDBusInterface>
|
#include <QtDBus/QDBusInterface>
|
||||||
#include <QtDBus/QDBusConnection>
|
#include <QtDBus/QDBusConnection>
|
||||||
#include <QtDBus/QDBusConnectionInterface>
|
#include <QtDBus/QDBusConnectionInterface>
|
||||||
|
@ -82,6 +85,7 @@ base::flat_map<int, QImage> TrayIconImageBack;
|
||||||
QIcon TrayIcon;
|
QIcon TrayIcon;
|
||||||
QString TrayIconThemeName, TrayIconName;
|
QString TrayIconThemeName, TrayIconName;
|
||||||
|
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
bool XCBSkipTaskbar(QWindow *window, bool set) {
|
bool XCBSkipTaskbar(QWindow *window, bool set) {
|
||||||
const auto connection = base::Platform::XCB::GetConnectionFromQt();
|
const auto connection = base::Platform::XCB::GetConnectionFromQt();
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
|
@ -131,11 +135,14 @@ bool XCBSkipTaskbar(QWindow *window, bool set) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
bool SkipTaskbar(QWindow *window, bool set) {
|
bool SkipTaskbar(QWindow *window, bool set) {
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
if (!IsWayland()) {
|
if (!IsWayland()) {
|
||||||
return XCBSkipTaskbar(window, set);
|
return XCBSkipTaskbar(window, set);
|
||||||
}
|
}
|
||||||
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "platform/linux/specific_linux.h"
|
#include "platform/linux/specific_linux.h"
|
||||||
|
|
||||||
#include "base/platform/base_platform_info.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 "base/platform/linux/base_linux_gtk_integration.h"
|
||||||
#include "ui/platform/ui_platform_utility.h"
|
#include "ui/platform/ui_platform_utility.h"
|
||||||
#include "platform/linux/linux_desktop_environment.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 "core/update_checker.h"
|
||||||
#include "window/window_controller.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
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
#include "platform/linux/linux_notification_service_watcher.h"
|
#include "platform/linux/linux_notification_service_watcher.h"
|
||||||
#include "platform/linux/linux_gsd_media_keys.h"
|
#include "platform/linux/linux_gsd_media_keys.h"
|
||||||
|
@ -577,8 +580,12 @@ bool TrayIconSupported() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkipTaskbarSupported() {
|
bool SkipTaskbarSupported() {
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
return !IsWayland()
|
return !IsWayland()
|
||||||
&& base::Platform::XCB::IsSupportedByWM("_NET_WM_STATE_SKIP_TASKBAR");
|
&& base::Platform::XCB::IsSupportedByWM("_NET_WM_STATE_SKIP_TASKBAR");
|
||||||
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
Loading…
Add table
Reference in a new issue