diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 7554fd08db..8ab77377af 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -157,7 +157,7 @@ if (LINUX) endif() endif() -if (LINUX AND (NOT TDESKTOP_DISABLE_GTK_INTEGRATION OR NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)) +if (LINUX) find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GOBJECT REQUIRED IMPORTED_TARGET gobject-2.0) @@ -170,6 +170,7 @@ if (LINUX AND (NOT TDESKTOP_DISABLE_GTK_INTEGRATION OR NOT DESKTOP_APP_DISABLE_D PkgConfig::GIO ) + target_compile_definitions(Telegram PRIVATE G_LOG_DOMAIN="Telegram") target_compile_options(Telegram PRIVATE -Wno-register) endif() diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 87cc33e793..69744dc20a 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -44,6 +44,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#include + namespace Platform { namespace { @@ -737,6 +739,13 @@ void MainWindow::LibsLoaded() { qDBusRegisterMetaType(); qDBusRegisterMetaType(); #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION + + if (!qEnvironmentVariableIsSet(kDisableTrayCounter.utf8())) { + g_warning( + "You can disable tray icon counter with %s " + "and make it look better if it is monochrome.", + kDisableTrayCounter.utf8().constData()); + } } void MainWindow::initTrayMenuHook() { diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 6cc1295f56..3076279b07 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -46,6 +46,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #endif // Qt < 5.13 && !DESKTOP_APP_QT_PATCHED +#include + #include #include #include @@ -62,6 +64,9 @@ using QtWaylandClient::QWaylandWindow; namespace Platform { namespace { +constexpr auto kDisableGtkIntegration = "TDESKTOP_DISABLE_GTK_INTEGRATION"_cs; +constexpr auto kIgnoreGtkIncompatibility = "TDESKTOP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY"_cs; + constexpr auto kDesktopFile = ":/misc/telegramdesktop.desktop"_cs; constexpr auto kSnapLauncherDir = "/var/lib/snapd/desktop/applications/"_cs; constexpr auto kIconName = "telegram"_cs; @@ -644,7 +649,7 @@ bool IsStaticBinary() { bool UseGtkIntegration() { #ifndef TDESKTOP_DISABLE_GTK_INTEGRATION static const auto Result = !qEnvironmentVariableIsSet( - "TDESKTOP_DISABLE_GTK_INTEGRATION"); + kDisableGtkIntegration.utf8()); return Result; #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION @@ -1162,11 +1167,49 @@ void start() { if (UseGtkIntegration() && !IsStaticBinary() && !qEnvironmentVariableIsSet( - "TDESKTOP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY")) { + kIgnoreGtkIncompatibility.utf8())) { + g_warning( + "Unfortunately, GTK integration " + "conflicts with qgtk2 platformtheme and style. " + "Therefore, QT_QPA_PLATFORMTHEME " + "and QT_STYLE_OVERRIDE will be unset."); + + g_warning( + "This can be ignored by setting %s environment variable " + "to any value, however, if qgtk2 theme or style is used, " + "this will lead to a crash.", + kIgnoreGtkIncompatibility.utf8().constData()); + + g_warning( + "GTK integration can be disabled by setting %s to any value. " + "Keep in mind that this will lead to clipboard issues " + "and tdesktop will be unable to get settings from GTK " + "(such as decoration layout, dark mode & more).", + kDisableGtkIntegration.utf8().constData()); + qunsetenv("QT_QPA_PLATFORMTHEME"); qunsetenv("QT_STYLE_OVERRIDE"); } + if (!UseGtkIntegration()) { + g_warning( + "GTK integration was disabled on build or in runtime. " + "This will lead to clipboard issues and a lack of some features " + "(like Auto-Night Mode or system window controls layout)."); + } + +#ifdef DESKTOP_APP_USE_PACKAGED_RLOTTIE + g_warning( + "Application has been built with foreign rlottie, " + "animated emojis won't be colored to the selected pack."); +#endif // DESKTOP_APP_USE_PACKAGED_RLOTTIE + +#ifdef DESKTOP_APP_USE_PACKAGED_FONTS + g_warning( + "Application was built without embedded fonts, " + "this may lead to font issues."); +#endif // DESKTOP_APP_USE_PACKAGED_FONTS + if(IsStaticBinary() || InAppImage() || InFlatpak()