summaryrefslogtreecommitdiffhomepage
path: root/opentrack/keybinding-worker.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-04-29 09:21:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-04-29 09:21:23 +0200
commit3a7011ff73cce39ecacb4c5651c1a2dbda8eb10e (patch)
tree84d21d48998aaacbad9cb27b7e5edf29b0dd1396 /opentrack/keybinding-worker.cpp
parent69cc802722c8264c0fd8b138a298d4820c11f1d8 (diff)
api, main: implement new keybindings
The following keybindings are now implemented: - restart tracking. if not started, starts. - toggle (keep position) while key held - zero (keep zero) while key held The latter two options only work for Windows as libqxt doesn't support them. Closes #291
Diffstat (limited to 'opentrack/keybinding-worker.cpp')
-rwxr-xr-x[-rw-r--r--]opentrack/keybinding-worker.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/opentrack/keybinding-worker.cpp b/opentrack/keybinding-worker.cpp
index 39693a7c..2d133c2f 100644..100755
--- a/opentrack/keybinding-worker.cpp
+++ b/opentrack/keybinding-worker.cpp
@@ -126,8 +126,9 @@ void KeybindingWorker::run() {
for (int i = 0; i < 256; i++)
{
Key k;
- if (old_keystate[i] != keystate[i] && keystate[i] & 0x80)
+ if (old_keystate[i] != keystate[i])
{
+ const bool held = keystate[i] & 0x80;
switch (i)
{
case DIK_LCONTROL:
@@ -142,6 +143,7 @@ void KeybindingWorker::run() {
k.alt = !!(keystate[DIK_LALT] & 0x80) || !!(keystate[DIK_RALT] & 0x80);
k.ctrl = !!(keystate[DIK_LCONTROL] & 0x80) || !!(keystate[DIK_RCONTROL] & 0x80);
k.keycode = i;
+ k.held = held;
for (auto& r : receivers)
r->operator()(k);