Commit Graph

11763 Commits

Author SHA1 Message Date
Ozkan Sezer 3fb5124174 cmake: add openbsd wscons sources to build, if supported 2023-11-22 05:10:02 +03:00
Ozkan Sezer 59b0a2d711 kmsdrm: restrict KMSDRM_ReleaseVT/KMSDRM_AcquireVT to SDL_INPUT_LINUXEV 2023-11-22 05:10:02 +03:00
Sam Lantinga dcd21d042f Improved GCController handling on Apple platforms
Automatically map controllers as gamepads when using the GCController framework and prefer the physicalInputProfile when possible.

Testing with macOS 13.4.1, macOS 14.1.1, iOS 15.7.4, tvOS 17.1:
* iBuffalo Classic USB Gamepad (macOS only)
* Logitech F310 (macOS only)
* Apple TV remote (tvOS only)
* Nimbus MFi controller
* PS4 DualShock controller
* PS5 DualSense controller
* Xbox Series X controller
* Xbox Elite Series 2 controller
* Nintendo Switch Pro controller
* Nintendo Switch Joy-Con controllers

(cherry picked from commit 0fe5713964)
Author: Sam Lantinga <slouken@libsdl.org>
Date:   Tue Nov 14 12:58:33 2023 -0800
2023-11-21 15:17:53 -08:00
Sam Lantinga 2d81beb819 Show the mapping used when a game controller is opened 2023-11-21 13:49:38 -08:00
Sam Lantinga 4de4b1e7a0 Don't tickle PS4 Bluetooth controllers in simple mode
The 8BitDo Zero 2 only sends reports when state changes, so trips the disconnected Bluetooth controller detection. The expected use case is that most people will have official PS4 controllers in enhanced report mode, so disconnected Bluetooth controller detection will still work for those.

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

(cherry picked from commit 75df4cc5c2)
2023-11-21 13:25:31 -08:00
Cameron Cawley f33ab44f84 Extend blitting support for all <8bpp formats 2023-11-20 15:50:51 -08:00
Cameron Cawley 67eb03400a Add SDL_PIXELFORMAT_INDEX2LSB and SDL_PIXELFORMAT_INDEX2MSB 2023-11-20 15:50:51 -08:00
Ryan C. Gordon cb5b8c9747
testshader: Don't make local variables with the same name as GL entry points.
Reference Issue #2706.
2023-11-20 15:10:30 -05:00
Ryan C. Gordon c331b64d79
audio: Tighten up possession of detectionLock during device open.
We don't need it for most of the time, and holding it during the backend's
OpenDevice upsets ThreadSanitizer vs our PulseAudio code.

Fixes #7427.
2023-11-20 01:01:49 -05:00
Ryan C. Gordon e51760e111
audio: Wait for device thread to set `device->threadid` before continuing.
This fixes a (likely harmless) race condition in `is_in_audio_device_thread`.

Reference Issue #7427.
2023-11-19 12:26:51 -05:00
Deve c67ff82377 Avoid textinput events when pasting from clipboard on iOS.
I handle command+C and command+V shortcuts for copy/paste from clipboard using
SDL_GetClipboardText/SDL_SetClipboardText. But on iOS command+V shortcut is
also handled by system, so that I also get textinput event with that clipboard
text. And thus the application gets this clipboard text twice (from
SDL_GetClipboardText and from textinput event).

I assume that intended behavior is that command+V shouldn't generate textinput
events. At least as far as I know ctrl+V on other platforms does nothing. This
commit disables paste action for UITextField, so that textinput event isn't
generated anymore.

(cherry picked from commit eddaf870f5)
2023-11-19 08:20:01 -08:00
Ryan C. Gordon 42d979a231
audio: Just use the system default stack size for the device thread.
Fixes #7367.
2023-11-19 11:10:29 -05:00
Cameron Cawley 1bb5448fe8 Use the correct pixel formats for OpenGL ES on big endian 2023-11-17 15:03:37 -08:00
Ozkan Sezer 2222f44c94 use format string attributes for functions accepting va_list params, too 2023-11-17 15:56:10 +03:00
Anonymous Maarten d81d986858
cmake: fix uses of undefined macro identifiers (-Wundef) 2023-11-17 03:06:26 +00:00
Sam Lantinga cc7c0a2dab Fixed IOS_SupportedHIDDevice() returning SDL_FALSE before initialization
(cherry picked from commit 34392db9c3)
2023-11-14 10:58:18 -08:00
Sam Lantinga 76cc24e34a Added SDL_HINT_JOYSTICK_IOKIT and SDL_HINT_JOYSTICK_MFI to control whether the IOKit and GCController drivers should be used for joystick support.
This can be used to work around issues where the Apple GCController driver doesn't work for some controllers but there's no way to know which GCController maps to which IOKit device.

