From 9e447383df0763d427ee90c382ae39f178226dc3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 13 Feb 2025 20:54:36 +0400 Subject: [PATCH] Support Shift+.. shortcuts on Linux. --- .../settings/settings_shortcuts.cpp | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/settings/settings_shortcuts.cpp b/Telegram/SourceFiles/settings/settings_shortcuts.cpp index b2df7fab7..82693c726 100644 --- a/Telegram/SourceFiles/settings/settings_shortcuts.cpp +++ b/Telegram/SourceFiles/settings/settings_shortcuts.cpp @@ -24,6 +24,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) +#include +#endif + namespace Settings { namespace { @@ -401,14 +405,24 @@ struct Labeled { return base::EventFilterResult::Cancel; } const auto r = [&] { - auto result = k; + auto result = int(k); if (m & Qt::ShiftModifier) { - const auto keys = integration->possibleKeys(key); - for (const auto possible : keys) { - if (possible > m) { - return possible - m; +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) + const auto mapper = integration->keyMapper(); + const auto list = mapper->possibleKeyCombinations(key); + for (const auto &possible : list) { + if (possible.keyboardModifiers() == m) { + return int(possible.key()); } } +#else // Qt >= 6.7.0 + const auto keys = integration->possibleKeys(key); + for (const auto possible : keys) { + if (possible > int(m)) { + return possible - int(m); + } + } +#endif // Qt < 6.7.0 } return result; }();