Commit Graph

12888 Commits (eb0955ef89a1917b93da86d9b4b6fdf67cd61a8c)

Author SHA1 Message Date
Sam Lantinga 44bae1e8a9 Corrected the Victrix FS Pro as a PS4 controller instead of a PS3 controller 2023-06-23 14:27:21 -07:00
Sam Lantinga 6b12fbc6b7 Re-add the simpler SDL_DBus_AppendDictWithKeyValue() function 2023-06-23 07:28:05 -07:00
Sylvain 6f344f29b8 After using SDL_qsort, mark sort_entries() as SDLCALL 2023-06-23 12:52:05 +02:00
Sylvain 1827a0bf62 Remove some use of C runtime functions in testevdev 2023-06-23 11:08:08 +02:00
Sylvain 6cde3835f0 Remove some use of C runtime functions (strlen, qsort) 2023-06-23 10:51:15 +02:00
Sam Lantinga a807b14957 Greatly improved Xbox One controller initialization sequence 2023-06-22 17:15:35 -07:00
Sylvain 8b86e3073d
Revert "Android: also protect Hat/Joy/PadDown,Up so there are not sent without window"
This reverts commit 8f83ccd750.
2023-06-22 23:30:41 +02:00
Sylvain 8f83ccd750 Android: also protect Hat/Joy/PadDown,Up so there are not sent without window 2023-06-22 16:25:22 +02:00
SDL Wiki Bot a3e0cd5208 Sync SDL3 wiki -> header 2023-06-22 13:45:16 +00:00
Sylvain 627165a2b2 Fix comments 2023-06-22 15:44:48 +02:00
Sylvain 4339113072 SDL_DBus_AppendDictWithKeyValue: allows several key/value for other PRs 2023-06-22 10:50:35 +02:00
Sam Lantinga 8aee6908bb Make sure we send update complete events for delayed guide buttons 2023-06-21 18:42:25 -07:00
Sam Lantinga 4c9fb3e169 Added the events SDL_EVENT_JOYSTICK_UPDATE_COMPLETE and SDL_EVENT_GAMEPAD_UPDATE_COMPLETE
This allows the application to tell when a joystick polling cycle is complete and can process state changes as a single atomic update. It is disabled by default, at least for now.
2023-06-21 13:59:53 -07:00
Sam Lantinga 808d83dd67 Allow specifying APP_PLATFORM and APP_ABI on the command line 2023-06-21 13:49:09 -07:00
Sam Lantinga 214d5daa3c Removed 100 ms hitch when querying third party Nintendo Switch controllers that don't respond to request for info
Also take advantage of the fact that we know whether the device is connected over Bluetooth now.
2023-06-21 12:14:50 -07:00
Sam Lantinga 3694dabe7c Use default sensor calibration if we can't read it from the Nintendo Switch controller
Fixes https://github.com/libsdl-org/SDL/issues/7830
2023-06-21 10:28:45 -07:00
Sam Lantinga 6306ee9f42 List the available haptic devices in testhaptic 2023-06-20 09:33:59 -07:00
Sam Lantinga 8cf5dc9963 Build on Android targeting the arm64-v8a architecture by default
This speeds up iteration time and covers most customer devices
2023-06-20 09:18:19 -07:00
Sam Lantinga 5f3213eb0e Added support for gamepad sensor fusion with the Razer Kishi 2023-06-20 08:41:15 -07:00
Simon McVittie 91198baed4 ibus: Handle error when getting the D-Bus machine ID
It is possible for retrieving the machine ID to fail, either because
dbus was installed incorrectly (machine ID absent or corrupt), or in
32-bit builds, because stat() on the machine ID fails with EOVERFLOW
if it has an out-of-range timestamp or inode number.

dbus has historically treated this as a faulty installation, raising
a warning which by default causes the process to crash. Unfortunately,
dbus_get_local_machine_id() never had a way to report errors, so it has
no alternative for that (bad) error handling.

In dbus >= 1.12.0, we can use dbus_try_get_local_machine_id() to get
the same information, but with the ability to cope gracefully with
errors. ibus won't work in this situation, but that's better than
crashing.

Mitigates: https://github.com/ValveSoftware/steam-for-linux/issues/9605
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-20 06:46:33 -07:00
Sam Lantinga 3ddbeab88f Moved Android sensor event handling to a separate thread
This makes it so you can interact with sensors on multiple threads, as long as only one thread initializes and cleans up the sensor subsystem.

This also has the benefit that sensor data is available as soon as possible.
2023-06-20 01:17:44 -07:00
Sam Lantinga 329e1b8b6a Update the sensors before the joysticks so the gamepad code gets fresh sensor readings 2023-06-19 19:42:01 -07:00
Sam Lantinga 1a9c04e9f1 Don't try to update the gamepad fusion sensors manually, instead rely on the normal update flow 2023-06-19 19:41:20 -07:00
Sam Lantinga 20ea35138f Use a separate sensor watching function for gamepad events to avoid reliance on system sensor events and prevent a potential deadlock 2023-06-19 16:17:34 -07:00
Sam Lantinga 70e43c150e Added support for blitting SDL_PIXELFORMAT_INDEX1LSB
Fixes https://github.com/libsdl-org/SDL/issues/7844

(cherry picked from commit a3d4fd71c3163b2b827f9e87930dec72c93b2fb2)
2023-06-19 08:38:07 -07:00
Sam Lantinga c6ee9780df Fixed DualSense controllers not being picked up by the HIDAPI driver
The hidraw device may take additional time to get the correct permissions for us to open it. In my tests on Steam Deck hardware, this ranges between 5-8ms.
2023-06-18 12:19:54 -07:00
Sam Lantinga 4e81b4e8de Added SDL_HINT_VIDEO_X11_SCALING_FACTOR to allow overriding the content scale on X11 (thanks Andres!) 2023-06-18 12:19:43 -07:00
Sam Lantinga 210c135f74 Implement SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED for X11
To match the focus stealing prevention logic from windows/osx.

