Skip to content

Commit b2a95b2

Browse files
committed
Default SDL_HINT_ACCELEROMETER_AS_JOYSTICK to 0 on Linux
The Linux joystick driver supports associating sensor devices with the related controller device, so enable that by default. Fixes #12043 (cherry picked from commit 3e47181)
1 parent 2708e08 commit b2a95b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/core/linux/SDL_udev.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,12 @@ static int device_class(struct udev_device *dev)
424424
}
425425

426426
val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER");
427-
if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE) &&
428-
val && SDL_strcmp(val, "1") == 0) {
429-
devclass |= SDL_UDEV_DEVICE_JOYSTICK;
427+
if (val && SDL_strcmp(val, "1") == 0) {
428+
if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_FALSE)) {
429+
devclass |= SDL_UDEV_DEVICE_JOYSTICK;
430+
} else {
431+
devclass |= SDL_UDEV_DEVICE_ACCELEROMETER;
432+
}
430433
}
431434

432435
val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE");

0 commit comments

Comments
 (0)