From 47d7bd95ae9390754c9d33abc5d54e399c282d9d Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 1 Jun 2020 12:25:37 +0400 Subject: [PATCH] Add a method to check if gtk integration is forced --- .../SourceFiles/platform/linux/specific_linux.cpp | 14 ++++++++++++++ .../SourceFiles/platform/linux/specific_linux.h | 1 + 2 files changed, 15 insertions(+) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index b291c6d708..c902ceff77 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -263,6 +263,20 @@ bool IsStaticBinary() { #endif // !DESKTOP_APP_USE_PACKAGED } +bool IsGtkIntegrationForced() { +#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION + static const auto GtkIntegration = [&] { + const auto platformThemes = QString::fromUtf8(qgetenv("QT_QPA_PLATFORMTHEME")).split(':'); + return platformThemes.contains(qstr("gtk3"), Qt::CaseInsensitive) + || platformThemes.contains(qstr("gtk2"), Qt::CaseInsensitive); + }(); + + return GtkIntegration; +#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION + + return false; +} + bool IsGtkFileDialogForced() { #ifdef TDESKTOP_FORCE_GTK_FILE_DIALOG return true; diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.h b/Telegram/SourceFiles/platform/linux/specific_linux.h index a0cff2971f..e6fca0147e 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.h +++ b/Telegram/SourceFiles/platform/linux/specific_linux.h @@ -24,6 +24,7 @@ bool InSandbox(); bool InSnap(); bool InAppImage(); bool IsStaticBinary(); +bool IsGtkIntegrationForced(); bool IsGtkFileDialogForced(); bool IsQtPluginsBundled();