summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-24 11:21:16 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-10-24 11:27:20 +0200
commit603130ef841ea23e317ccfa47385099b4466d8d5 (patch)
treef79fe914874333ad806f80fe4ca570f5824313dc /opentrack
parente9c2d579eed29daaa9f10336d3caed0c988dc9b7 (diff)
shortcuts: allow for binding same key to multiple functions
Closes #258
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/shortcuts.cpp18
1 files 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<K*> 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();
}
}