summaryrefslogtreecommitdiffhomepage
path: root/opentrack/keybinding-worker.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-11-11 06:14:00 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-11-11 06:14:00 +0100
commit2d90e4039c6dd1aab00c738f9bbc70a4949cd583 (patch)
tree9150b0f8732c51f767a705272bede9345c274901 /opentrack/keybinding-worker.cpp
parent2521a7918783758928a58f6032ca6fad53a89c01 (diff)
allow for binding joystick buttons to shortcut functions
Win32 only Issue: #118
Diffstat (limited to 'opentrack/keybinding-worker.cpp')
-rw-r--r--opentrack/keybinding-worker.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/opentrack/keybinding-worker.cpp b/opentrack/keybinding-worker.cpp
index 29b2cf9f..e6c023ef 100644
--- a/opentrack/keybinding-worker.cpp
+++ b/opentrack/keybinding-worker.cpp
@@ -72,6 +72,19 @@ void KeybindingWorker::run() {
while (!should_quit)
{
+ {
+ using joy_fn = std::function<void(const QString& guid, int idx)>;
+
+ joy_fn f = [&](const QString& guid, int idx) -> void {
+ Key k;
+ k.keycode = idx;
+ k.guid = guid;
+ receiver(k);
+ };
+
+ joy_ctx.poll(f);
+ }
+
if (dinkeyboard->GetDeviceState(256, (LPVOID)keystate) != DI_OK) {
qDebug() << "Tracker::run GetDeviceState function failed!" << GetLastError();
Sleep(25);