SDL: Default SDL_HINT_ACCELEROMETER_AS_JOYSTICK to 0 on Linux (b2a95)

From b2a95b2482cbe1c7835c08d60bd5826df3e21e33 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 25 Mar 2025 09:07:10 -0700
Subject: [PATCH] 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 https://github.com/libsdl-org/SDL/issues/12043

(cherry picked from commit 3e47181800d7f97c8b1c9784146ddfb71f7637d3)
---
 src/core/linux/SDL_udev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/core/linux/SDL_udev.c b/src/core/linux/SDL_udev.c
index 06eefa31f500a..6c0fc14da2213 100644
--- a/src/core/linux/SDL_udev.c
+++ b/src/core/linux/SDL_udev.c
@@ -424,9 +424,12 @@ static int device_class(struct udev_device *dev)
         }
 
         val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER");
-        if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE) &&
-            val && SDL_strcmp(val, "1") == 0) {
-            devclass |= SDL_UDEV_DEVICE_JOYSTICK;
+        if (val && SDL_strcmp(val, "1") == 0) {
+            if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_FALSE)) {
+                devclass |= SDL_UDEV_DEVICE_JOYSTICK;
+            } else {
+                devclass |= SDL_UDEV_DEVICE_ACCELEROMETER;
+            }
         }
 
         val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE");