Fixed HIDAPI hotplug detection when initializing gamepads off the main thread
This commit is contained in:
@@ -388,18 +388,20 @@ static void HIDAPI_UpdateDiscovery(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||||
#if 0 // just let the usual SDL_PumpEvents loop dispatch these, fixing bug 4286. --ryan.
|
if (SDL_IsMainThread()) {
|
||||||
// We'll only get messages on the same thread that created the window
|
// just let the usual SDL_PumpEvents loop dispatch these, fixing bug 2998. --ryan.
|
||||||
if (SDL_GetCurrentThreadID() == SDL_HIDAPI_discovery.m_nThreadID) {
|
} else {
|
||||||
MSG msg;
|
// We'll only get messages on the same thread that created the window
|
||||||
while (PeekMessage(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0, PM_NOREMOVE)) {
|
if (SDL_GetCurrentThreadID() == SDL_HIDAPI_discovery.m_nThreadID) {
|
||||||
if (GetMessageA(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0) != 0) {
|
MSG msg;
|
||||||
TranslateMessage(&msg);
|
while (PeekMessage(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0, PM_NOREMOVE)) {
|
||||||
DispatchMessage(&msg);
|
if (GetMessageA(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0) != 0) {
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
|
||||||
|
|
||||||
#ifdef SDL_PLATFORM_MACOS
|
#ifdef SDL_PLATFORM_MACOS
|
||||||
|
|||||||
Reference in New Issue
Block a user