Commit Graph

11746 Commits

Author SHA1 Message Date
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 bea34c53804ada8d90c94aba27262635513452d3)
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 15504da0b830aacdb8f8301e22ba5eb6ea9eb1b0)
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 ad0af488837e44cbea0f0eab3b2f73b50a74bff4.

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 2c1fbe1967457c6b95323a5ea4136849c66bc307)
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 edd044e90187528656327584b6e2337bbceacd57)
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 69cae07cc1c216e35ddf3df98048378ad7aeaf92)
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 87794d03ad0c0e2bcf1856e6bd3bab268e952b96)
2023-11-10 17:32:34 -08:00
Sam Lantinga
4a0bd06d58 Added support for the GameSir-G7 Controller for Xbox
(cherry picked from commit 2e6c48dcb4b52df4dd9244610ba23a8f5e3debe5)
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 fbb6934905ec3ff75c920db619ef199b4175b636)
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 f4b61fff308443727c52ae098923b9e934660609)
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 a4c6b38fef2ff046e38072200b096c03389bfa28)
2023-11-08 07:46:42 -08:00
Sam Lantinga
76ff25eedf Fixed FreeBSD build
(cherry picked from commit d9e6dcc650fd96c66d1177438d1e0ee9b624c21c)
2023-11-08 04:45:46 -08:00
Sam Lantinga
5d29f22808 Store the requested muted state
(cherry picked from commit 7cc3e94eb22f2ee76742bfb4c101757fcb70c4b7)
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 ce9e1bd32485ae8a024d8147e3aa3a36f0cb0a19)
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 e5ccc80aba60f4132823d71ea6952c87f2392d06)
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 15bc12165ab56e6fbf93b8f3d18f2a0bb5854d8c)
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 8049af3355975c25bc5ac29ac518893d776a769b)
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 ed1e0c1530e7902d6562f8e8cab2aa38e829a834)
2023-11-08 00:18:13 -08:00
Sam Lantinga
b07e5d38a2 Added missing calls to SDL_InvalidParamError("surface")
(cherry picked from commit 04e98d2236c02cbb10d0b88e1782b4dd4bf9d44a)
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 28e623c504558c0e438011207bcee254003b0f81)
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 4106697774ff533b2eeb223f87103fa464fc598a)
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
Ivan Mogilko
7526a87ff2 Handle subsystem dependencies recursively
Existing code is erroneous, because it adds or removes dependency's ref count based on number of InitSubSystem/QuitSubSystem calls, while ref count diff should depend on number of inited or quit dependents.
Recursive approach seems to be simplest solution that guarantees proper ref count.
2023-11-07 08:40:15 -08:00
Sam Lantinga
171e306dbf Enable the 5th player LED on the DualSense controller
Fixes https://github.com/libsdl-org/SDL/issues/5152

(cherry picked from commit 22016b4eae50fab0698ff3a33672f57283f1cccd)
2023-11-06 20:15:39 -08:00
Sam Lantinga
d6c725d522 Removed misleading comment
Fixes https://github.com/libsdl-org/SDL/issues/5069

(cherry picked from commit 66cf30c2de4f12c1b99b8d51ea5d77b62b373907)
2023-11-06 19:34:03 -08:00
Sam Lantinga
0c85173d5b Fixed connecting and disconnecting real-joysticks closing virtual joysticks in Emscripten (thanks David!)
Emscripten was using its own, private integer in order to allocate
new SDL_JoystickIDs.  SDL keeps a similar integer for allocating
joystick-ids, one which is shared across multiple joystick backends.

SDL 2.0.13 introduces a new joystick-backend, a Virtual joystick
backend, which allows for software-driven joysticks, and which is
designed to sit alongside joystick-backends that provide access to
physical joysticks.

The Emscripten and the Virtual backends were, at times, getting
allocated the same SDL_JoystickIDs, if and when both backends were used
simultaneously.  This could happen if, for example, an application
was using a virtual joystick in order to drive a touch-screen
based joystick, while also supporting physical joysticks through the
Emscripten backend.

When two joysticks end up with the same SDL_JoystickID, conflicts
can occur.  For example, disconnecting a physical joystick with
the same SDL_JoystickID as a virtual one, can lead to the virtual
joystick being closed, inadvertently.

