summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-11-22 18:01:06 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-11-22 18:01:06 +0100
commit5d4a9c78fbbbd59d366e91bfe4c4263d12833abe (patch)
tree1e60751f78de22affeda114e16c79f333dc05fb1
parent0c3a306b8588ae1cbe190ee18db2336bcd0eb527 (diff)
api/joy: guard _WIN32 properly
-rw-r--r--opentrack/keybinding-worker.hpp10
-rw-r--r--opentrack/shortcuts.h5
-rw-r--r--opentrack/win32-joystick.cpp4
3 files changed, 14 insertions, 5 deletions
diff --git a/opentrack/keybinding-worker.hpp b/opentrack/keybinding-worker.hpp
index c4a39ec6..83ffadf1 100644
--- a/opentrack/keybinding-worker.hpp
+++ b/opentrack/keybinding-worker.hpp
@@ -59,19 +59,18 @@ struct Key { int foo; };
struct OPENTRACK_EXPORT KeybindingWorker : private QThread
{
private:
+#ifdef _WIN32
LPDIRECTINPUT8 din;
LPDIRECTINPUTDEVICE8 dinkeyboard;
-#ifdef _WIN32
win32_joy_ctx& joy_ctx;
-#endif
volatile bool should_quit;
using fun = std::function<void(Key&)>;
std::vector<fun> receivers;
QMutex mtx;
-
+
void run() override;
KeybindingWorker();
-
+
KeybindingWorker(const KeybindingWorker&) = delete;
KeybindingWorker& operator=(KeybindingWorker&) = delete;
static KeybindingWorker& make();
@@ -100,4 +99,7 @@ public:
{
return Token(receiver);
}
+#else
+ void run() override {}
+#endif
};
diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h
index 930952e8..8acc5ba5 100644
--- a/opentrack/shortcuts.h
+++ b/opentrack/shortcuts.h
@@ -66,7 +66,10 @@ public:
{}
} s;
- Shortcuts() : key_token(KeybindingWorker::add_receiver([&](const Key& k) { receiver(k); }))
+ Shortcuts()
+#ifdef _WIN32
+ : key_token(KeybindingWorker::add_receiver([&](const Key& k) { receiver(k); }))
+#endif
{
reload();
}
diff --git a/opentrack/win32-joystick.cpp b/opentrack/win32-joystick.cpp
index b4a1f9cd..56a1b070 100644
--- a/opentrack/win32-joystick.cpp
+++ b/opentrack/win32-joystick.cpp
@@ -1,5 +1,7 @@
#include "win32-joystick.hpp"
+#ifdef _WIN32
+
LPDIRECTINPUT8& win32_joy_ctx::dinput_handle()
{
(void) CoInitialize(nullptr);
@@ -28,3 +30,5 @@ win32_joy_ctx& win32_joy_ctx::make()
static win32_joy_ctx ret;
return ret;
}
+
+#endif