diff options
Diffstat (limited to 'opentrack/shortcuts.cpp')
-rw-r--r-- | opentrack/shortcuts.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index d1cfa503..77c57237 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -125,7 +125,7 @@ void KeybindingWorker::run() { PROCESS_KEY(kCenter, center()); PROCESS_KEY(kToggle, toggle()); - Sleep(25); + Sleep(14); } } #endif @@ -168,4 +168,25 @@ void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k) key.ctrl = k.ctrl; } #endif -}
\ No newline at end of file +} +void Shortcuts::reload() { +#ifndef _WIN32 + if (keyCenter) + { + keyCenter->setShortcut(QKeySequence::UnknownKey); + keyCenter->setEnabled(false); + } + if (keyToggle) + { + keyToggle->setShortcut(QKeySequence::UnknownKey); + keyToggle->setEnabled(false); + } +#endif + bind_keyboard_shortcut(keyCenter, s.center); + bind_keyboard_shortcut(keyToggle, s.toggle); +#ifdef _WIN32 + keybindingWorker = nullptr; + keybindingWorker = std::make_shared<KeybindingWorker>(keyCenter, keyToggle, handle); + keybindingWorker->start(); +#endif +} |