mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-18 11:39:31 +01:00
Dont allow X11 shortcuts on wayland
This commit is contained in:
parent
1a0bc75629
commit
27233d2549
@ -30,6 +30,9 @@
|
|||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
# include <QDBusConnectionInterface>
|
# include <QDBusConnectionInterface>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_X11
|
||||||
|
#include <QX11Info>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
@ -83,11 +86,17 @@ GlobalShortcuts::GlobalShortcuts(QWidget *parent)
|
|||||||
dbus_backend_ = new GlobalShortcutBackendGSD(this);
|
dbus_backend_ = new GlobalShortcutBackendGSD(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_X11) || defined(Q_OS_WIN)
|
#ifdef Q_OS_MACOS
|
||||||
|
if (!system_backend_)
|
||||||
|
system_backend_ = new GlobalShortcutBackendMacOS(this);
|
||||||
|
#endif
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
if (!system_backend_)
|
||||||
system_backend_ = new GlobalShortcutBackendSystem(this);
|
system_backend_ = new GlobalShortcutBackendSystem(this);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MACOS
|
#if defined(HAVE_X11)
|
||||||
system_backend_ = new GlobalShortcutBackendMacOS(this);
|
if (!system_backend_ && IsX11Available())
|
||||||
|
system_backend_ = new GlobalShortcutBackendSystem(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReloadSettings();
|
ReloadSettings();
|
||||||
@ -98,7 +107,7 @@ void GlobalShortcuts::ReloadSettings() {
|
|||||||
|
|
||||||
// The actual shortcuts have been set in our actions for us by the config dialog already - we just need to reread the gnome settings.
|
// The actual shortcuts have been set in our actions for us by the config dialog already - we just need to reread the gnome settings.
|
||||||
use_gsd_ = settings_.value("use_gsd", true).toBool();
|
use_gsd_ = settings_.value("use_gsd", true).toBool();
|
||||||
use_x11_ = settings_.value("use_x11", true).toBool();
|
use_x11_ = settings_.value("use_x11", false).toBool();
|
||||||
|
|
||||||
Unregister();
|
Unregister();
|
||||||
Register();
|
Register();
|
||||||
@ -144,7 +153,7 @@ bool GlobalShortcuts::IsGsdAvailable() const {
|
|||||||
bool GlobalShortcuts::IsX11Available() const {
|
bool GlobalShortcuts::IsX11Available() const {
|
||||||
|
|
||||||
#ifdef HAVE_X11
|
#ifdef HAVE_X11
|
||||||
return true;
|
return QX11Info::isPlatformX11();
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@ -154,9 +163,13 @@ bool GlobalShortcuts::IsX11Available() const {
|
|||||||
void GlobalShortcuts::Register() {
|
void GlobalShortcuts::Register() {
|
||||||
if (use_gsd_ && dbus_backend_ && dbus_backend_->Register()) return;
|
if (use_gsd_ && dbus_backend_ && dbus_backend_->Register()) return;
|
||||||
#ifdef HAVE_X11 // If this system has X11, only use the system backend if X11 is enabled in the global shortcut settings
|
#ifdef HAVE_X11 // If this system has X11, only use the system backend if X11 is enabled in the global shortcut settings
|
||||||
if (use_x11_)
|
if (use_x11_) {
|
||||||
|
#endif
|
||||||
|
if (system_backend_)
|
||||||
|
system_backend_->Register();
|
||||||
|
#ifdef HAVE_X11
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (system_backend_) system_backend_->Register();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcuts::Unregister() {
|
void GlobalShortcuts::Unregister() {
|
||||||
@ -178,4 +191,3 @@ void GlobalShortcuts::ShowMacAccessibilityDialog() {
|
|||||||
if (system_backend_) static_cast<GlobalShortcutBackendMacOS*>(system_backend_)->ShowAccessibilityDialog();
|
if (system_backend_) static_cast<GlobalShortcutBackendMacOS*>(system_backend_)->ShowAccessibilityDialog();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user