From f906076ef1205387f52c03e8eed4ac2419c6d9a6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 26 May 2016 17:39:50 +0200 Subject: 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 --- opentrack/shortcuts.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'opentrack/shortcuts.cpp') 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> &keys { const int sz = keys_.size(); keys = std::vector(); - + for (int i = 0; i < sz; i++) { const auto& kk = keys_[i]; -- cgit v1.2.3