This fix makes the Emscripten backend use SDL's cross-joystick-backend
integer counter, which is shared among joystick backends, for allocating
new SDL_JoystickIDs, rather than a private, Emscripten-specific
counter.

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

(cherry picked from commit 07cb7c10a15b95387431bcb3a1ae77cfd432707b)
2023-11-06 17:13:16 -08:00
Ozkan Sezer
7555701def autotools: fix linux joystick breakage after commit 221d6ea8a8ca
Fixes https://github.com/libsdl-org/SDL/issues/8488
2023-11-06 23:25:58 +03:00
Ryan C. Gordon
065d80716b
hidapi: Avoid memcpy'ing to NULL.
(This fix was originally from @themightyoarfish on GitHub. Thanks!)

Fixes #8428.
Reference PR #8431.

(cherry picked from commit c6d9fb1ad71462bc844c6ca41e2ac7fe7cec3883)
2023-11-06 13:50:49 -05:00
Ryan C. Gordon
9d7feaaf9e
coreaudio: If paused, clear any pending stream data.
This makes sure stuff that was still pending for conversion/resampling doesn't
pop in later when the device is unpaused again.

Fixes #8485.
2023-11-06 09:57:00 -05:00
Sam Lantinga
d5896f9010 Fixed memory leak in XInput code
Fixes https://github.com/libsdl-org/SDL/issues/3597

(cherry picked from commit 3e4d7e48b0a87b2c1df26ad62c8152ba6c064024)
2023-11-06 00:40:48 -08:00
Sam Lantinga
64a7e75dd3 Only save ibus_addr_file after we've successfully read an address from it.
Fixes https://github.com/libsdl-org/SDL/issues/3359

(cherry picked from commit bc3d9e99f381072820d29e75e6cc28fe40572c42)
2023-11-05 22:13:34 -08:00
Ozkan Sezer
93e51dd33e fix a possible memory leak in SDL_vasprintf()
(cherry picked from commit 1a83bf2399c29f3028477225067bf6a106068f08)
2023-11-05 20:02:20 +03:00
Sam Lantinga
e8f4045d0b Use XINPUT_STATE instead of XINPUT_STATE_EX (thanks Andrew!)
XINPUT_STATE_EX isn't actually a thing, we can just use the normal XINPUT_STATE

Fixes https://github.com/libsdl-org/SDL/issues/2797
2023-11-04 22:24:55 -07:00
Sam Lantinga
aa129c9257 Fixed potential uninitialized memory access (thanks Mathieu!)
GetRawInputDeviceList() can return a different number of devices than was allocated.

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

(cherry picked from commit b9784feb2467dbb4cdc2474aa78098cd4f0b1630)
2023-11-04 21:12:15 -07:00
Sam Lantinga
4c2eb6b95d Use the default UCS2/UCS4 conversion rather than non-portable INTERNAL encoding
Fxies https://github.com/libsdl-org/SDL/issues/1497

(cherry picked from commit d07a264a9bc42bd2d92ce12fab55f1855d0e8277)
2023-11-04 12:02:18 -07:00
Ozkan Sezer
e226008d83 configure: move HAVE_LINUX_INPUT_H to CheckInputEvents()
c.f.: https://github.com/libsdl-org/SDL/pull/8459.
Ref. issue https://github.com/libsdl-org/SDL/issues/8450
2023-11-02 23:33:20 +03:00
Anonymous Maarten
8b1b6734f6 cmake: fold HAVE_INPUT_EVENTS into HAVE_LINUX_INPUT_H 2023-11-02 21:28:39 +01:00
Sam Lantinga
97c2bdf256 Added patch note for SDL_GDKGetDefaultUser() 2023-11-02 09:59:25 -07:00
Sam Lantinga
20ecd2afcb Check to make sure the Windows joystick device has buttons and axes
This reverts commit e5a15f94e2f1a8fbbffb25ea9932cda9679a68fd.

It turns out removing this check allows mice like the ROG PUGIO II to show up as game controllers. We need to find a different way to differentiate between gaming mice and pedals.

Since these mice show up as controllers, and potentially causing games to use them instead of real controllers, we'll go ahead revert this change for now.

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

(cherry picked from commit ad0af488837e44cbea0f0eab3b2f73b50a74bff4)
2023-11-02 08:43:11 -07:00