From 603130ef841ea23e317ccfa47385099b4466d8d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 24 Oct 2015 11:21:16 +0200 Subject: shortcuts: allow for binding same key to multiple functions Closes #258 --- opentrack/shortcuts.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index 91480d16..91d449f1 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -154,21 +154,21 @@ void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k) void Shortcuts::receiver(Key &k) { std::vector ks { &keyCenter, &keyToggle, &keyZero }; - for (auto& k_ : ks) + for (K* k_ : ks) { if (k.keycode != k_->keycode) continue; if (!k_->should_process()) - return; - if (k_->alt && !k.alt) return; - if (k_->ctrl && !k.ctrl) return; - if (k_->shift && !k.shift) return; - - if (k.keycode == keyCenter.keycode) + continue; + if (k_->alt && !k.alt) continue; + if (k_->ctrl && !k.ctrl) continue; + if (k_->shift && !k.shift) continue; + + if (k_ == &keyCenter) emit center(); - else if (k.keycode == keyToggle.keycode) + else if (k_ == &keyToggle) emit toggle(); - else if (k.keycode == keyZero.keycode) + else if (k_ == &keyZero) emit zero(); } } -- cgit v1.2.3