Commit Graph

11334 Commits

Author SHA1 Message Date
Sam Lantinga
63b8af3558 Disable unused local typedefs warning
This triggers on gcc 4.8.4 for compile time asserts inside of functions

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

Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2023-05-24 04:45:40 +03:00
Sam Lantinga
3f1fd5abff Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
Sam Lantinga
92f72682e7 Document the Android SDK versions checked in Java code
(cherry picked from commit b48b1ce50042168c5b9b310fa495cb355903c241)
2023-05-23 08:45:43 -07:00
Frank Praznik
891c89eeb8 Fix unused variable warnings 2023-05-23 11:15:48 -04:00
Frank Praznik
e2b8d96529 wayland: Validate surfaces and window data before sending touch events
Ensure that incoming touch events originate from valid surfaces owned by SDL and have proper window data before forwarding them to the touch subsystem, or the window focus pointer that is sent with the event may not be a pointer to an SDL window.
2023-05-23 10:31:28 -04:00
Sam Lantinga
78a92b4f9d Fixed duplicate Joy-Con controllers on macOS
If both Apple and HIDAPI drivers see the controller, HIDAPI will be preferred.

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

(cherry picked from commit 61ef4efdfae7e384b0d24b1b171a9ee6203a3f0d)
2023-05-22 14:52:05 -07:00
Sam Lantinga
7b2b99a996 Fixed handling the Saitek P3600, which doesn't use the Xbox 360 controller protocol
(cherry picked from commit cf0abf99118f1ea5ba423ce62950e5840db2c649)
2023-05-22 12:42:05 -07:00
Sam Lantinga
b6d051e226 Fixed reporting backspace key if there is no text in the edit buffer (thanks @312937!)
This workaround isn't necessary at API 30 and above.

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

(cherry picked from commit c971795954bc85086cd20cfc71b45a311b7ba0d1)
2023-05-22 12:01:52 -07:00
Sam Lantinga
0ad0347acb Use numeric codes for Android versions, to avoid SDK dependencies
(cherry picked from commit 3f6b2d1a61d0c0dcd6af7cc951c1d8c267ed1526)
2023-05-22 12:01:52 -07:00
Sam Lantinga
a2f4783e75 Don't map the top keyboard row to numbers when using the one-handed DVORAK layouts (thanks @tormol!)
Fixes https://github.com/libsdl-org/SDL/pull/5127
2023-05-22 11:30:42 -07:00
Caleb Cornett
2001a891c4 Fix Xbox link error from IsRectEmpty
(cherry picked from commit 376a3cd100a3d59e887496c75a1ac49ab4a2d8ec)
2023-05-21 19:11:25 -07:00
M. P. Halpin
1ee9a437f9 Stop beep when running iOS apps on ARM-based Macs
(cherry picked from commit bbf38bbbc334bc0ee90d3eec228a968d8fc1689e)
2023-05-20 11:21:13 -07:00
Sam Lantinga
69644346ac Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
Fixes https://github.com/libsdl-org/SDL/issues/7160
2023-05-20 11:09:36 -07:00
Sam Lantinga
00b87f1ded Make sure the sentinel is at the end of the current event pump cycle
If we're waiting, it's possible to not get any events, then add the sentinel, then pump again and then add another sentinel. We want to make sure we only have one sentinel and that it's at the end of the currently pumped events.

Testing:
* Verified test case in https://github.com/libsdl-org/SDL/issues/6539
* Verified test case in https://github.com/libsdl-org/SDL/issues/5350

Fixes https://github.com/libsdl-org/SDL/issues/6539
2023-05-20 10:27:48 -07:00
Sam Lantinga
beca41480d Undo name change for the controller list
(cherry picked from commit f60622c5103e37f221aa8252acfa9073cfbafbc7)
2023-05-19 14:27:06 -07:00
Sam Lantinga
43b12fd9bc Moved the controller list out so it can be included elsewhere
(cherry picked from commit 24007b00b2a5e9d09d953db79a24dd51b78e598b)
2023-05-19 14:23:57 -07:00
Sam Lantinga
e8ec8ba1d4 Added support for the Astro C40 in Xbox 360 mode
(cherry picked from commit a4b4dff4a2998699757f12d29fdd4c632db884fe)
2023-05-19 14:23:57 -07:00
Ozkan Sezer
feeec90873 test/testgles2_sdf.c: type fixes from commit e26e893daf, style clean-up. 2023-05-19 17:00:24 +03:00
Anonymous Maarten
d361acdd4e testgles2_sdf: build with CMake + fix build errors/warnings 2023-05-19 15:24:52 +02:00
Ozkan Sezer
92a487f2e4 style fixes for SDL_PROC macros. 2023-05-19 14:10:02 +03:00
Ryan C. Gordon
df9d0fb332
power: On Linux, compare status strings as case-insensitive.
In case something reports "Device" when we expected "device", etc.