(cherry picked from commit 708f18d49e)
2023-11-14 10:32:52 -08:00
Sam Lantinga 0ec1209eab Fixed a memory leak at window creation.
Windows updates the desktop display mode once at video init (in WIN_InitModes()) and once when creating a window (in WIN_RefreshDisplays())

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

(cherry picked from commit bea34c5380)
2023-11-14 09:29:55 -08:00
Louis M 925362a2fc Replacing SDL_SCANCODE_AUDIOMUTE by SDL_SCANCODE_MUTE on Windows 2023-11-14 09:26:15 -08:00
Sam Lantinga 1de85491e1 Fixed mouse wheel scrolling direction on iOS
(cherry picked from commit 15504da0b8)
2023-11-14 09:25:04 -08:00
Sam Lantinga cc20d0147e Revert "Check to make sure the Windows joystick device has buttons and axes"
This reverts commit ad0af48883.

It turns out the ROG PUGIO II actually enumerates as a gamepad, so this change didn't have any effect anyway. We're getting lots of reports of people's racing pedals and similar devices no longer showing up, so we'll revert this again.

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

(cherry picked from commit 2c1fbe1967)
2023-11-13 21:37:18 -08:00
Sam Lantinga 8c82b73027 Fixed the ROG PUGIO II showing up as a game controller
This mouse actually enumerates as a gamepad with 2 axes, 8 buttons and a hat.

We'll ignore it like the other ROG mice, unless someone specifically wants to use it as a gamepad.

(cherry picked from commit edd044e901)
2023-11-13 21:37:06 -08:00
nia 92d70f4167 cpuinfo: Fix detection of physical memory above 2GB on NetBSD
Rework the code to clearly prefer 64-bit sysctls first, then
legacy sysctls, and eliminate a second ifdef.

Signed-off-by: Nia Alarie <nia@NetBSD.org>
(cherry picked from commit 69cae07cc1)
2023-11-13 06:50:54 -08:00
Yussuf Khalil 63e9827b90 wayland: Fix DPI calculation with scaled outputs
`driverdata->width` and `driverdata->height` represent the width and height in logical pixels on scaled outputs with xdg_output. However, to correctly calculate the display's DPI value, we need to use its native resolution.

For example, on a 27" 4K screen with 175% scaling, we have `width` == 2192 and `height` == 1233, resulting in a bogus value of 92dpi, whereas 162dpi are correct for 3840x2160 pixels at 27 inches.

Tested on GNOME mutter 45.1.
2023-11-12 09:08:31 -05:00
Sylvain Becker f3419d8c04
Re-add SDL_assert() with non boolean ptr syntax (#8531) 2023-11-11 12:29:05 +03:00
Sam Lantinga c29df1699e Added shortened name for "Nintendo Co., Ltd."
(cherry picked from commit 87794d03ad)
2023-11-10 17:32:34 -08:00
Sam Lantinga 4a0bd06d58 Added support for the GameSir-G7 Controller for Xbox
(cherry picked from commit 2e6c48dcb4)
2023-11-10 17:32:11 -08:00
Sam Lantinga 03f29c19dc Added support for the Dragonrise GameCube adapter with VID 0x1843
(cherry picked from commit fbb6934905)
2023-11-10 16:45:07 -08:00
Sylvain Becker a14b948b6c
[SDL2] pointer boolean (#8523) 2023-11-10 06:30:56 -08:00
Anonymous Maarten 4a3a9f3ad8 Older gcc does not support #pragma GCC diagnostic inside functions 2023-11-09 23:34:05 +01:00
Anonymous Maarten d38ccfa88f x11: Ignore deprecated declaration of XKeycodeToKeysym 2023-11-09 18:46:27 +01:00
Anonymous Maarten f0d65436fb ci: re-enable Intel compilers on ci 2023-11-09 18:07:10 +01:00
Sam Lantinga dfc38ef460 Implemented VT switching for KMSDRM on Linux
Fixes https://github.com/libsdl-org/SDL/issues/3844

(cherry picked from commit f4b61fff30)
2023-11-08 20:46:13 -08:00
Anonymous Maarten adc0880520 cmake: also install pdb files of static libraries 2023-11-09 03:23:24 +01:00
Sam Lantinga 509c70c698 Allow the application to draw while Windows is in a modal move/resize loop
SDL will send an SDL_EVENT_WINDOW_EXPOSED event for your window during the modal interaction and you can use an event watcher to redraw your window directly from the callback.

Fixes https://github.com/libsdl-org/SDL/issues/1059
Closes https://github.com/libsdl-org/SDL/pull/4836
2023-11-08 14:01:00 -08:00
Sam Lantinga 3900fca304 Fixed FreeBSD build
(cherry picked from commit a4c6b38fef)
2023-11-08 07:46:42 -08:00
Sam Lantinga 76ff25eedf Fixed FreeBSD build
(cherry picked from commit d9e6dcc650)
2023-11-08 04:45:46 -08:00
Sam Lantinga 5d29f22808 Store the requested muted state
(cherry picked from commit 7cc3e94eb2)
2023-11-08 03:37:09 -08:00
Sam Lantinga 87bb0f5bcb Don't mute the console input if we can't read the keyboard
This makes sure you can hit Ctrl-C if you don't have permission to access the raw keyboard device.

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

(cherry picked from commit ce9e1bd324)
2023-11-08 03:29:39 -08:00
Wohlstand f9baa30270 sdlchecks.cmake: Clarified the reason why shared X11 mode doesn't work
#6778
2023-11-08 02:57:04 -08:00
Sam Lantinga 7e11bd1ac1 Removed useless branch test
Fixes https://github.com/libsdl-org/SDL/issues/8286

(cherry picked from commit e5ccc80aba)
2023-11-08 01:35:57 -08:00
Sam Lantinga af7fe2cf9b Actually we need to enumerate the 8BitDo Xbox SKUs
At the point we're calling SDL_IsJoystickXboxSeriesX(), we don't know for sure that the controller is an Xbox controller.

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

(cherry picked from commit 15bc12165a)
2023-11-08 00:43:43 -08:00
Sam Lantinga 524ccf033f Assume all 8BitDo Xbox controllers have a share button
Fixes https://github.com/libsdl-org/SDL/issues/8174

(cherry picked from commit 8049af3355)
2023-11-08 00:36:27 -08:00
Sam Lantinga b1807797a3 Make sure joysticks are locked when adding and removing them
Fixes https://github.com/libsdl-org/SDL/issues/8146

(cherry picked from commit ed1e0c1530)
2023-11-08 00:18:13 -08:00
Sam Lantinga b07e5d38a2 Added missing calls to SDL_InvalidParamError("surface")
(cherry picked from commit 04e98d2236)
2023-11-07 21:58:39 -08:00
Sam Lantinga 624905a7f1 Destroy the window surface if we've created it for the software renderer
Fixes https://github.com/libsdl-org/SDL/issues/8011
2023-11-07 21:47:07 -08:00
Sam Lantinga 4ace02df5f Added a mapping for the Atari VCS controller connected over Bluetooth (thanks @WizzardSK!)
Fixes https://github.com/libsdl-org/SDL/issues/7116

(cherry picked from commit 28e623c504)
2023-11-07 18:09:00 -08:00
Sam Lantinga 70adacf08a Make sure we include the null terminator in XLookupStringAsUTF8()
Fixes https://github.com/libsdl-org/SDL/issues/6728

(cherry picked from commit 4106697774)
2023-11-07 16:25:12 -08:00
Sam Lantinga fb92d150d9 Removed unused SDL_OSEvent 2023-11-07 09:15:18 -08:00
Ivan Mogilko d9559ce1d4 Added subsystem refcount tests to testautomation 2023-11-07 08:40:15 -08:00