From bb8ffcac3a7f86b4513c5a75e51d822d0baee077 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 28 Jul 2022 07:33:04 +0400 Subject: [PATCH] Default to Wayland on GNOME for new installs --- Telegram/SourceFiles/core/launcher.cpp | 5 +++-- .../SourceFiles/platform/linux/specific_linux.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 222342380..bba639451 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "platform/platform_launcher.h" #include "platform/platform_specific.h" -#include "platform/linux/linux_desktop_environment.h" #include "base/platform/base_platform_info.h" #include "base/platform/base_platform_file_utilities.h" #include "ui/main_queue_processor.h" @@ -62,7 +61,9 @@ FilteredCommandLineArguments::FilteredCommandLineArguments( #endif // !Q_OS_WIN } #elif defined Q_OS_UNIX - if (Platform::DesktopEnvironment::IsGnome() && qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM")) { + if (QFile::exists(cWorkingDir() + qsl("tdata/nowayland")) + && qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM")) { + LOG(("Wayland: Disable on old installations")); pushArgument("-platform"); pushArgument("xcb;wayland"); } diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 47149e748..73d7e7c20 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -638,6 +638,18 @@ void finish() { void psNewVersion() { Platform::InstallLauncher(); + if (Local::oldSettingsVersion() > 0 + && Local::oldSettingsVersion() <= 4000002 + && qEnvironmentVariableIsSet("WAYLAND_DISPLAY") + && DesktopEnvironment::IsGnome() + && !QFile::exists(cWorkingDir() + qsl("tdata/nowayland"))) { + QFile f(cWorkingDir() + qsl("tdata/nowayland")); + if (f.open(QIODevice::WriteOnly)) { + f.write("1"); + f.close(); + Core::Restart(); // restart with X backend + } + } } void psSendToMenu(bool send, bool silent) {