Reference Issue #6835.
2023-05-18 13:26:55 -04:00
Ryan C. Gordon
4a0b9522b6
audio: Load .WAV files with format->blockalign==0.
In theory this is illegal, but legit wavefiles in the field do it, and
it's easy to bump it to 1 for general purposes.

Formats with more specific alignment requirements already check for them
separately.

Fixes #7714.

(cherry picked from commit 2e646c7141b3009628abda2a964ba5f9d1702e1a)
2023-05-17 20:09:28 -04:00
Ryan C. Gordon
32999798e0
dynapi: Accept a comma-separated list of libraries to attempt to load.
First one to load and have the necessary symbol is the one we accept,
if any. Once we accept one, we won't try loading others.

Fixes #7613.
2023-05-17 20:03:17 -04:00
valid-ptr
424bc4bcf7 SDL emscripten port: preventDefault should not be called on mousedown. Otherwise mouseup will not be fired outside iframe in Chrome-based browsers 2023-05-17 12:30:32 -07:00
Ryan C. Gordon
0eea92c8fc
blit: Add a case for 8-bit blits that sdl12-compat exposed.
sdl12-compat can get into a state where a color-keyed surface is
marked for blending, but wants to blend with full alpha (which
is the same as _not_ blending), so rather than fail to find a
blitter in that case, it just selects the colorkey blitter.

Reference https://github.com/libsdl-org/sdl12-compat/issues/233
2023-05-16 14:38:44 -04:00
Sam Lantinga
d42c303b24 Check to make sure the Windows joystick device has buttons and axes
This fixes incorrectly detecting the ROG CHAKRAM X mouse as a game controller on Windows 10

(cherry picked from commit 642504bc5993a6acd4d9c1d4c1314c6b1cf6e4e1)
2023-05-15 21:44:20 -07:00
Sam Lantinga
237348c772 Changed all variadic macros into fixed (thanks @Wohlstand!) 2023-05-10 06:29:35 -07:00
Ryan C. Gordon
86786ed544 coreaudio: Flush/stop the AudioQueue before disposing of it.
Otherwise, a CoreAudio thread lingers forever, and coreaudiod eats CPU
until the SDL process terminates.

Fixes #7689.
2023-05-08 14:25:01 -04:00
Sam Lantinga
de93728674 Removed redundant __powerpc__ check
(cherry picked from commit b6df25c33497388f16a4ed2af896ef14277c8865)
2023-05-06 08:44:48 -07:00
Jeremy Rand
5e74365e55 SDL_blit_N.c: Move ppc64le swizzle outside of loop
An in-place swizzle mutation was erroneously inside of a loop, which
caused each consecutive 4-pixel vector to alternate between correct and
incorrect endianness.

The bug was introduced in 715e070d29.

Thanks to RobbieAB for reporting the bug.

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

(cherry picked from commit 9142292f4ad6d9bc8a2bc7c874e2fde54befeb9b)
2023-05-06 08:39:59 -07:00
Loc(Elliot)
3e64fec9f4 Fix bug memory acess
Bitmap is not initialized before use, that cause segmentation fault on function use it. Fix by allocate memory before use.
2023-05-04 07:01:25 -07:00
Sam Lantinga
707e9397ca Removed memset_pattern4() from SDL headers
This requires including string.h, which isn't always done, so this commit simplifies dependencies on macOS

Fixes https://github.com/libsdl-org/SDL/issues/3657
2023-04-30 21:38:29 -07:00
Sam Lantinga
f72213c4ac By default, OpenBSD uses Linux controller mappings
Fixes https://github.com/libsdl-org/SDL/issues/7609

