Commit Graph

6275 Commits (2c518747b9cf45c1b94c570c19912e04476e8eed)

Author SHA1 Message Date
Sam Lantinga 12413ab31f Lock joysticks while attaching a virtual one 2022-09-08 13:33:21 -07:00
Ozkan Sezer 787cd580ee silence unused function warning for SDL_endswith() on non-linux. 2022-09-08 23:00:04 +03:00
Sam Lantinga 4071573241 Don't try to second guess DS4Windows, let it remap things as expected.
DS4Windows can create both emulated Xbox and emulated PS4 controllers, and we don't know which the user has it doing, so don't try to second guess it, just let it do it's thing. Users should follow the remapping software recommendations on when to enable/disable it for various situations.

Fixes https://github.com/libsdl-org/SDL/issues/6167
2022-09-08 11:50:56 -07:00
Sam Lantinga a0f169603d Fixed the CRC in the mappings for PS2, PSP, and Vita controllers 2022-09-08 09:53:51 -07:00
Sylvain 90a480a100
Fixed bug #6199 - Broken clip behaviour on a render target (metal) 2022-09-08 05:44:39 +02:00
Sam Lantinga 0ad8d9d292 SDL_IsXInputDevice() shouldn't return true if XInput isn't enabled 2022-09-07 15:31:24 -07:00
Sam Lantinga d93f9a778b The new Wii Remote shares the same VID/PID as the Wii U Pro controller 2022-09-07 12:33:43 -07:00
Sam Lantinga f398d8a424 Note that the Logitech Extreme 3D is a flight stick 2022-09-07 11:53:13 -07:00
Sam Lantinga 0a05b281f2 Make sure we hold the joystick lock when updating the device state while opening it 2022-09-07 11:51:51 -07:00
Sam Lantinga d4e0d27c1c Added Wii Remote controller mappings for Linux 2022-09-07 02:02:04 -07:00
Sam Lantinga 42cf6d6c56 Don't treat the Wii extension controls as a separate game controller on Linux 2022-09-07 01:41:11 -07:00
Sam Lantinga 87f8b6ff0f Don't mess with the state of the Motion Plus extension on Linux 2022-09-07 01:21:01 -07:00
Sam Lantinga c28da4892a Fixed build 2022-09-07 00:52:40 -07:00
Sam Lantinga 638452ecf7 Assert that continuous reporting is enabled, so input timeout is a reliable way of detecting Bluetooth connection problems. 2022-09-07 00:44:13 -07:00
Sam Lantinga 8dfe0e4beb Removed checks not needed for the Wii U Pro Controller 2022-09-07 00:41:29 -07:00
Sam Lantinga 4018f35ef2 Added left and right sensors for Nintendo Joy-Con and Wii controllers 2022-09-07 00:00:27 -07:00
Sam Lantinga 30f55a5d59 Added initial support for the Wii Motion Plus extension
This adds a gyro sensor to the Wii controller, and is enabled in standalone and nunchuk mode
2022-09-06 23:33:55 -07:00
Sam Lantinga 29f4a5ba0e Add GLES2 shader prologue infrastructure. (by @eloj)
There is supposedly an OpenGL ES2 target that does not support precision specifiers. However, the existing logic to detect this is currently broken in two ways:

1) There's a typo of the `#ifdef` as `#if`.
2) Checking for `GL_FRAGMENT_PRECISION_HIGH` can not be the correct way to detect this platform. Other targets, including some desktops, will also not have this defined (for various reasons).

Because some of the shader code is missing precision specifiers, and because a default is ONLY provided if `GL_FRAGMENT_PRECISION_HIGH` is set, these other targets break.

Instead of 'hard-coding' the prologue string into shaders in the C source, use our ability to provide a list of strings to `glShaderSource` instead, leaving the determination to run-time.

