mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Catch device removal as well as device arrival on Windows
This commit is contained in:
parent
641c674f2a
commit
c88666580e
@ -142,6 +142,7 @@ typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A
|
|||||||
|
|
||||||
typedef struct _DEV_BROADCAST_HDR DEV_BROADCAST_HDR;
|
typedef struct _DEV_BROADCAST_HDR DEV_BROADCAST_HDR;
|
||||||
#define DBT_DEVICEARRIVAL 0x8000 /* system detected a new device */
|
#define DBT_DEVICEARRIVAL 0x8000 /* system detected a new device */
|
||||||
|
#define DBT_DEVICEREMOVECOMPLETE 0x8004 /* device was removed from the system */
|
||||||
#define DBT_DEVTYP_DEVICEINTERFACE 0x00000005 /* device interface class */
|
#define DBT_DEVTYP_DEVICEINTERFACE 0x00000005 /* device interface class */
|
||||||
#define DBT_DEVNODES_CHANGED 0x0007
|
#define DBT_DEVNODES_CHANGED 0x0007
|
||||||
#define DBT_CONFIGCHANGED 0x0018
|
#define DBT_CONFIGCHANGED 0x0018
|
||||||
@ -157,12 +158,13 @@ static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT message, WPARAM wParam
|
|||||||
case WM_DEVICECHANGE:
|
case WM_DEVICECHANGE:
|
||||||
switch (wParam) {
|
switch (wParam) {
|
||||||
case DBT_DEVICEARRIVAL:
|
case DBT_DEVICEARRIVAL:
|
||||||
|
case DBT_DEVICEREMOVECOMPLETE:
|
||||||
if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
|
if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
|
||||||
SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE;
|
SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||||
|
Loading…
Reference in New Issue
Block a user