diff options
Diffstat (limited to 'dinput/keybinding-worker.hpp')
-rw-r--r-- | dinput/keybinding-worker.hpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/dinput/keybinding-worker.hpp b/dinput/keybinding-worker.hpp index 6b21bd01..1c22ca17 100644 --- a/dinput/keybinding-worker.hpp +++ b/dinput/keybinding-worker.hpp @@ -45,7 +45,11 @@ struct OTR_DINPUT_EXPORT KeybindingWorker : private QThread KeybindingWorker& operator=(KeybindingWorker&) = delete; private: - IDirectInputDevice8A* dinkeyboard = nullptr; + static constexpr int num_keyboard_states = 64; + static constexpr int num_mouse_buttons = 8; + static constexpr int first_mouse_button = 3; + + IDirectInputDevice8A* dinkeyboard = nullptr, *dinmouse = nullptr; win32_joy_ctx joy_ctx; std::vector<std::unique_ptr<fun>> receivers; QMutex mtx; @@ -53,20 +57,21 @@ private: di_t din; bool keystate[256] {}; + bool mouse_state[num_mouse_buttons - first_mouse_button] = {}; void run() override; bool run_keyboard_nolock(); bool run_joystick_nolock(); + bool run_mouse_nolock(); bool init(); + bool init_(IDirectInputDevice8A*& dev, const char* name, const GUID& guid, const DIDATAFORMAT& fmt); KeybindingWorker(); static KeybindingWorker& make(); fun* add_receiver(fun& receiver); void remove_receiver(fun* pos); ~KeybindingWorker() override; - - static constexpr int num_keyboard_states = 64; public: class Token { |