summaryrefslogtreecommitdiffhomepage
path: root/opentrack-logic/win32-joystick.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-07 14:15:18 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-07 14:15:18 +0200
commit5f5ca66c58ad30d0c218b2da904aa3f722e18ebe (patch)
tree8e8d5bae3ca7edf6c96c7f0e0da87f347486b045 /opentrack-logic/win32-joystick.hpp
parentc418644838e99416fb168066bacc28a4cbc36a04 (diff)
logic/dinput: only ever use a single handle to DIRECTINPUT8 COM object
Diffstat (limited to 'opentrack-logic/win32-joystick.hpp')
-rw-r--r--opentrack-logic/win32-joystick.hpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/opentrack-logic/win32-joystick.hpp b/opentrack-logic/win32-joystick.hpp
index ab6ebc7c..f8c2e7e4 100644
--- a/opentrack-logic/win32-joystick.hpp
+++ b/opentrack-logic/win32-joystick.hpp
@@ -2,20 +2,15 @@
#ifdef _WIN32
+#include "dinput.hpp"
+#include "opentrack-compat/timer.hpp"
#include "export.hpp"
-
#include <cstring>
#include <memory>
#include <vector>
#include <functional>
#include <algorithm>
#include <unordered_map>
-#ifndef DIRECTINPUT_VERSION
-# define DIRECTINPUT_VERSION 0x800
-#endif
-#include <dinput.h>
-#include <windows.h>
-#include "opentrack-compat/timer.hpp"
#include <QString>
#include <QDebug>
#include <QMutex>
@@ -35,7 +30,6 @@ struct hash<QString>
struct OPENTRACK_LOGIC_EXPORT win32_joy_ctx
{
- using di_t = LPDIRECTINPUT8;
using fn = std::function<void(const QString& guid, int btn, bool held)>;
struct joy
@@ -70,13 +64,8 @@ struct OPENTRACK_LOGIC_EXPORT win32_joy_ctx
win32_joy_ctx();
void refresh();
- static di_t& make_di();
- class di_initializer final
- {
- static di_initializer self;
- di_initializer();
- };
+ using di_t = dinput_handle::di_t;
private:
static QString guid_to_string(const GUID guid);