This commit closes https://github.com/libsdl-org/SDL/pull/6182
2022-09-06 15:55:27 -07:00
Sam Lantinga 4fd6bba257 Refactored for similarity to surrounding code 2022-09-06 12:29:42 -07:00
Ozkan Sezer 5ffede35d9 Fix https://github.com/libsdl-org/SDL/issues/6191 2022-09-06 19:56:29 +03:00
Cameron Cawley 10e1ef00e2 Fix compatibility with Windows XP 2022-09-06 08:55:35 -04:00
Sam Lantinga d1fea10c0f Added support for the accelerometer in the Wii Remote 2022-09-05 16:08:15 -07:00
Sam Lantinga a61b823da8 Added support for the Wii Remote with the Classic Controller Pro extension
Also changed event order to: buttons, triggers, axes, for consistency with other drivers
2022-09-05 14:32:45 -07:00
Ozkan Sezer 612a86ebad HIDAPI_DriverPS3_UpdateEffects: kill bad use of & operator on effects[] 2022-09-05 20:47:00 +03:00
Sam Lantinga b00e1b1b62 Added support for a ShanWan PS2 -> PS3 USB converter to the HIDAPI driver 2022-09-05 10:01:51 -07:00
Cameron Cawley fd93f817ba Assume that stdint.h is available on Windows with compilers other than MSVC <= 2008 2022-09-05 09:01:31 -07:00
Sylvain 03485db0a3
Android: understand HAL_PIXEL_FORMAT_BGR_565 as a returned value from ANativeWindow_getFormat() (see #6016) 2022-09-03 23:40:14 +02:00
Sam Lantinga 1b4e08b89e Added an entry for the Hori Fighting Stick mini 4 kai
This is a PS3/PS4 arcade stick which becomes an Xbox 360 controller on PC
2022-09-02 17:04:53 -07:00
Sam Lantinga 47f2373dc1 Added locking for Android joystick events 2022-09-02 16:52:55 -07:00
Sam Lantinga e8f6b7503a Added mappings for the ASUS ROG Kunai 3 Gamepad 2022-09-02 15:06:13 -07:00
Sam Lantinga 5770e87cb2 Fixed regression handling touchpad input with PS5 controllers using the original shipping firmware 2022-09-02 13:57:59 -07:00
Sam Lantinga 253f6a913d Variable renaming for consistency 2022-09-02 11:49:06 -07:00
Sam Lantinga 5002624e8a Fixed crash when extension controllers are hotplugged 2022-09-02 11:41:19 -07:00
Sam Lantinga 7df571ffc6 HIDAPI_DumpPacket() takes a const memory pointer 2022-09-02 11:37:16 -07:00
Sam Lantinga b6d23d21db Fixed interactions with the Linux Wiimote driver 2022-09-02 11:21:51 -07:00
Ozkan Sezer 0c984360d1 SDL_hidapi_wii.c: fix a -Wshadow warning 2022-09-02 20:02:56 +03:00
Sam Lantinga b6b3fb0023 This was intended to be Uint8 2022-09-02 09:59:32 -07:00
Ozkan Sezer 5be157b3a2 SDL_hidapi_wii.c: fix -Wpointer-sign warnings 2022-09-02 19:33:40 +03:00
Sam Lantinga 54356f41a9 Wii: fixed trigger axis reporting for the Wii U Pro Controller 2022-09-02 09:03:44 -07:00
Sam Lantinga a35642fa3e Wii: don't bother reading the extension type for the Wii U Pro controller, we already know what it is 2022-09-02 08:58:52 -07:00
Sam Lantinga c3ecb9d099 Wii: re-request the status if we get a communication error 2022-09-02 08:58:52 -07:00
Ozkan Sezer 0c24b46e9f SDL_hidapi_wii.c: fix build in c89 mode. 2022-09-02 18:55:00 +03:00
Sam Lantinga 9874fc4e6a Reconnect as a different controller if the Wii extension hardware changes 2022-09-02 08:47:15 -07:00
Sam Lantinga 5f3cb54972 Updated Wii support with @tellowkrinkle's changes in 2f288e9d5b 2022-09-02 08:28:28 -07:00
Sam Lantinga 785d784a93 Set the output value for ParseExtensionResponse() in all return cases 2022-09-01 22:30:05 -07:00
Sam Lantinga 046aaa2d21 Use auto calibration for the Wii Nunchuk thumbstick axis values 2022-09-01 21:37:26 -07:00
Sam Lantinga 8381e008ea Handle hotplugging of Wii controller extensions 2022-09-01 21:13:16 -07:00
Sam Lantinga 396411c090 Added mapping for the Wii Nunchuk extension 2022-09-01 20:27:34 -07:00
Sam Lantinga e19b36d871 Initial support for the Wii Remote with Nunchuk extension 2022-09-01 19:29:20 -07:00
Sam Lantinga c887cb02af Added the hint SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED to control whether the player LED should be lit on the Nintendo Wii controllers
Also fixed the Y axes on the Wii U Pro controller, and various formatting cleanup
2022-09-01 16:30:55 -07:00
Ozkan Sezer 0ffaf5b871 SDL_hidapi_wii.c: fix build in c89 mode and builds using watcom compiler 2022-09-02 02:04:20 +03:00
Sam Lantinga c72e14e8f4 Added initial support for Wii controllers (thanks @tellowkrinkle!) 2022-09-01 15:29:41 -07:00
Ozkan Sezer 2847696338 hidapi: really fix dynamic / non-dynamic libusb loading. 2022-09-01 22:55:00 +03:00
Ozkan Sezer 9d77945d36 fixed linkage libusb not dynamicaly loaded after commit 3f89d1704d
build/.libs/SDL_hidapi.o: In function `SDL_EnableGameCubeAdaptors':
src/hidapi/SDL_hidapi.c:1593: undefined reference to `libusb_init'
src/hidapi/SDL_hidapi.c:1594: undefined reference to `libusb_get_device_list'
src/hidapi/SDL_hidapi.c:1596: undefined reference to `libusb_get_device_descriptor'
src/hidapi/SDL_hidapi.c:1604: undefined reference to `libusb_open'
src/hidapi/SDL_hidapi.c:1608: undefined reference to `libusb_kernel_driver_active'
src/hidapi/SDL_hidapi.c:1614: undefined reference to `libusb_claim_interface'
src/hidapi/SDL_hidapi.c:1623: undefined reference to `libusb_close'
src/hidapi/SDL_hidapi.c:1626: undefined reference to `libusb_free_device_list'
src/hidapi/SDL_hidapi.c:1628: undefined reference to `libusb_exit'
src/hidapi/SDL_hidapi.c:1609: undefined reference to `libusb_detach_kernel_driver'
src/hidapi/SDL_hidapi.c:1620: undefined reference to `libusb_attach_kernel_driver'
src/hidapi/SDL_hidapi.c:1615: undefined reference to `libusb_control_transfer'
src/hidapi/SDL_hidapi.c:1616: undefined reference to `libusb_release_interface'
build/.libs/SDL_hidapi.o: In function `SDL_hid_init_REAL':
src/hidapi/SDL_hidapi.c:1086: undefined reference to `libusb_init'
src/hidapi/SDL_hidapi.c:1087: undefined reference to `libusb_exit'
src/hidapi/SDL_hidapi.c:1088: undefined reference to `libusb_get_device_list'
src/hidapi/SDL_hidapi.c:1089: undefined reference to `libusb_free_device_list'
src/hidapi/SDL_hidapi.c:1090: undefined reference to `libusb_get_device_descriptor'
src/hidapi/SDL_hidapi.c:1091: undefined reference to `libusb_get_active_config_descriptor'
src/hidapi/SDL_hidapi.c:1092: undefined reference to `libusb_get_config_descriptor'
src/hidapi/SDL_hidapi.c:1093: undefined reference to `libusb_free_config_descriptor'
src/hidapi/SDL_hidapi.c:1094: undefined reference to `libusb_get_bus_number'
src/hidapi/SDL_hidapi.c:1095: undefined reference to `libusb_get_device_address'
src/hidapi/SDL_hidapi.c:1096: undefined reference to `libusb_open'
src/hidapi/SDL_hidapi.c:1097: undefined reference to `libusb_close'
src/hidapi/SDL_hidapi.c:1098: undefined reference to `libusb_claim_interface'
src/hidapi/SDL_hidapi.c:1099: undefined reference to `libusb_release_interface'
src/hidapi/SDL_hidapi.c:1100: undefined reference to `libusb_kernel_driver_active'
src/hidapi/SDL_hidapi.c:1101: undefined reference to `libusb_detach_kernel_driver'
src/hidapi/SDL_hidapi.c:1102: undefined reference to `libusb_attach_kernel_driver'
src/hidapi/SDL_hidapi.c:1103: undefined reference to `libusb_set_interface_alt_setting'
src/hidapi/SDL_hidapi.c:1104: undefined reference to `libusb_alloc_transfer'
src/hidapi/SDL_hidapi.c:1105: undefined reference to `libusb_submit_transfer'
src/hidapi/SDL_hidapi.c:1106: undefined reference to `libusb_cancel_transfer'
src/hidapi/SDL_hidapi.c:1107: undefined reference to `libusb_free_transfer'
src/hidapi/SDL_hidapi.c:1108: undefined reference to `libusb_control_transfer'
src/hidapi/SDL_hidapi.c:1109: undefined reference to `libusb_interrupt_transfer'
src/hidapi/SDL_hidapi.c:1110: undefined reference to `libusb_handle_events'
src/hidapi/SDL_hidapi.c:1111: undefined reference to `libusb_handle_events_completed'
collect2: ld returned 1 exit status
2022-09-01 21:56:50 +03:00
Sam Lantinga 3f89d1704d Fixed building with libusb not dynamicaly loaded 2022-09-01 11:30:02 -07:00
Sam Lantinga 7708bf0f8a Try matching game controller mappings on CRC and version and fall back to no CRC and no version, in that order.
We do exact match when adding mappings, but loose matching everywhere else we look up a mapping for a GUID.
2022-09-01 08:18:58 -07:00
Sam Lantinga 7861f924ea Removed debug print statements 2022-08-31 13:34:43 -07:00
Sam Lantinga 62f2379e4c Try up to 20 times to read the controller type
It takes a while for Joy-Cons to initialize when plugged in via the Nintendo Joy-Con Charging Grip.
2022-08-31 13:24:23 -07:00
Sam Lantinga e5f161bda4 Restored accidentally removed code to guess XInput device 2022-08-30 19:12:22 -07:00
Ozkan Sezer 973a677a2d SDL_xinputjoystick.c: commented out GuessXInputDevice()
Not used since commit 277b033e78.
2022-08-31 02:32:28 +03:00
Shawn Hoffman 42d09a8f42 wgi: refcount the delegate objects 2022-08-30 15:01:31 -07:00
Shawn Hoffman ca915b1884 WGI_JoystickUpdate: bounds-check array sizes 2022-08-30 14:59:38 -07:00
Sam Lantinga cdaafcec0d The Kinvoca Joy-Cons are handled by the Joy-Con driver, not the Switch Pro driver. 2022-08-30 14:56:11 -07:00
Sam Lantinga b2c3237b75 Added support for the Kinvoca Joy-Cons
These report their VID/PID as a Nintendo Switch Pro controller, but they are actually left/right Joy-Cons. We'll fix up the joystick GUID so applications can handle them appropriately.
2022-08-30 14:14:38 -07:00
Sam Lantinga 92d3fc4883 Fixed deadlock when shutting down the Windows joystick system 2022-08-30 12:59:02 -07:00
Brad Smith 371735e95b Silence unused variable warning
SDL_x11dyn.c:123:17: warning: unused variable 'i' [-Wunused-variable]
            int i;
                ^
2022-08-30 12:52:01 -07:00
Sam Lantinga 0e4baf1c4e Don't crash if SDL functions are passed a closed joystick or gamecontroller 2022-08-30 12:39:23 -07:00
Sam Lantinga 675d90c708 Revert "wgi: refcount the delegate objects"
This reverts commit ff233fe306.

This doesn't compile cleanly with Visual Studio and I don't want to introduce any subtle issues because we're passing the wrong types of pointers to WGI functions.
2022-08-30 12:09:57 -07:00
Sam Lantinga 40bd4feedc Revamped joystick locking
This makes the joystick locking more robust by holding the lock while updating joysticks.

The lock should be held when calling any SDL joystick function on a different thread than the one calling SDL_PumpEvents() and SDL_JoystickUpdate().

It is now possible to hold the lock while reinitializing the joystick subsystem, however any open joysticks will become invalid and potentially cause crashes if used afterwards.

Fixes https://github.com/libsdl-org/SDL/issues/6063
2022-08-30 11:42:13 -07:00
Shawn Hoffman ff233fe306 wgi: refcount the delegate objects
assert if calls become unbalanced.
2022-08-30 10:48:10 -07:00
Francisco Javier Trujillo Mata f1e4685806 Adding specific SDL_Hint for the dynamic VSYNC 2022-08-30 07:20:36 -04:00
Sam Lantinga 2f08bf2313 Added the share button to the Linux mapping for the third party Nintendo Switch Pro controllers 2022-08-29 22:15:35 -07:00
Sam Lantinga b2ac758f61 Added support for the Hori Fighting Stick Alpha to the HIDAPI driver 2022-08-29 17:33:00 -07:00
Ludovico de Nittis 3c78ba570b dbus: Use xdg-desktop-portal Inhibit when running under Flatpak or Snap
In order to inhibit the screen saver, SDL currently uses
`org.freedesktop.ScreenSaver.Inhibit()` and, as a fallback, a protocol
specific method for X11 or Wayland.

Accessing `org.freedesktop.ScreenSaver` is usually not allowed when
inside a sandbox like Flatpak, unless the permission has been explicitly
granted to the application.

Another issue is that the Wayland protocol "Idle inhibit" is relatively
new and not yet widely adopted. For example Mutter still doesn't support
it.

For those reasons, when running under Flatpak or Snap, we should try to
inhibit the screen saver by using xdg-desktop-portal instead. This
should give us an higher chance of success.

Fixes: https://github.com/libsdl-org/SDL/issues/6075

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2022-08-29 06:30:40 -07:00
Ludovico de Nittis e8cb4da71f Add utility function to detect if SDL is inside a sandbox
Refactor the previous sandbox check in a standalone function that also
includes Snap support.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2022-08-29 06:30:40 -07:00
Ludovico de Nittis a3ce700ded dbus: Add generic internal function to send messages with reply
SDL_DBus_CallWithBasicReply() allows us to send a DBus message and get
its result, if it is a basic type, e.g. integer or string.

With this function we avoid duplicating code.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2022-08-29 06:30:40 -07:00
Sam Lantinga 1153aaae0d Fixed compiling with USB_GET_DEVICEINFO on DragonFly BSD
Although the ioctl() currently fails on this platform...
2022-08-29 00:15:56 -07:00
Sam Lantinga 57cbec1095 Added controller mappings for Xbox 360, PS4, and PS5 controllers on OpenBSD
Removed the axis flipping hack for Xbox controllers which would actually apply to any controller with a full 16-bit range.

Fixes https://github.com/libsdl-org/SDL/issues/6143
2022-08-28 23:18:40 -07:00
Sam Lantinga 0b8b321f9e Allow the product version to be different when trying to find a controller mapping
This is in the hope that revving the product version doesn't change the mapping, which is the case for some devices. In cases where it does, we just need to provide a mapping for each version of the product.
2022-08-28 23:01:30 -07:00
Sam Lantinga 761b9d1e49 Use the HID usage for the button as the button number 2022-08-28 22:33:17 -07:00
Sam Lantinga a9d3935a84 Improved code to get the name and guid for joysticks on OpenBSD and NetBSD
Also dynamically allocate joysticks to reduce static memory usage
2022-08-28 18:20:54 -07:00
Sam Lantinga 32700294e2 Don't crash if SDL_CreateJoystickGUID() is passed a NULL name 2022-08-28 18:20:54 -07:00
Sam Lantinga bac8df4abd Fixed memory leak when out of memory 2022-08-28 18:20:54 -07:00
Sam Lantinga ffbad3617c Use the correct type for the device_instance 2022-08-28 18:20:54 -07:00
Sam Lantinga 4a800ae149 Created a consolidated define enabling BSD gameport joystick support 2022-08-28 18:20:54 -07:00
Sam Lantinga 42f90c6292 Removed unused path variable 2022-08-28 18:20:54 -07:00
Cameron Gutman b7c1fbf9f0 WGI: Fix a couple of reference leaks 2022-08-28 17:38:02 -05:00
Sam Lantinga 0db1813049 Applied OpenBSD patch
http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/devel/sdl2/patches/patch-src_joystick_bsd_SDL_bsdjoystick_c?rev=1.5&content-type=text/plain&hideattic=1
2022-08-28 07:27:01 -07:00
Mathieu Eyraud b8af865f18 Fix candidate list size for Windows IME
Adjust candidate count so list is not draw bigger that needed. This also fix potential uninitialised read of variable `candsize[i]` if `vertical` is false.
2022-08-28 06:27:24 -07:00
Sam Lantinga 3cbfd75d0f Re-added the CRC to the joystick guid
This is now used as a crc field in the mapping rather than directly in mapping guids, for better mapping compatibility between versions of SDL.

Added SDL_GetJoystickGUIDInfo() to get device information encoded in a joystick GUID, so that mapping programs can clear the CRC from the GUID when generating mappings.

sort_controllers.py has been updated to extract the CRC from mappings created by older mapping programs and convert it into the new crc field. It will also take the CRC into account when checking for duplicate mappings.

Also regenerated the GUIDs for the PS2/PSP/Vita controller mappings, fixing https://github.com/libsdl-org/SDL/issues/6151
2022-08-27 19:00:31 -07:00
Francisco Javier Trujillo Mata b9e3cae572 Add more valid configurations to PS2 audio driver 2022-08-27 18:34:33 -07:00
Sam Lantinga b188a916ff Fixed uhid device name for non-OpenBSD platforms 2022-08-27 09:46:28 -07:00
Brad Smith 3f93ec470a Add support for OpenBSD's ujoy(4) 2022-08-27 09:45:08 -07:00
Sam Lantinga 9a01eac57d Temporarily disable joystick GUID CRCs 2022-08-26 13:45:05 -07:00
Sam Lantinga f6c2c22d38 Don't try to use the charging port for the PowerA wireless controller as an input device 2022-08-25 22:25:25 -07:00
Sam Lantinga f1aa843415 Don't report rumble capability for Nintendo Online controllers 2022-08-25 21:51:43 -07:00
Steven Noonan 9ce9c2530a SDL_windowsmodes: fix WIN_GetDisplayNameVista source identifier number
This was getting the wrong monitor's name because the source identifier
was not being included in the DisplayConfigGetDeviceInfo request.
2022-08-25 18:44:46 -07:00
Anonymous Maarten ce227aa69e wayland: fix build with SDL_WAYLAND_SHARED=OFF/--enable-wayland-shared=no 2022-08-25 17:15:54 -07:00
Sam Lantinga 679582e702 Fixed crash if there are no devices available 2022-08-25 11:07:20 -07:00
DomGries 40b2499273 Fix building with SDL_DISABLE_WINDOWS_IME
Regression of f317d619cc (diff-bff8f3e638d51e86cb6f0f42e2c527549d649951b7aa5ec4a539e865a5b57027R398)
2022-08-25 06:59:24 -07:00
Sam Lantinga babaa7d2bd Fixed PS3 accelerometer values on little endian systems 2022-08-24 16:10:47 -07:00
Julio C. Rocha 05983fb8ee Add Mayflash PC043 adapter 2022-08-24 15:34:46 -07:00
Sam Lantinga e7332cd814 Fixed zero CRC matching in the controller mapping database 2022-08-24 15:28:56 -07:00
Francisco Javier Trujillo Mata a4f84803c4 Disable fileXio and patch fio 2022-08-24 12:23:56 -07:00
Noel Berry 00452e47fa
Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112) 2022-08-24 11:25:13 -07:00
Sam Lantinga 70c781c803 Fixed build warning because of redefining string functions 2022-08-24 10:25:56 -07:00
antonino 5f79cd1600 Fixed spacing 2022-08-24 10:10:49 -07:00
antonino dd68eb5c01 free drm prop before returning 2022-08-24 10:10:49 -07:00
Sam Lantinga 970344719a Fixed the Nintendo Switch Pro mappings on iOS/tvOS 2022-08-24 09:39:01 -07:00
Sam Lantinga 1fc7f68118 Document that it's not possible to use the HIDAPI driver for PS3 controllers on Windows 2022-08-24 06:38:36 -07:00
Sam Lantinga 645b0f6abf Enable HIDAPI PS3 support by default on macOS 2022-08-24 01:30:29 -07:00
Sam Lantinga 3ed8e219a5 Fixed building HIDAPI libusb support on Windows 2022-08-24 01:25:14 -07:00
Sam Lantinga 3d62ebdbf6 Fixed HIDAPI PS3 support on macOS 2022-08-24 00:34:30 -07:00
Sam Lantinga aaee6e242c Added missing file 2022-08-23 22:56:48 -07:00
Sam Lantinga b6f96b69aa Initial HIDAPI driver support for the PS3 controller 2022-08-23 22:45:37 -07:00
Sam Lantinga 50c5d23f7d Round coordinates so very small floating point values don't turn into 0x80000000
e.g. SDL_RenderDrawLineF(renderer, -1e20, -1e20, 10, 10);

Fixes https://github.com/libsdl-org/SDL/issues/6116
2022-08-23 07:42:48 -07:00
Sam Lantinga b6a3d76225 Look up mappings by GUID in two passes: first with CRC, second without 2022-08-23 07:24:21 -07:00
Sam Lantinga 277b033e78 Refactor joystick GUID creation 2022-08-22 19:44:14 -07:00
antonino aae566e196 Use SDL_bool 2022-08-22 18:43:43 -07:00
antonino e3ea9b5b7c restore vrr state on exit 2022-08-22 18:43:43 -07:00
antonino 450e9857cc Use SDL_TRUE and SDL_FALSE 2022-08-22 18:43:43 -07:00
antonino 605b50fcd9 kmsdrm: added missing checks 2022-08-22 18:43:43 -07:00
Sam Lantinga c1e0873940 Added the CRC of the joystick name to the GUID
This will make it possible to have mappings for different controllers
that have the same VID/PID. This happens frequently with some generic
controller boards that have been reused in many products.

Fixes https://github.com/libsdl-org/SDL/issues/6004
2022-08-22 18:22:35 -07:00
Sam Lantinga 20715fa014 Fixed build errors 2022-08-22 17:09:42 -07:00
Sam Lantinga 92b3c53c92 Added a hint SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE to control whether to use system mouse acceleration on raw relative motion.
This is currently only implemented on Windows, and "Enhanced pointer
precision" mode is not quite correct.
2022-08-22 16:48:09 -07:00
Sam Lantinga d166f5ef76 Fixed uninitialized variable warning 2022-08-22 14:10:54 -07:00
Sam Lantinga b2819e43a7 Send SDL_CONTROLLERDEVICEREMOVED for all joysticks because we don't know after the fact whether it was a game controller.
Fixes https://github.com/libsdl-org/SDL/issues/2092
2022-08-22 13:10:57 -07:00
Sam Lantinga 0e61c106f5 Don't calculate relative mouse motion if we don't have a valid position
Fixes https://github.com/libsdl-org/SDL/issues/1928
2022-08-22 12:49:41 -07:00
slime b204db1e6b cocoa: change Shape data to use ObjC objects instead of C structs.
Fixes #6089
2022-08-21 14:49:00 -07:00
Frank Praznik 057086e389 wayland: Add high resolution scroll wheel support
Update the Wayland core protocol spec file and add support for the new axis_value120 event to handle high resolution scroll wheels.

The axis_value120 replaces the axis_discrete event, which is no longer sent as of version 8 of the protocol.  Note that unlike the axis_discrete event, no mention in the spec is made regarding how many axis_value120 events may occur per-axis per-frame, so the values are accumulated and committed when the pointer frame event occurs.
2022-08-21 08:54:58 -07:00
Frank Praznik d731ad769d wayland: Fix include order when building with libdecor
The libdecor header internally includes wayland-client.h, which pulls in the wayland-client-protocol.h file from the system include path and overrides the local one generated from the included Wayland protocol spec files. Move the Wayland protocol header inclusion above the libdecor header inclusion to ensure that the locally generated protocol header is used instead.
2022-08-21 08:54:58 -07:00
Ryan C. Gordon 4ca7b378c5
x11: Specify windowed dimensions when creating fullscreen windows.
This lets the window manager adjust the window correctly if it ever
leaves fullscreen mode.

Fixes #5725.
2022-08-21 11:35:14 -04:00
Sam Lantinga ffab139646 Fixed minimized window detection when handling WM_WINDOWPOSCHANGED
When minimizing a window, we get this sequence of events:
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_NCCALCSIZE
WM_WINDOWPOSCHANGED - IsIconic() is true
WM_MOVE
WM_SIZE - SDL sees minimized state here

When restoring a window, we get this sequence of events:
WM_WINDOWPOSCHANGING
WM_GETMINMAXINFO
WM_NCCALCSIZE
WM_NCPAINT
WM_ERASEBKGND
WM_WINDOWPOSCHANGED - IsIconic() is false
WM_MOVE
WM_SIZE - SDL sees restored state here

On Windows 10 a minimized window has a non-empty client rect, so we were delivering a minimized size before SDL knows that the window is minimized, and then ignoring the restored size when handling the restore message.

The fix is to use IsIconic() which returns the correct window state when WM_WINDOWPOSCHANGED is actually delivered.
2022-08-19 17:28:31 -07:00
Sam Lantinga 5a3adbfdb2 Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED to control whether the player LED is set on Xbox 360 controllers 2022-08-19 11:11:25 -07:00
Sam Lantinga 52b6899a6b Added hints for more fine grained control over HIDAPI Xbox controller support 2022-08-19 11:11:23 -07:00
Luke Street 2b93f6e148 cocoa/uikit: Use VK_EXT_metal_surface in Vulkan_GetInstanceExtensions
Replaces VK_MVK_macos_surface and VK_MVK_ios_surface
2022-08-19 09:48:22 -07:00
Luke Street 029a9b2fa1 cocoa/uikit: Support VK_EXT_metal_surface
Uses VK_EXT_metal_surface (vkCreateMetalSurfaceEXT)
when possible, otherwise falls back to the obsoleted
VK_MVK_macos_surface and VK_MVK_ios_surface.

Fixes #3906
2022-08-19 09:48:22 -07:00
antonino ad874536a4 kmsdrm: enable vrr on displays that support it 2022-08-19 09:45:03 -07:00
Sam Lantinga 6e9c14e550 Updated to version 2.25.0 for development 2022-08-19 09:38:42 -07:00
Sam Lantinga 8c9beb0c87 Updated to version Updated to version 2.24.0 for release 2022-08-19 08:44:09 -07:00
Sam Lantinga 6e007c36e7 Add null termination to Wayland_data_source_get_data() if requested
Fixes https://github.com/libsdl-org/SDL/issues/6083
2022-08-18 19:05:55 -07:00
Sam Lantinga 948dbe7d3f Don't include the null terminator in Wayland clipboard text
Fixes https://github.com/libsdl-org/SDL/issues/6083
2022-08-18 16:24:20 -07:00
Frank Praznik 3bae2d57da wayland: Set the libdecor app ID after visibility calls
Set the frame app ID after toggling visibility or the name displayed in window manager task switchers may not display correctly.
2022-08-18 10:58:32 -07:00
Sam Lantinga 8acb4e45b3 Fixed interactions between mouse capture and grab on X11
Fixes https://github.com/libsdl-org/SDL/issues/6072
2022-08-17 14:26:34 -07:00
Frank Praznik 7da74eb5be wayland: Never commit with an undefined window title
If libdecor performs a commit with the frame title being undefined, a crash can occur within the library or its plugins. Always ensure that the title is set to a valid string to avoid this.
2022-08-17 12:40:16 -07:00
Cameron Cawley 09b6956dcc opengl: Support NV12 textures on GPUs with only 2 texture units 2022-08-16 07:30:13 -07:00
Cameron Cawley 2fcd8f889c Handle SDL_PIXELFORMAT_EXTERNAL_OES in SDL_GetPixelFormatName() 2022-08-16 07:29:45 -07:00
Sam Lantinga 9670d2bb9e Make sure we hold the joystick lock when disconnecting a HIDAPI joystick
This prevents crashes when calling SDL joystick API functions from a different thread while disconnection is happening.

See https://github.com/libsdl-org/SDL/issues/6063 for a more thorough review of joystick locking.
2022-08-15 17:28:50 -07:00
Ryan C. Gordon 26948f01a3 cocoa: Make SDL_MinimizeWindow() work with borderless windows.
Fixes #6046.
2022-08-15 20:09:09 -04:00
Frank Praznik 650612fdcb wayland: Eliminate excessive calls to SetFullscreen
Eliminate excessive calls to SetFullscreen by removing the calls in the libdecor and xdg-toplevel config callbacks.

These calls were being made there in case something explicitly called the window minimization function from within SDL, which unsets fullscreen, and as minimizing a window in Wayland is just a suggestion to the compositor and doesn't actually change the window state or communicate anything back to the application, it was necessary to call SetFullscreen in every call to the config functions just in case something minimized a window via SDL_MinimizeWindow() and later needed to restore it.  GNOME in particular had issues when fullscreen set/unset operations were being hammered, leading to overlapping acks and commits when switching to fullscreen.

With the new video system flag to disable unsetting fullscreen when minimizing a window, these calls in the configuration functions are no longer needed and can be removed. This significantly reduces calls to the SetFullscreen() function, reverts #6044 while fixing the issue, and fixes a similar problem when hiding and showing a window initially created with fullscreen flags.
2022-08-15 11:16:20 -07:00