diff options
Diffstat (limited to 'dinput/keybinding-worker.cpp')
-rw-r--r-- | dinput/keybinding-worker.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp index e4cc6659..3d792778 100644 --- a/dinput/keybinding-worker.cpp +++ b/dinput/keybinding-worker.cpp @@ -82,14 +82,6 @@ bool KeybindingWorker::init() } } - if (dinkeyboard->Acquire() != DI_OK) - { - dinkeyboard->Release(); - dinkeyboard = nullptr; - qDebug() << "dinput: acquire keyboard failed" << GetLastError(); - return false; - } - return true; } @@ -142,12 +134,15 @@ bool KeybindingWorker::run_keyboard_nolock() * Key-up events work on my end. */ + if (!di_t::poll_device(dinkeyboard)) + eval_once(qDebug() << "dinput: keyboard poll failed"); + DWORD sz = num_keyboard_states; - const HRESULT hr = dinkeyboard->GetDeviceData(sizeof(*keyboard_states), keyboard_states, &sz, 0); + HRESULT hr = dinkeyboard->GetDeviceData(sizeof(*keyboard_states), keyboard_states, &sz, 0); - if (hr != DI_OK) + if (FAILED(hr)) { - eval_once(qDebug() << "dinput: keyboard GetDeviceData" << hr); + eval_once(qDebug() << "dinput: keyboard GetDeviceData failed" << (void*)hr); return false; } |