(cherry picked from commit 255c3b7c82968def667da860cbda01f267b4edf1)
2023-04-29 17:10:46 -07:00
Frank Praznik
132b88749c wayland: Destroy proxy wrappers and callbacks before event queues
Destroy any proxy wrappers and callbacks before the associated event queues to silence libwayland warnings about destroying the queues while proxies are still attached.
2023-04-27 13:08:59 -04:00
Linus Probert
8b39eb9b1f wayland: Fixes a memory leak wheere primary selection isn't freed
(cherry picked from commit 43f65a6ef08a502485c6107b255a9b22c890acd5)
2023-04-24 12:00:16 -07:00
Ozkan Sezer
0f2322acfc hidapi/mac: replace sprintf uses with snprintf.
Reference issues:
-  https://github.com/libusb/hidapi/pull/509
-  https://github.com/libusb/hidapi/pull/511

(cherry picked from commit ae9119c36bdcf2214d83c6d35c436d22b5fd03cb)
2023-04-24 10:46:49 -07:00
Ozkan Sezer
5f344c17c2 hidapi/mac: import mainstream commit c1b9d2ad
c1b9d2ad98
Properly handle the close of run loop on macOS
(https://github.com/libusb/hidapi/pull/522)
- as per documentation `kCFRunLoopRunStopped` should be handled once the runloop is closed via `CFRunLoopStop`;
- if it is not handled - a race condition/crash may happen on the latest macOS when a device gets disconnected while being open;

(cherry picked from commit 62d1a2c836c6176a6c76d54229eafa7d011bb9fb)
2023-04-24 10:46:49 -07:00
Mingjie Shen
a688ecd6fa
Check return value of SDL_malloc()
(cherry picked from commit a4604cb0d616db97921a2674a63b45f3fdfb81bc)
2023-04-23 12:28:54 -04:00
Sam Lantinga
120bc77e91 Report PS3 accelerometer values in m/s2 instead of Gs
(cherry picked from commit 0467301baf57389d96fafbe169fb07f4c10169bc)
2023-04-19 13:12:38 -07:00
Anonymous Maarten
535ec1a921 cmake: allow users of sdl2-config.cmake to not add -mwindows to the link options 2023-04-18 14:10:12 -04:00
Sam Lantinga
7ec9a4385a More defensive coding against dangling device pointers
(cherry picked from commit acadb6f873acaa0de094ad10a88f877d540ce0ec)
2023-04-06 13:21:44 -07:00
Sam Lantinga
6d7269815b Clarified the expected sensor value when a game controller is at rest
(cherry picked from commit 1a20ccb2897fc9b12ad5242f9128cb6bb60368b1)
2023-04-06 09:55:43 -07:00
Sam Lantinga
cb0cf14155 The latest Armor-X Pro firmware update fixes the sign on the Z axis of the sensors
(cherry picked from commit 558bbbb07ae0afa0108c1560915351cfa13442b7)
2023-04-06 09:55:39 -07:00
Cyril Dubet
7914234b26 Fix key code names for ISO keyboard layouts
(cherry picked from commit 60dcaff7eb25a01c9c87a5fed335b29a5625b95b)
2023-04-05 17:03:42 -07:00
Sam Lantinga
51dcc3bb0b The macOS minimum deployment target is now 10.11
Xcode 14.3 does not allow targeting 10.9, the minimum recommended version is 10.13 and the minimum possible version is 10.11.

(cherry picked from commit 73b2faea4e39aa27b4142f9d4d39f5807a3b3688)
2023-04-05 11:40:50 -07:00
Sam Lantinga
f6363fde9a Fixed crash if joystick->hwdata != NULL && device->driver == NULL
This should never happen, but we're seeing it in the wild, so make sure that we can never call into a NULL device driver.

(cherry picked from commit e13b74ccf0b20a20bd4baf1617bdc4f84c13feb7)
2023-04-05 11:24:55 -07:00
Ozkan Sezer
f633915443 fix build after commit 22685556e5. 2023-04-05 02:10:56 +03:00
Sam Lantinga
57043825ba Fixed crash if dbus can't be initialized
(cherry picked from commit cf2c6fa58dea02edb870cff7090fd69f3dfbd081)
2023-04-04 12:35:30 -07:00
Sam Lantinga
22685556e5 Don't probe for PlayStation controllers when we already know the controller type
Fixes https://github.com/libsdl-org/SDL/issues/7556

(cherry picked from commit 655a07bdd88d6bd19fe97c3abd39a2e2eef252ec)
2023-04-04 12:35:20 -07:00
Sam Lantinga
f444eac557 Fixed analog triggers on the DualSense controller
(cherry picked from commit a67d41050164e447048fa55179cc31b23be9d9b7)
2023-04-04 12:35:20 -07:00