From 1b03098345b817cffcdf87f432b5e5b3814c501e Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Wed, 10 Nov 2021 09:35:01 +0100 Subject: FIX(client): Disable broken shortcuts on Wayland Our global shortcut system currently doesn't work when using Wayland (https://github.com/mumble-voip/mumble/issues/5257). Therefore, this commit makes sure that the global shortcut system is not even started on such systems. Furthermore, it informs the user about the shortcuts being disabled. Fixes #5303 --- src/mumble/GlobalShortcut.cpp | 12 ++++++++++++ src/mumble/GlobalShortcut.ui | 13 +++++++++++++ src/mumble/GlobalShortcut_unix.cpp | 7 +++++++ src/mumble/Settings.cpp | 14 ++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/src/mumble/GlobalShortcut.cpp b/src/mumble/GlobalShortcut.cpp index ab540cf68..0dae14e39 100644 --- a/src/mumble/GlobalShortcut.cpp +++ b/src/mumble/GlobalShortcut.cpp @@ -9,6 +9,7 @@ #include "Channel.h" #include "ClientUser.h" #include "Database.h" +#include "EnvUtils.h" #include "MainWindow.h" #include "Global.h" #include "GlobalShortcutButtons.h" @@ -525,6 +526,16 @@ GlobalShortcutConfig::GlobalShortcutConfig(Settings &st) : ConfigWidget(st) { qcbEnableGlobalShortcuts->setVisible(canDisable); + qlWaylandNote->setVisible(false); +#ifdef Q_OS_LINUX + if (EnvUtils::waylandIsUsed()) { + // Our global shortcut system doesn't work with Wayland + qlWaylandNote->setVisible(true); + + qgbShortcuts->setEnabled(false); + } +#endif + #ifdef Q_OS_MAC // Help Mac users enable accessibility access for Mumble... # if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) @@ -750,6 +761,7 @@ QTreeWidgetItem *GlobalShortcutConfig::itemForShortcut(const Shortcut &sc) const void GlobalShortcutConfig::reload() { std::stable_sort(qlShortcuts.begin(), qlShortcuts.end()); qtwShortcuts->clear(); + foreach (const Shortcut &sc, qlShortcuts) { QTreeWidgetItem *item = itemForShortcut(sc); qtwShortcuts->addTopLevelItem(item); diff --git a/src/mumble/GlobalShortcut.ui b/src/mumble/GlobalShortcut.ui index e2796c53e..af65a45c1 100644 --- a/src/mumble/GlobalShortcut.ui +++ b/src/mumble/GlobalShortcut.ui @@ -95,6 +95,19 @@ + + + + <html><head/><body><p>Mumble's Global Shortcuts system does currently not work in combination with the Wayland protocol. For more information, visit <a href="https://github.com/mumble-voip/mumble/issues/5257"><span style=" text-decoration: underline; color:#0057ae;">https://github.com/mumble-voip/mumble/issues/5257</span></a>.</p></body></html> + + + true + + + true + + + diff --git a/src/mumble/GlobalShortcut_unix.cpp b/src/mumble/GlobalShortcut_unix.cpp index 9c56bb616..0dab10101 100644 --- a/src/mumble/GlobalShortcut_unix.cpp +++ b/src/mumble/GlobalShortcut_unix.cpp @@ -5,6 +5,7 @@ #include "GlobalShortcut_unix.h" +#include "EnvUtils.h" #include "Settings.h" #include "Global.h" @@ -62,6 +63,12 @@ GlobalShortcutX::GlobalShortcutX() { } #ifdef Q_OS_LINUX + if (EnvUtils::waylandIsUsed()) { + qWarning("GlobalShortcutX: Global shortcuts don't work on Wayland (see " + "https://github.com/mumble-voip/mumble/issues/5257)"); + return; + } + if (Global::get().s.bEnableEvdev) { QString dir = QLatin1String("/dev/input"); QFileSystemWatcher *fsw = new QFileSystemWatcher(QStringList(dir), this); diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index 475e5eea4..86650c099 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -7,6 +7,7 @@ #include "AudioInput.h" #include "Cert.h" +#include "EnvUtils.h" #include "Log.h" #include "SSL.h" #include "Global.h" @@ -532,6 +533,12 @@ Settings::Settings() { bEnableXboxInput = true; bEnableUIAccess = true; +#ifdef Q_OS_LINUX + if (EnvUtils::waylandIsUsed()) { + bShortcutEnable = false; + } +#endif + for (int i = Log::firstMsgType; i <= Log::lastMsgType; ++i) { qmMessages.insert(i, Settings::LogConsole | Settings::LogBalloon | Settings::LogTTS | Settings::LogMessageLimit); @@ -1007,6 +1014,13 @@ void Settings::load(QSettings *settings_ptr) { LOAD(bEnableXboxInput, "shortcut/windows/xbox/enable"); LOAD(bEnableUIAccess, "shortcut/windows/uiaccess/enable"); +#ifdef Q_OS_LINUX + if (EnvUtils::waylandIsUsed()) { + // Global shortcuts don't work on Wayland + bShortcutEnable = false; + } +#endif + // Search options LOAD(searchForUsers, "search/search_for_users"); LOAD(searchForChannels, "search/search_for_channels"); -- cgit v1.2.3