I didn't implement SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN as there is no
standard mechanism for us to do so. In most cases marking a window as OverrideRedirect
will cause to not acquire focus when mapped. And in steam we are doing that when
appropriate.

I still left a note in X11_ShowWindow() regarding this behaviour.
2023-06-18 12:19:38 -07:00
Sam Lantinga 9351bf6dd1 Add handling for SDL_HINT_WINDOW_ACTIVATE_WHEN_RAISED and SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN on macOS
- Cocoa_ShowWindow will order a window that is not being activated below the key window (if one exists) then set visible

- Cocoa_RaiseWindow calls -[NSWindow orderFront:] without changing the key window
2023-06-18 12:19:22 -07:00
Sam Lantinga f168f9c813 Added support for the GameSir G4 Pro
We can't read device info or IMU calibration from this controller, and it has no gyro or accelerometer, but is otherwise perfectly functional.
2023-06-17 12:42:55 -07:00
Sam Lantinga b770644411 Fixed building on older kernel headers 2023-06-17 09:46:46 -07:00
Sam Lantinga b98494a101 Fixed building on older kernel headers 2023-06-17 09:39:50 -07:00
Sam Lantinga 9fe384b696 Fixed display orientation function names for SDL 3.0 convention 2023-06-17 09:28:27 -07:00
Sam Lantinga d91e96e7f5 Use SDL_HINT_GAMECONTROLLER_SENSOR_FUSION as a list of controllers to enable sensor fusion
There are too many wraparound style controllers out there to enumerate them all, so instead make this a user option in applications that support it.
2023-06-17 08:59:52 -07:00
Sam Lantinga 610c31c7b7 Generalized the sensor coordinate transform for wraparound gamepads 2023-06-17 08:28:37 -07:00
Sam Lantinga 9eb5eab0ad Use the correct orientation transformation based on whether the device is naturally landscape or portrait 2023-06-17 08:04:34 -07:00
Sam Lantinga e6d1ba2a17 Added the concept of display natural orientation
Also renamed SDL_GetDisplayOrientation() SDL_GetDisplayCurrentOrientation()

The natural orientation of the primary display is the frame of reference for accelerometer and gyro sensor readings.
2023-06-17 07:42:16 -07:00
Sam Lantinga 8de6ce7e92 Rotate the sensor axes to match gamepad orientation when using the device sensors for game controllers 2023-06-16 17:48:34 -07:00
Sam Lantinga a9c86e518a Added the Razer Edge controller to the list of wraparound controllers 2023-06-16 17:48:18 -07:00
Sam Lantinga c207cd3f56 Added the Razer Junglecat to the wraparound controller list 2023-06-16 16:04:12 -07:00
Ozkan Sezer e4f53e6b21 testevdev.c: comment out two unused data to fix build. 2023-06-17 01:01:10 +03:00
Sam Lantinga 42e4639a5e For gamepads that don't have their own sensors, try to use the system sensors.
This allows using the gyro and accelerometer in handheld devices in conjunction with built-in or wraparound controllers.
2023-06-16 14:44:59 -07:00
Simon McVittie d584592822 linux: If the kernel specifically tells us the device type, trust it
If a device is positively identified as an accelerometer, pointing stick
or clickpad, then we don't need to second-guess it.

In practice this does not change the result for any device in our
test data, so add some artificial records that exercise this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:54:41 -07:00
Simon McVittie 0d5aa70e62 linux: Pass evdev properties when guessing device type
In newer kernels, devices that can be positively identified as a
particular device type (for example accelerometers) get a property
bit set. Plumb this information through into the function, but don't
use it for anything just yet.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:54:41 -07:00
Simon McVittie a4ce721d7a testevdev: Allow device properties to be fully populated
The props array was too small for the highest property bits to be set,
although in practice this didn't matter since only the lower-order bits
have a meaning. Make it consistent with all the others.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:54:41 -07:00
Simon McVittie fa0ca3d41e linux: Distinguish between "device with keys" and a full keyboard
udev distinguishes between ID_INPUT_KEY, a device with any keyboard keys
at all (including for example USB numeric keypads, Bluetooth headsets
with volume control buttons, and some game controllers; and
ID_INPUT_KEYBOARD, a reasonably fully-featured keyboard that you could
use for general-purpose text entry. If we do the same here, then it's
useful input to our heuristics for identifying devices: for example,
a device with ID_INPUT_KEY could reasonably be a gamepad, but a device
with ID_INPUT_KEYBOARD certainly isn't.

Resolves: https://github.com/libsdl-org/SDL/issues/7827
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 08:49:31 -07:00
Simon McVittie 9b7a9ca666 testevdev: Add some more laptop built-in devices
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie 00b6db68de testevdev: Add some EVIOCGNAME and USB name strings to test data
We don't currently use these for anything, but we might start using
them as input to our heuristics as part of #7697.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie 3772d6cc99 testevdev: Add raw HID report descriptors where available
We don't currently use these in our device-classification heuristic,
but it could be a useful input in future.

Thanks to Sam Lantinga, Ben Fradella, kevenwyld and schlegp for
providing some of these.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00
Simon McVittie 2b7556fea2 testevdev: Correct typo in bus type for Xbox Series S|X via Bluetooth
All Bluetooth devices are bus type 0x0005.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-06-16 07:27:48 -07:00