device: fix inability to detect devices with pipelining enabled

This is because the message window is being created in the main thread, but there is nothing processing messages in the main thread.
This commit is contained in:
rdb 2019-02-06 21:51:06 +01:00
parent 63d2992d5e
commit aadc62a96c
2 changed files with 15 additions and 0 deletions

View File

@ -391,6 +391,19 @@ on_input_device_removal(HANDLE handle) {
}
}
/**
* Polls the system to see if there are any new devices. In some
* implementations this is a no-op.
*/
void WinInputDeviceManager::
update() {
MSG msg;
while (PeekMessage(&msg, _message_hwnd, WM_INPUT_DEVICE_CHANGE, WM_INPUT, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
/**
* Implementation of the message loop.
*/

View File

@ -52,6 +52,8 @@ private:
pmap<HANDLE, WinRawInputDevice *> _raw_devices;
pmap<std::string, WinRawInputDevice *> _raw_devices_by_path;
virtual void update() override;
static LRESULT WINAPI window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
typedef CONFIGRET (WINAPI *pCM_Get_DevNode_Property)(DEVINST, const DEVPROPKEY *, DEVPROPTYPE *, PBYTE, PULONG, ULONG);