Commit Graph

6587 Commits

Author SHA1 Message Date
Sam Lantinga
37d244ea81 Added support for the 8BitDo Ultimate Wired Controller in DirectInput mode, including the misc button and paddles 2022-11-28 14:49:07 -08:00
Sam Lantinga
a937b5c4ad Add 8BitDo to the list of Xbox 360 third party vendors
Allows detection of the 8BitDo Ultimate Wired Controller
2022-11-28 13:47:30 -08:00
Sylvain Becker
fb0ce375f0 Cleanup add brace (#6545)
* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line

(cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
2022-11-28 12:33:03 -08:00
Samuel Venable
0739d237ad
[skip ci] Solaris getexecname() returns argv[0]
`argv[0]`/`getexexname()` are not always absolute paths by default and can be modified to anything the developer wants them to be.

Consider using `readSymLink("/proc/self/path/a.out")` instead and `getexecname()` as the fallback, since the symlink will always be the correct absolute path (unless /proc is ot mounted, but it is by default on Solaris and Illumos platforms).

(cherry picked from commit 4f5e9fd5bda0d58c2907f75fa4ea0c92c3a2525f)
2022-11-27 21:38:01 -05:00
Markus Mittendrein
8145212103 SDL_ResampleAudio: Fix float accumulation error
While 78f97108f9 reduced the accumulation error, it was still big enough to cause distortions.
Fixes #6196.
2022-11-27 21:06:52 -05:00
Joshua Root
2df39e64ab Fix build with Xcode < 7
The _Nullable attribute is not available in older versions.

(cherry picked from commit 9a64aa6f95298bf459f8b9dca583df7064956cd9)
2022-11-26 20:36:54 -08:00
Sam Lantinga
8fddf146bf Temporary hack to address performance issues in https://github.com/libsdl-org/SDL/issues/6581#issuecomment-1327987916 (thanks @icculus!)
(cherry picked from commit 9c8369e097b229997875c0aeb4dc9cfdcde0e2b2)
2022-11-26 13:11:26 -08:00
Ryan C. Gordon
3f5593d613 cocoa: Patched to compile on macOS SDK < 10.10.
Fixes #6586.

(cherry picked from commit fa5adcafd52303fde86c64094462303404259d75)
2022-11-26 13:59:44 -05:00
Michael Fitzmayer
e19c532ebf Add bitdraw.h, remove non-working stub class
(cherry picked from commit 67f31a19a8eb06ee80bccb9ec8cc8c34aa635b3d)
2022-11-24 13:13:08 -08:00
Sylvain Becker
192cdf3d04 SDL_mfijoystick.m: remove VLA, so that projects can be built with error on vla 2022-11-24 18:33:50 +03:00
Frank Praznik
66bd15555c wayland: Fix build when not using the shared Wayland libraries
Explicitly include the Wayland protocol headers when statically linking against the Wayland libraries or older system headers might be used instead of the local versions.

(cherry picked from commit 836eb224428aca3bdab2a6bf56d347262e475b15)
2022-11-24 03:01:42 -08:00
Sam James
4c7156c1e6 Avoid use of deprecated egrep/fgrep
GNU grep 3.8 emits a deprecation warning on use of egrep/fgrep.

Signed-off-by: Sam James <sam@gentoo.org>
(cherry picked from commit 3e7952ce8a0affd325c802755cae5fd843b86d99)
2022-11-24 02:59:41 -08:00
Joshua Root
33e5de31d8 vulkan_metal.h: Make compatible with ObjC ARC
Fixes #6598

(cherry picked from commit 239423e205496997a387b4f265b1cdaf5acd18cb)
2022-11-23 17:39:26 -08:00
Frank Praznik
3eaf56894e wayland: Fix libdecor_dispatch signature
The function returns an int, not a bool.

(cherry picked from commit f47169fcba8a27bb0740b6b4993989ff9262c21f)
2022-11-23 15:17:52 -08:00
Joshua Root
242ce20cbf SDL_mfijoystick.m: fix build with Xcode < 9
Fixes #6601.

(cherry picked from commit 53ca1f77029289a58f1a9963a00b637b903f494d)
2022-11-23 12:48:26 -08:00
Joshua Root
f52e7199df Check build-time SDK in LoadMainMenuNibIfAvailable
Fixes building against OS X 10.7 SDK.

(cherry picked from commit f8cebeea599ae65f36d388257a9d9a8ed8ada576)
2022-11-23 12:28:43 -08:00
Joshua Root
e12c831b15 SDL_cocoaopengl.h: ensure CVDisplayLinkRef is defined
The typedef seems to be pulled in coincidentally with newer SDKs, but
older ones need to import the header explicitly.

(cherry picked from commit d2910904fb4062c313636c7595e971f1bf248075)
2022-11-23 12:22:40 -08:00
Ozkan Sezer
cd399caf6f fix dynapi after SDL_GDKSuspendComplete addition. 2022-11-23 22:50:10 +03:00
Ciro Mondueri
f6144dfe03
adds GDK suspend/resume basic handling (#6596) 2022-11-23 11:41:14 -08:00
Sam Lantinga
dce6ed56d7 Removed G29 from controller_type.c
We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games.
2022-11-22 10:56:44 -08:00
Sam Lantinga
e3d430b83e Revert "Added Linux mappings for the Logitech G29 in PS3 and PS4 modes"
This reverts commit 33a68f575f.

We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games.
2022-11-22 10:53:28 -08:00
Sam Lantinga
ea8f8b6dc3 Updated to version 2.27.0 for development 2022-11-21 16:36:10 -08:00
Sam Lantinga
0bfeed061b Updated to version 2.26.0 for release 2022-11-21 16:15:58 -08:00
Sam Lantinga
d167cd6715 Added the Gunfighter Mk.III ‘Space Combat Edition’ as a flight stick 2022-11-21 09:02:10 -08:00
Sam Lantinga
8b20b568b0 Don't report battery level for disconnected batteries
Fixes https://github.com/libsdl-org/SDL/issues/6536
2022-11-21 07:42:14 -08:00
Frank Praznik
fe396e306e wayland: Use the cached window size when switching from non-floating to floating window state
When changing the window state from non-floating to floating (e.g. leaving fullscreen), libdecor can send bogus content sizes that are +/- the height of the window title bar and start 'walking' the window height in one direction or the other with every transition.

The floating window size is known, so use the cached value instead of the size reported by libdecor when restoring the floating state.
2022-11-19 09:15:27 -08:00
Sam Lantinga
509939b1b6 Disable the third party PS3 HIDAPI driver by default, the L3/R3 buttons are unknown 2022-11-18 18:20:53 -08:00
Sam Lantinga
ff99e56d3a Fixed KMSDRM window creation failing if OpenGL libraries are not available, but GLES 2.0 libraries are 2022-11-18 12:54:55 -08:00
Sam Lantinga
da9ba3a2a1 If a CRTC doesn't have a mode configured, use the preferred or largest mode as the default mode
Fixes https://github.com/libsdl-org/SDL/issues/6421
2022-11-18 12:17:27 -08:00
Sam Lantinga
ea4ea27a59 Don't trigger an error if we try to delete a touch device after shutting down the touch system
This can happen on Raspberry Pi if the display system fails to initialize.
2022-11-18 11:14:14 -08:00
David Gow
81479d8784 wayland: keyboard: Cache text input parameters.
Some applications (and embarrassingly, testime is one of them) call
SDL_StartTextInput() or SDL_SetTextInputRect() every frame. On KDE/KWin
with fcitx5, this causes there to be several preedit events every frame
(particularly given some of the workarounds in Wayland_StartTextInput),
which slows testime down to an unusable crawl.

Instead, make SDL_StartTextInput() a no-op if text input is already
enabled, and cache the input rect, only changing it when the new rect is
actually different.

With these changes, we only get preedit events (and hence
SDL_TEXTEDITING events) when the preedit string actually changes. This
matches the behaviour under XWayland, and works very smoothly.
2022-11-18 07:18:36 -08:00
Ozkan Sezer
6dc96aa745 SDL_UDEV_DelCallback: return early if _this is NULL
Fixes https://github.com/libsdl-org/SDL/issues/6548
2022-11-18 18:02:10 +03:00
Sylvain
16824865c2 Cleanup of SDL_SetError that already return -1 value 2022-11-18 06:59:10 -08:00
Sylvain
3e70553c48 Unneed test before calling SDL_FreeSurface 2022-11-18 06:58:34 -08:00
Sam Lantinga
78ea6af2cd Updated to version 2.25.1 for release candidate 2022-11-17 09:01:35 -08:00
Sylvain
89572af6a8
Fixed bug #6537 - AIX: use PAUDIO_WaitDevice 2022-11-17 11:43:46 +01:00
Sylvain
cd0d5a5fc5
Don't compare pointer against '0', but NULL 2022-11-17 11:23:15 +01:00
Sylvain
ddad901c0d
Remove unneeded semicolon 2022-11-17 10:43:45 +01:00
Sylvain
60c6cd554d
Fixed bug #6533 - PS2_JoystickUpdate: some invalid condition 2022-11-17 09:34:27 +01:00
Sam Lantinga
77bcd269be Allow creating an empty surface with pitch 0
This fixes Maelstrom, which creates an empty staging surface and then uses it for transfer to texture
2022-11-16 22:23:16 -08:00
Ryan C. Gordon
a1702d463c
ibus: Try to use org.freedesktop.portal.IBus first if available.
This should fix apps that want ibus support inside sandboxed environments
like FlatPak or Snaps.

Fixes #4706.
2022-11-16 23:39:41 -05:00
Ryan C. Gordon
bb0b8adacc mac: Fix handling of deprecated symbol.
This needs to check what our deployment target is, not what SDK
is available, since this is a linker symbol and not an enum
value or whatever.

Also removed a copy/paste error that mentioned CoreAudio in
the haptic subsystem.

Fixes #6534.
2022-11-16 22:04:04 -05:00
Sam Lantinga
913e403f2a Fixed error message when trying to create an OpenGLES2 renderer on macOS
Testing: testsprite2 --renderer opengles2

OpenGLES2 isn't available by default, and we want to see the error "Could not load EGL library"
2022-11-16 18:03:29 -08:00
Sam Lantinga
fcc994e132 ensure that SDL2 does not set conflicting window flags (thanks @pionere!) 2022-11-16 17:40:32 -08:00
Sylvain
ce5da5d579
Don't compare pointer against '0', but NULL 2022-11-16 21:47:43 +01:00
Sylvain
1d7966df15
Remove un-needed check for NULL pointer. They were previously checked just before. 2022-11-16 21:27:16 +01:00
Frank Praznik
8ea96f365f events: Remove X and XKB keysym constants and headers
The XKB_KEY_* and XK_* macros resolve to the same constant values, so use the raw values and note what keys they correspond to in the comments, as is done for the other keysym values in this file.

This completely eliminates the need for any X or XKB system headers along with the if/else defines.
2022-11-16 11:42:53 -08:00
Ryan C. Gordon
389ffab733 Code style fixes, etc.
Reference PR #6345.
2022-11-16 12:53:48 -05:00
ulatekh
ec58a817ef Fixes made in response to running a static code analyzer under MS Windows.
Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs.

SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision.
SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer.
SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used.
SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range.
SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it.
SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691).
SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen.
SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL.
SDL_pixels.c: Looks like the switch is genuinely missing a break!
SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons.
SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
2022-11-16 12:43:20 -05:00
Ryan C. Gordon
7ebdae5dc9 cocoa: Fix OpenGL deprecation warning. 2022-11-16 11:45:41 -05:00