diff options
Diffstat (limited to 'opentrack/shortcuts.cpp')
-rw-r--r-- | opentrack/shortcuts.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index 2caa1790..e1087008 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -9,17 +9,30 @@ #include "shortcuts.h" #include "win32-shortcuts.h" -void Shortcuts::bind_keyboard_shortcut(K &key, const key_opts& k, unused(bool, held)) +void Shortcuts::free_binding(K& key) { -#if !defined(_WIN32) - using sh = QxtGlobalShortcut; +#ifndef _WIN32 if (key) { key->setEnabled(false); key->setShortcut(QKeySequence::UnknownKey); - std::shared_ptr<sh> tmp(nullptr); + std::shared_ptr<QxtGlobalShortcut> tmp(nullptr); key.swap(tmp); } +#else + key.keycode = 0; + key.guid = ""; +#endif +} + +void Shortcuts::bind_keyboard_shortcut(K &key, const key_opts& k, unused(bool, held)) +{ +#if !defined(_WIN32) + using sh = QxtGlobalShortcut; + if (key) + { + free_binding(key); + } key = std::make_shared<sh>(); |