diff options
Diffstat (limited to 'dinput/dinput.hpp')
-rw-r--r-- | dinput/dinput.hpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/dinput/dinput.hpp b/dinput/dinput.hpp index a9241504..394084e2 100644 --- a/dinput/dinput.hpp +++ b/dinput/dinput.hpp @@ -8,15 +8,19 @@ #pragma once -#include "export.hpp" +#include <QMutex> -#include <atomic> +#include "export.hpp" #undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x800 #include <dinput.h> +// XXX TODO -sh 20190209 +// keybinding_worker and joystick context are badly named +// add namespaces and rename, including inner joystick device struct + using diptr = IDirectInput8A*; class OTR_DINPUT_EXPORT di_t final @@ -25,8 +29,8 @@ class OTR_DINPUT_EXPORT di_t final static void ref_di(); static diptr handle; - static std::atomic<int> refcnt; - static std::atomic_flag init_lock; + static int refcnt; + static QMutex lock; static diptr init_di_(); public: @@ -36,16 +40,8 @@ public: di_t& operator=(const di_t&) = default; diptr operator->() const { return handle; } - operator bool() { return handle != nullptr; } + operator bool() const { return handle != nullptr; } + operator diptr() const { return handle; } - // for debugging bad usages. must use a dependent name. - template<typename t = void> - explicit operator void*() const - { - static_assert(sizeof(t) == -1); - static_assert(sizeof(t) == 0); - - return nullptr; - } + static bool poll_device(LPDIRECTINPUTDEVICE8 dev); }; - |