mirror of https://github.com/encounter/SDL.git
Fixed an issue with mouse/keyboard removal
Sometimes, on removal SDL_EVDEV_udev_callback() gets called with zero udev_class. This in turn seems to be caused the SDL_udev.c:guess_device_class() failing to find the attributes of the parent device. Apparently this is normal, attributes are not guaranteed to be in place during removal, depending on timing. This lack of attributes causes guess_device_class() to return zero. This fix mimics the code in linux/SDL_sysjoystick.c:joystick_udev_callback() which effectively has the same fix already in place.
This commit is contained in:
parent
cbbdd27ad3
commit
9f50d63dd5
|
@ -547,12 +547,11 @@ void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, con
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE|SDL_UDEV_DEVICE_KEYBOARD))) {
|
switch(udev_type) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( udev_type ) {
|
|
||||||
case SDL_UDEV_DEVICEADDED:
|
case SDL_UDEV_DEVICEADDED:
|
||||||
|
if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE|SDL_UDEV_DEVICE_KEYBOARD))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
SDL_EVDEV_device_added(devpath);
|
SDL_EVDEV_device_added(devpath);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue