mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-01 23:07:45 +08:00
Added temporary workaround hint "SDL_WINDOWS_DETECT_DEVICE_HOTPLUG"
Some devices with broken drivers hang when their name is queried, so added a workaround for applications that don't need input device details. The long term fix is to move the hotplug detection into a separate thread.
(cherry picked from commit a66988621a)
This commit is contained in:
@@ -984,6 +984,10 @@ 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) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check to see if anything has changed
|
// Check to see if anything has changed
|
||||||
static Uint64 s_last_device_change;
|
static Uint64 s_last_device_change;
|
||||||
Uint64 last_device_change = WIN_GetLastDeviceNotification();
|
Uint64 last_device_change = WIN_GetLastDeviceNotification();
|
||||||
|
|||||||
@@ -631,6 +631,8 @@ static bool WIN_VideoInit(SDL_VideoDevice *_this)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_this->internal->detect_device_hotplug = SDL_GetHintBoolean("SDL_WINDOWS_DETECT_DEVICE_HOTPLUG", true);
|
||||||
|
|
||||||
WIN_InitKeyboard(_this);
|
WIN_InitKeyboard(_this);
|
||||||
WIN_InitMouse(_this);
|
WIN_InitMouse(_this);
|
||||||
WIN_InitDeviceNotification();
|
WIN_InitDeviceNotification();
|
||||||
|
|||||||
@@ -583,6 +583,8 @@ struct SDL_VideoData
|
|||||||
|
|
||||||
bool cleared;
|
bool cleared;
|
||||||
|
|
||||||
|
bool detect_device_hotplug;
|
||||||
|
|
||||||
BYTE *rawinput;
|
BYTE *rawinput;
|
||||||
UINT rawinput_offset;
|
UINT rawinput_offset;
|
||||||
UINT rawinput_size;
|
UINT rawinput_size;
|
||||||
|
|||||||
Reference in New Issue
Block a user