|
@@ -852,8 +852,6 @@ void WIN_PollRawInput(SDL_VideoDevice *_this, Uint64 poll_start)
|
|
|
data->last_rawinput_poll = poll_finish;
|
|
data->last_rawinput_poll = poll_finish;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
|
|
|
|
-
|
|
|
|
|
static void AddDeviceID(Uint32 deviceID, Uint32 **list, int *count)
|
|
static void AddDeviceID(Uint32 deviceID, Uint32 **list, int *count)
|
|
|
{
|
|
{
|
|
|
int new_count = (*count + 1);
|
|
int new_count = (*count + 1);
|
|
@@ -878,7 +876,6 @@ static bool HasDeviceID(Uint32 deviceID, const Uint32 *list, int count)
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
|
|
|
|
static char *GetDeviceName(HANDLE hDevice, HDEVINFO devinfo, const char *instance, Uint16 vendor, Uint16 product, const char *default_name, bool hid_loaded)
|
|
static char *GetDeviceName(HANDLE hDevice, HDEVINFO devinfo, const char *instance, Uint16 vendor, Uint16 product, const char *default_name, bool hid_loaded)
|
|
|
{
|
|
{
|
|
|
char *vendor_name = NULL;
|
|
char *vendor_name = NULL;
|
|
@@ -964,8 +961,9 @@ static char *GetDeviceName(HANDLE hDevice, HDEVINFO devinfo, const char *instanc
|
|
|
return name;
|
|
return name;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, bool initial_check)
|
|
|
|
|
|
|
+void WIN_CheckKeyboardAndMouseHotplug(bool hid_loaded)
|
|
|
{
|
|
{
|
|
|
|
|
+ SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
|
|
PRAWINPUTDEVICELIST raw_devices = NULL;
|
|
PRAWINPUTDEVICELIST raw_devices = NULL;
|
|
|
UINT raw_device_count = 0;
|
|
UINT raw_device_count = 0;
|
|
|
int old_keyboard_count = 0;
|
|
int old_keyboard_count = 0;
|
|
@@ -977,18 +975,13 @@ void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, bool initial_check
|
|
|
int new_mouse_count = 0;
|
|
int new_mouse_count = 0;
|
|
|
SDL_MouseID *new_mice = NULL;
|
|
SDL_MouseID *new_mice = NULL;
|
|
|
|
|
|
|
|
- if (!_this->internal->detect_device_hotplug) {
|
|
|
|
|
|
|
+ if (!_this ||
|
|
|
|
|
+ SDL_strcmp(_this->name, "windows") != 0 ||
|
|
|
|
|
+ !_this->internal->detect_device_hotplug ||
|
|
|
|
|
+ _this->internal->gameinput_context) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Check to see if anything has changed
|
|
|
|
|
- static Uint64 s_last_device_change;
|
|
|
|
|
- Uint64 last_device_change = WIN_GetLastDeviceNotification();
|
|
|
|
|
- if (!initial_check && last_device_change == s_last_device_change) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- s_last_device_change = last_device_change;
|
|
|
|
|
-
|
|
|
|
|
if ((GetRawInputDeviceList(NULL, &raw_device_count, sizeof(RAWINPUTDEVICELIST)) == -1) || (!raw_device_count)) {
|
|
if ((GetRawInputDeviceList(NULL, &raw_device_count, sizeof(RAWINPUTDEVICELIST)) == -1) || (!raw_device_count)) {
|
|
|
return; // oh well.
|
|
return; // oh well.
|
|
|
}
|
|
}
|
|
@@ -1010,7 +1003,6 @@ void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, bool initial_check
|
|
|
old_keyboards = SDL_GetKeyboards(&old_keyboard_count);
|
|
old_keyboards = SDL_GetKeyboards(&old_keyboard_count);
|
|
|
old_mice = SDL_GetMice(&old_mouse_count);
|
|
old_mice = SDL_GetMice(&old_mouse_count);
|
|
|
|
|
|
|
|
- bool hid_loaded = WIN_LoadHIDDLL();
|
|
|
|
|
for (UINT i = 0; i < raw_device_count; i++) {
|
|
for (UINT i = 0; i < raw_device_count; i++) {
|
|
|
RID_DEVICE_INFO rdi;
|
|
RID_DEVICE_INFO rdi;
|
|
|
char devName[MAX_PATH] = { 0 };
|
|
char devName[MAX_PATH] = { 0 };
|
|
@@ -1077,9 +1069,6 @@ void WIN_CheckKeyboardAndMouseHotplug(SDL_VideoDevice *_this, bool initial_check
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (hid_loaded) {
|
|
|
|
|
- WIN_UnloadHIDDLL();
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
for (int i = old_keyboard_count; i--;) {
|
|
for (int i = old_keyboard_count; i--;) {
|
|
|
if (!HasDeviceID(old_keyboards[i], new_keyboards, new_keyboard_count)) {
|
|
if (!HasDeviceID(old_keyboards[i], new_keyboards, new_keyboard_count)) {
|
|
@@ -2718,10 +2707,6 @@ void WIN_PumpEvents(SDL_VideoDevice *_this)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (!_this->internal->gameinput_context) {
|
|
|
|
|
- WIN_CheckKeyboardAndMouseHotplug(_this, false);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
WIN_UpdateIMECandidates(_this);
|
|
WIN_UpdateIMECandidates(_this);
|
|
|
|
|
|
|
|
#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
|
#endif // !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|