diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 17:39:50 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-26 17:39:50 +0200 |
commit | f906076ef1205387f52c03e8eed4ac2419c6d9a6 (patch) | |
tree | 83dd76ba7e23347fc1bebf15cd9b494362fbe84a /opentrack/shortcuts.cpp | |
parent | 70c9aaa9c297d2b20b7d3b466ceaf5f1def36752 (diff) |
api/shortcuts: only allow the exact modifier keys
Requested-by: white_fang on BMS forum
Original message:
I've setup shift+f11/f12 to incerease/decrease f18's flaps , ... F11 and
F12 are free in BMS , 'donothing' action.
so I want ONLY F11 to toggle opentracks enable/disable (and only F12 to
re-center) , but it also reacts when in BMS and press SHIFT+F11 to
toggle flaps on f18
Diffstat (limited to 'opentrack/shortcuts.cpp')
-rw-r--r-- | opentrack/shortcuts.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index 62a6ffd9..3fd35b19 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -46,7 +46,7 @@ void Shortcuts::bind_keyboard_shortcut(K &key, const key_opts& k, unused_on_unix key = K(); int idx = 0; QKeySequence code; - + if (k.guid != "") { key.guid = k.guid; @@ -61,7 +61,7 @@ void Shortcuts::bind_keyboard_shortcut(K &key, const key_opts& k, unused_on_unix code = QKeySequence(Qt::Key_unknown); else code = QKeySequence::fromString(k.keycode, QKeySequence::PortableText); - + Qt::KeyboardModifiers mods = Qt::NoModifier; if (code != Qt::Key_unknown) win_key::from_qt(code, idx, mods); @@ -87,12 +87,12 @@ void Shortcuts::receiver(const Key& k) if (k.keycode != k_.keycode) continue; if (k_.held && !k.held) continue; - if (k_.alt && !k.alt) continue; - if (k_.ctrl && !k.ctrl) continue; - if (k_.shift && !k.shift) continue; + if (k_.alt != k.alt) continue; + if (k_.ctrl != k.ctrl) continue; + if (k_.shift != k.shift) continue; if (!k_.should_process()) continue; - + fun(k.held); } } @@ -102,7 +102,7 @@ void Shortcuts::reload(const std::vector<std::tuple<key_opts&, fun, bool>> &keys { const int sz = keys_.size(); keys = std::vector<tt>(); - + for (int i = 0; i < sz; i++) { const auto& kk = keys_[i]; |