Commit Graph

4225 Commits

Author SHA1 Message Date
vanfanel
5ac6bd5483 [KMSDRM] Ask for videomode on the correct display when creating a window. 2021-03-23 21:51:36 -07:00
Fabrice Fontaine
b55b11af88 src/thread/pthread/SDL_systhread.c: drop include of SDL_platform.h
Drop include of SDL_platform.h as SDL_plaform.h is already included by
SDL_internal.h -> SDL_config.h -> SDL_platform.h

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2021-03-23 11:33:00 +03:00
Sam Lantinga
0bdf4f95bf Disable system gestures on MFi controllers while they're open, so we get access to the back button, etc. 2021-03-22 19:19:01 -07:00
Sam Lantinga
1133ea0349 Fixed crash on macOS when AirPods are connected 2021-03-22 19:18:57 -07:00
Paul Cercueil
c12f46b100 [KMSDRM] Fix segmentation fault
Deference the windata pointer *after* checking that it's non-NULL.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-03-22 22:20:01 +03:00
vanfanel
100166d7d7 [KMSDRM] Improve cursor management. 2021-03-22 10:48:02 -07:00
vanfanel
cf7eef37b0 [KMSDRM] Better error handling: no more segfaults on window creation failure. 2021-03-20 11:03:52 -07:00
Vanfanel
4acd1dcad4 [KMSDRM] Improve the way to test if last window is being destroyed. 2021-03-18 11:04:28 -07:00
Vanfanel
8638674a87 [KMSDRM] Correct comment typo. 2021-03-18 11:04:28 -07:00
vanfanel
82ff6045fa [KMSDRM] Unload GL/EGL libs and destroy GBM only when we are destroying the last window. 2021-03-18 11:04:28 -07:00
vanfanel
c35e71892e [KMSDRM] All non-vulkan windows have to be marked as OPENGL, not only the first created one. 2021-03-18 11:04:28 -07:00
vanfanel
281a7bdbb3 [KMSDRM] Make the gbm_init flag a viddata member to avoid GBM re-init when several displays are connected. 2021-03-18 11:04:28 -07:00
Vanfanel
7d1b9c9f15 [KMSDRM] Remove unneeded function calls and improve comments for future reference. 2021-03-17 11:29:13 -07:00
Ryan C. Gordon
e7e519a466
dsp: Refuse to initialize if there aren't any Open Sound System devices.
This prevents the dsp target from stealing the audio subsystem but not
being able to produce sound, so other audio targets further down the list
can make an attempt instead.

Thanks to Frank Praznik who did a lot of the research on this problem!
2021-03-17 13:04:05 -04:00
Ankith
559be8aab4 fix invalid out of bounds UTF8 handling 2021-03-16 18:51:28 -07:00
Ankith
07fc1bb883 Fix invalid UTF-8 handling of extra bytes 2021-03-16 18:51:28 -07:00
Vanfanel
e14fb54e3f [KMSDRM] Undo SDL_CreateRenderer() modifications aimed at create opengles2 when KMSDRM is in use because it's a harmful solution. 2021-03-16 11:07:54 -07:00
Vanfanel
108bb5aabe [KMSDRM] Modify SDL_CreateRenderer() to create an opengles2 renderer when the KMSDRM backend is being used and no renderer name has been specified. 2021-03-15 18:47:22 -07:00
Ryan C. Gordon
b98b5adcae
wasapi: Don't use the system's resampler. 2021-03-15 10:21:36 -04:00
Haelwenn (lanodan) Monnier
9996cecc72 Set ALT_OGL to libOpenGL.so.0 instead of libOpenGL.so.1 2021-03-15 10:10:38 +03:00
Cacodemon345
5f7eb88ae0 Load libOpenGL.so.1 if libGL.so.1 is not found 2021-03-14 17:37:55 -07:00
Ozkan Sezer
1957ffd21a fixed a typo in SDL_ceilf() 2021-03-14 11:04:28 +03:00
Cacodemon345
dacf6cfbaa Fix compilation with iconv on FreeBSD 2021-03-13 18:39:42 -08:00
nia
a5f3ea1448 netbsdaudio: Handle ioctls failing
A user reported that the mpv video player hangs after attempting to
set an unsupported number of channels with the SDL audio output,
because it thinks it's successfully opened the device. This makes
the failure graceful.
2021-03-13 18:37:21 -08:00
Frank Praznik
4fbd60b817 audio: pipewire: Remove the nickname portion of sink/source names
Removes the node nickname from sink/source nodes as it doesn't provide any useful information and names now match those used in Pulseaudio, so any stored configuration data will be compatible between the two audio backends.
2021-03-13 18:36:47 -08:00
kenmays
72bcf546f9 SDL: Updated patches for HAIKU 2021-03-13 18:36:01 -08:00
Sylvain Becker
3d22731d94
Merge pull request #4175 from 1bsyl/br_blit_rgb555_to_rb1555
Fixed bug 3727 - Blit from RGB555 to ARGB1555
2021-03-11 20:10:07 +01:00
Sylvain
51345623e8
Fixed bug 3727 - Blit from RGB555 to ARGB1555 2021-03-11 20:06:09 +01:00
Ivan Epifanov
33127271e5 Fix typecasting 2021-03-09 12:10:40 +03:00
Ivan Epifanov
a4ddb175f1 Formatting 2021-03-08 09:07:12 -08:00
Ivan Epifanov
4f9fde8766 Fix types 2021-03-08 09:07:12 -08:00
Ivan Epifanov
e58a955e68 Deprecate dolcesdk 2021-03-08 09:07:12 -08:00
Ivan Epifanov
e1d9cbf65c Split mouse/kb grab 2021-03-08 09:07:12 -08:00
uyjulian
29153a1c63 SDL_vitamessagebox: rearrange if/else
Set messageboxdata and buttonid as unused variables
2021-03-08 09:07:12 -08:00
uyjulian
70a19fd5ab SDL_vitamessagebox: if/else wrap preprocessor condition instead of two if conditions 2021-03-08 09:07:12 -08:00
uyjulian
abcfb22b7d Add support for Vita file API in SDL_rwops 2021-03-08 09:07:12 -08:00
uyjulian
c8abc88cd0 Add support for message box 2021-03-08 09:07:12 -08:00
José Cadete
91fe2b67f5 Allow larger texture sizes 2021-03-08 09:07:12 -08:00
Ivan Epifanov
e5cbe7cf7a Add l2/r2 axes, l3/r3 buttons. rumble and ledbar support for ds4 2021-03-08 09:07:12 -08:00
Ivan Epifanov
7c4d20cf04 Fix for dolcesdk 2021-03-08 09:07:12 -08:00
Ivan Epifanov
3c1fe9cea6 WTF 2021-03-08 09:07:12 -08:00
Ivan Epifanov
6fab3323c3 Typo 2021-03-08 09:07:12 -08:00
José Cadete
739f4e1eb2 Only call sceGxmFinish when vsync is on
Also fix oversight with supported textures
2021-03-08 09:07:12 -08:00
uyjulian
b52e9459ba Add support for open URL 2021-03-08 09:07:12 -08:00
Ivan Epifanov
189d3c16f5 FIFO is default (and not defined in vitasdk, ugh) 2021-03-08 09:07:12 -08:00
Ivan Epifanov
87a118b6b6 Use native mutexes 2021-03-08 09:07:12 -08:00
Ivan Epifanov
7423ae1ac7 Formatting 2021-03-08 09:07:12 -08:00
José Cadete
ddfe7200e2 Rendering improvements
- Improve performance for unbatched rendering
- Support direct texture access
2021-03-08 09:07:12 -08:00
Ivan Epifanov
23db5381a3 Fix defines 2021-03-08 09:07:12 -08:00
Ivan Epifanov
c7cec2c792 Add more texture formats 2021-03-08 09:07:12 -08:00
Ivan Epifanov
e56c44512a Disable native framebuffer support 2021-03-08 09:07:12 -08:00
Ivan Epifanov
5e30d84b69 Fix display mode 2021-03-08 09:07:12 -08:00
Ivan Epifanov
10038228f9 Properly cleanup framebuffer 2021-03-08 09:07:12 -08:00
Ivan Epifanov
953101defd Oops. Fix default framebuffer color 2021-03-08 09:07:12 -08:00
Ivan Epifanov
1e2eed1a01 Native framebuffer for software renderer 2021-03-08 09:07:12 -08:00
Ivan Epifanov
a7269a9ad3 Update video api to 2.0.14 2021-03-08 09:07:12 -08:00
Ivan Epifanov
7b0b1a12fa Update thread api to 2.0.14 2021-03-08 09:07:12 -08:00
Ivan Epifanov
a05f92da1c Update joystick api to 2.0.14 2021-03-08 09:07:12 -08:00
Ivan Epifanov
ca5e5d6154 VITASDK compatibility 2021-03-08 09:07:12 -08:00
Ivan Epifanov
7d89f09f74 ISO C90 fixes 2021-03-08 09:07:12 -08:00
Ivan Epifanov
0da35d3daf IME support with gxm backend 2021-03-08 09:07:12 -08:00
Ivan Epifanov
47c6270ece Fix a bug in vitagles2 renderer 2021-03-08 09:07:12 -08:00
Ivan Epifanov
639323ea0d Fixed gxm render flags 2021-03-08 09:07:12 -08:00
Ivan Epifanov
3ac2242e65 Fix PerformanceCounter 2021-03-08 09:07:12 -08:00
Ivan Epifanov
943053a922 Clean up touch a little more 2021-03-08 09:07:12 -08:00
Ivan Epifanov
f61b9e7653 Cleanup touch. Fix back touchscreen 2021-03-08 09:07:12 -08:00
Ivan Epifanov
d9b2bde2f6 Fallback to app0: 2021-03-08 09:07:12 -08:00
Ivan Epifanov
6f7c7c557a sensors corrections 2021-03-08 09:07:12 -08:00
Ivan Epifanov
6d85637786 Fix sensors 2021-03-08 09:07:12 -08:00
Ivan Epifanov
e7edb06e7a Audio fix 2021-03-08 09:07:12 -08:00
Ivan Epifanov
05e5a7cb05 Oops 2021-03-08 09:07:12 -08:00
Ivan Epifanov
a86ba3916e Add SDL_RenderReadPixels 2021-03-08 09:07:12 -08:00
Ivan Epifanov
f623211eea remove sceGxmFinish on render swap 2021-03-08 09:07:12 -08:00
Ivan Epifanov
0b45529e24 Add viewport support 2021-03-08 09:07:12 -08:00
Ivan Epifanov
2209b71789 Refactor render state 2021-03-08 09:07:12 -08:00
Ivan Epifanov
333d5e11e1 Add drawstate cache 2021-03-08 09:07:12 -08:00
Ivan Epifanov
56bde0f633 Rename memory functions to avoid clash with vita2d 2021-03-08 09:07:12 -08:00
Ivan Epifanov
94d7737bef Texture render target 2021-03-08 09:07:12 -08:00
Ivan Epifanov
63e223fa50 Set initial blend mode 2021-03-08 09:07:12 -08:00
Ivan Epifanov
6c3bf56503 Unified build with both renderers 2021-03-08 09:07:12 -08:00
Ivan Epifanov
a1adc8a9d6 Add sensor support 2021-03-08 09:07:12 -08:00
Ivan Epifanov
bd14aa633f Autobuild 2021-03-08 09:07:12 -08:00
Ivan Epifanov
0131105408 Fix render name 2021-03-08 09:07:12 -08:00
Ivan Epifanov
6ba8497518 Remove vita2d render, add raw gxm render 2021-03-08 09:07:12 -08:00
Ivan Epifanov
ef0bbfd6c6 Include anf fix vita2d renderer 2021-03-08 09:07:12 -08:00
Ivan Epifanov
dbb730d395 Separate vita piglet renderer. Add proper render initialization and window re-creation. 2021-03-08 09:07:12 -08:00
Ivan Epifanov
d75ea51ac0 Fix texture shaders 2021-03-08 09:07:12 -08:00
Ivan Epifanov
194c813893 Fix filesystem 2021-03-08 09:07:12 -08:00
Ivan Epifanov
73b545ed28 Fix joystick support 2021-03-08 09:07:12 -08:00
Ivan Epifanov
41d6c80b07 Filesystem module 2021-03-08 09:07:12 -08:00
Ivan Epifanov
2e3dd0a668 Remove debug log 2021-03-08 09:07:12 -08:00
Ivan Epifanov
8003623061 Cg shaders for vita gles2 2021-03-08 09:07:12 -08:00
Ivan Epifanov
2d64e37e41 Initial rebase of xerpi's port 2021-03-08 09:07:12 -08:00
Sylvain
b6b0c908bd
Dynapi: fix 'gendynapi.pl' script for array parameters 2021-03-08 13:56:26 +01:00
Cameron Cawley
391bb80bb9 Replace duplicate functions and lstrlen/lstrcat with SDL string functions 2021-03-05 12:03:58 -08:00
Ethan Lee
67e8522d31 Add SDL_GetAudioDeviceSpec.
This API is supported by pipewire, pulseaudio, coreaudio, wasapi, and disk.
2021-03-05 12:03:07 -08:00
Ozkan Sezer
686935542e dos2unix SDL_dynapi_*.h 2021-03-04 23:50:40 +03:00
Ozkan Sezer
dd5aff308a SDL_fillrect.c: updated SSE_BEGIN macro for windows clang-cl
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:27:56 +03:00
Ozkan Sezer
0ed1713128 update SDL_COMPOSE_ERROR macro for windows clang-cl
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:27:47 +03:00
Ozkan Sezer
c1c4f274c3 cpuinfo: updated xgetbv call for windows clang-cl.
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
2021-03-04 18:27:32 +03:00
Sylvain
e88d78462e Update SDL_blit_auto.c 2021-03-04 14:36:33 +01:00
Sylvain
ab0cf42a4b
Software nearest scaling: start at the middle of pixel
so that it matches opengl GL_NEAREST mode most of the time
2021-03-04 14:33:56 +01:00
Ozkan Sezer
ac8a3fda8f fix prepare_audiospec() possibly missing a bad SDL_AUDIO_CHANNELS env. 2021-03-03 20:33:20 +03:00
Nicolas Noble
6158621610 Update cpuid code for clang-cl
The clang-cl compiler defines `__llvm__` but not `__GNUC__`. The `__cpuid` intrinsic doesn't seem to exist with clang-cl, so the code won't link properly. The `__GNUC__` versions of these functions will work properly on Windows with clang-cl.
2021-03-03 15:37:21 +03:00
Frank Praznik
4de0c74aa7 audio: pipewire: Add the application name to the stream properties 2021-03-02 12:59:04 -08:00
Frank Praznik
9ed01da701 audio: pipewire: Constify and clarify period size calculations
Constify the min/max period variables, use a #define for the base clock rate used in the calculations and note that changing the upper limit can have dire side effects as it's a hard limit in Pipewire.
2021-03-02 12:59:04 -08:00
Frank Praznik
d7ca855c2b audio: pipewire: Add missing static qualifiers to globals 2021-03-02 12:59:04 -08:00
Oschowa
84c44e01d3 audio: pipewire: fix uninitialized variable warnings 2021-03-01 09:34:04 -08:00
Frank Praznik
7001b531c6 audio: pipewire: Add vim format lines to files and fix indentation
Increase indentation spacing from 2 to 4 to comply with style standards.
2021-02-28 19:40:09 -08:00
Frank Praznik
2fcba50ec9 audio: pipewire: Code and comment cleanups
Replace "magic numbers" with #defines, explain the requirements when using the userdata pointer in the node_object struct and a few other minor code and comment cleanups.
2021-02-28 19:40:09 -08:00
Frank Praznik
4eadd147cd audio: pipewire: Fix outdated comment 2021-02-28 19:40:09 -08:00
Frank Praznik
cd56f1b346 audio: pipewire: Use "rear" designation for rear channels
Use the 'R' (rear) prefixed designations for the rear audio channels instead of 'S' (surround).  Surround designated channels are only used in the 8 channel configuration.
2021-02-28 19:40:09 -08:00
Frank Praznik
adc0a931dd audio: Move Pipewire bootstrap after Jack
Move the Pipewire audio driver below others in the list so it won't be mistakenly initialized when it's not the system mixer.
2021-02-28 19:40:09 -08:00
Frank Praznik
21adec93b9 audio: pipewire: Make enumeration structure and function names more descriptive
Rename the add/remove/clear list functions and rename connected_device to io_node, as a sink/source node isn't necessarily a device.
2021-02-28 19:40:09 -08:00
Frank Praznik
a07f543436 audio: pipewire: Report default devices first
Further refactor the device enumeration code to retrieve the default sink/source node IDs from the metadata node.  Use the retrieved IDs to sort the device list so that the default devices are at the beginning and thus are the first reported to SDL.
2021-02-28 19:40:09 -08:00
Frank Praznik
9afd7570d6 audio: pipewire: Always buffer source audio
The latency of source nodes can change depending on the overall latency of the processing graph. Incoming audio must therefore always be buffered to ensure uninterrupted delivery.

The SDL_AudioStream path was removed in the input callback as the only thing it was used for was buffering audio outside of Pipewire's min/max period sizes, and that case is now handled by the omnipresent buffer.
2021-02-28 19:40:09 -08:00
Frank Praznik
106dc009ac audio: pipewire: Pass proper parameter to user audio callback
The audio callbacks should pass the callbackspec.userdata parameter to the callback, not spec.userdata

Co-authored-by: Oschowa <Oschowa@web.de>
2021-02-28 19:40:09 -08:00
Frank Praznik
f3ebbc06d3 audio: pipewire: Retrieve the channel count and default sample rate for sinks/sources
Extend device enumeration to retrieve the channel count and default sample rate for sink and source nodes.  This required a fairly significant rework of the enumeration procedure as multiple callbacks are involved now.  Sink/source nodes are tracked in a separate list during the enumeration process so they can be cleaned up if a device is removed before completion.  These changes also simplify any future efforts that may be needed to retrieve additional configuration information from the nodes.
2021-02-28 19:40:09 -08:00
Frank Praznik
2f0b99a774 audio: Add Pipewire playback/capture sink 2021-02-28 19:40:09 -08:00
Ethan Lee
57a927e8d7 wayland: Explicitly set min/max size for xdg-shell 2021-02-28 19:37:31 -08:00
Cacodemon345
33598563b3 Fix coding style 2021-02-26 09:32:04 -08:00
Cacodemon345
69a600b00e Implement requested changes 2021-02-26 09:32:04 -08:00
Cacodemon345
0e35f0be1f Fix KMSDRM-related warnings 2021-02-26 09:32:04 -08:00
Cameron Gutman
dfa64eadd3 KMSDRM: Add hint to enable the backend without DRM master
In some cases, it can be useful to have the KMSDRM backend even if it cannot
be used for rendering. An app may want to use SDL for input processing while
using another rendering API (such as an MMAL overlay on Raspberry Pi) or
using its own code to render to DRM overlays that SDL doesn't support.

This also moves the check for DRM master to an earlier point where we can fail
initialization of the backend, rather than allowing the backend to initialize
then failing the creation of a window later.
2021-02-25 18:48:36 -08:00
Cameron Gutman
8c5b7af2d2 Wayland: Fix mouse pointer hiding on Plasma Wayland
Unlike Mutter and Sway, KWin actually checks the serial passed in
wl_pointer_set_cursor(). The serial provided is supposed to be the
serial of the pointer enter event, but We were always passing 0.
This caused KWin to drop our requests to hide the cursor.

Thanks to the KDE folks for spotting this in my debug logs.

Fixes #3576
2021-02-25 18:47:12 -08:00
Cacodemon345
d2d834b990 KMSDRM: Add gamma support 2021-02-25 11:39:10 -08:00
Ozkan Sezer
72f7a10cef disable pixman ARM blitters for __aarch64__ | _M_ARM64
Closes:  https://github.com/libsdl-org/SDL/issues/4095
2021-02-25 11:38:14 -08:00
Ozkan Sezer
e561ce3a75 SDL_cpuinfo.c: replaced gcc i386 checks with __i386__ . 2021-02-25 01:40:02 +03:00
JibbSmart
c287087fcc Only change joystick->nbuttons for Joy-Cons, since they're the only ones that have these "paddles" 2021-02-22 17:54:32 -08:00
JibbSmart
ee52624f95 Switch Joy-Con SL and SR buttons are now mapped to matching paddle positions so that all buttons can be accessed when using SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS 2021-02-22 17:54:32 -08:00
Mathieu Eyraud
7a2b6f331b Guard Inotify stuff with macro
This fix implicit declaration of close and unused variable warning.
2021-02-22 09:07:07 -08:00
Mathieu Eyraud
8481229ff7 Fix error handling in KMSDRM_AddDisplay
Add missing `goto cleanup` and check that `dispdata` is not NULL before dereferencing it.
2021-02-22 09:01:36 -08:00
Mathieu Eyraud
2df9c15e96 Fix memory leak in KMSDRM_Vulkan_CreateSurface
Variable `device_props` is never freed.
2021-02-22 09:00:45 -08:00
Mathieu Eyraud
844d5e3ed3 Fix memory leak in ConnectSensor
'name' is leaked in case of error.
2021-02-21 16:46:20 -08:00
Vanfanel
11cb53d2a5 [KMSDRM] Add missing break and modify comments. 2021-02-21 15:27:12 -08:00
Vanfanel
9172e413ad [KMSDRM] Fix intermitent bug in Vulkan initialization on Raspberry Pi 4. 2021-02-21 15:27:12 -08:00
Sam Lantinga
1a17ab30e1 Added mappings for popular controllers on Chromebooks 2021-02-21 11:03:26 -08:00
David Gow
db58166e9b joystick: hidapi: Properly include <unistd.h> when inotify not available
In the extremely unlikely event that inotify is not available (and,
therefore, HAVE_INOTIFY is not #defined), SDL will no-longer build.

This is because <unistd.h> is only included when HAVE_INOTIFY is
defined, and PR #4098 adds a call to access(…, F_OK), which requires
<unistd.h>.

(Note that the F_OK symbol is the only one which actually prevented
SDL from compiling, but both access() and close() fell back to implicit
definitions, which is a bit concerning.)

Fixes: 8d43f45a7b ("Don't use udev for joystick enumeration if running in a container")
2021-02-21 12:55:01 +03:00
Amir
360740ac76 correct dynapi 2021-02-20 23:05:09 -08:00
Amir
1a924bc0bb add SDL_AndroidShowToast for https://developer.android.com/reference/android/widget/Toast 2021-02-20 23:05:09 -08:00
Ludovico de Nittis
8d43f45a7b Don't use udev for joystick enumeration if running in a container
If we are running in a container, like Flatpak[1] or pressure-vessel[2],
it's likely that we are using user namespaces,
therefore udev event notification via netlink won't work reliably.
Use their filesystem API to detect them and automatically fallback to
the inotify-based enumeration.

[1] <https://flatpak.org/>
[2]
<https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/tree/master/pressure-vessel>

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2021-02-20 23:01:38 -08:00
Ludovico de Nittis
2c3269152a Use inotify for HIDAPI joystick enumeration if not using udev
This improves SDL's ability to detect HIDAPI joystick hotplug in a
container environment because we cannot reliably receive events from
udev in a container.

For a more detailed explanation of why this issue happens with
containers, please check the previous commit
"joystick: Use inotify to detect joystick unplug if not using udev"
(b0eba1c5).

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2021-02-20 23:01:38 -08:00
Ludovico de Nittis
b17242bf98 Allow libudev for HIDAPI joystick to be disabled at runtime
As already explained in the previous commit "joystick: Allow libudev to
be disabled at runtime" (13e7d1a9), libudev can fail in a container.

To make it easier to experiment with, we add a new environment variable
"SDL_HIDAPI_JOYSTICK_DISABLE_UDEV" that disables udev and let it
fallback to the device enumeration using polling.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2021-02-20 23:01:38 -08:00
Jay
0052339b66 Move handleURLEvent setEventHandler to init 2021-02-20 22:59:11 -08:00
Sam Lantinga
42607909a0 Remove devices from the list after they've been disconnected due to read errors.
This fixes problems with controllers not being re-detected when a computer goes to sleep and a controller is removed and plugged back in while it's asleep.
2021-02-20 22:51:57 -08:00
Oschowa
08547adb52 pulseaudio: Add "zerocopy" playback path 2021-02-20 12:50:36 -05:00
Romain Roffé
ef85ed9352 pulseaudio: Initialize fragsize to fix mic recording
fragsize wasn't initialized, and it is used for recording.
If the value was 0 or -1, pulseaudio configures it itself. But sometimes
we can get a random (and large) value that makes pulseaudio give us
large sample at a very low frequency.

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/pulse/def.h#L453
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/v13.0/src/pulsecore/protocol-native.c#L409
2021-02-18 09:51:35 -05:00
Vanfanel
e4a81a98a0 [KMSDRM] Correct indentation. 2021-02-17 17:03:42 +03:00
Cameron Cawley
98bf79cff1 Minor improvements for CPU detection on ARM 2021-02-17 11:10:02 +03:00
Matt Borgerson
4aa2e74844 Add Xbox Controller S entry to gamecontrollerdb 2021-02-16 10:15:44 -08:00
Ozkan Sezer
f2a2d0c696 SDL_render_d3d.c: fix build with SDL_LEAN_AND_MEAN 2021-02-15 22:56:20 +03:00
Alex Szpakowski
09231c42ea Fix flags check in test code 2021-02-15 08:43:53 -08:00
Alex Szpakowski
9b9d0d484d mac/iOS: allow Metal in windows created without an explicit backend
Fixes SDL_CreateWindowAndRenderer (and similar situations) not choosing a Metal backend. See #3991.

Passing an explicit backend into CreateWindow, eg SDL_WINDOW_OPENGL or SDL_WINDOW_METAL, will still prevent the window from being used with other backend types.
2021-02-15 08:43:53 -08:00
Ozkan Sezer
a2fbc452ca replace i386 checks with __i386__ 2021-02-15 03:02:32 +03:00
Cacodemon345
cf15faae68 Change "memset" to "SDL_zero" 2021-02-14 13:54:08 -05:00
Cacodemon345
c5f9e061b5 Disable FreeBSD console mouse when initializing evdev input
Enable it again after quitting evdev input.
2021-02-14 13:54:08 -05:00
Misa
3da58b47f6 Fix errors with fallback impls of SDL_isxdigit() and SDL_ispunct()
SDL_isxdigit() should only accept A-Fa-f, not A-Za-z (it shouldn't use
SDL_isalpha()).

SDL_ispunct() shouldn't accept spaces (it should use SDL_isgraph()
instead).
2021-02-13 19:30:24 -05:00
Misa
dfe219ec71 Add all missing "is characteristic" stdlib functions
SDL has been missing a bunch of these 'isX' functions for some time,
where X is some characteristic of a given character.

This commit adds the rest of them to the SDL stdlib, so now we have:
- SDL_isalpha()
- SDL_isalnum()
- SDL_isblank()
- SDL_iscntrl()
- SDL_isxdigit()
- SDL_ispunct()
- SDL_isprint()
- SDL_isgraph()
2021-02-13 11:42:13 -08:00
Charlie Birks
1a48ca666f emscripten: Create directory recursively in GetPrefPath 2021-02-13 11:56:01 -05:00
Stephan Vedder
fa367cdd5c emscripten: Fix alt key being a nav key 2021-02-13 11:56:01 -05:00
Alon Zakai
20be1d634b emscripten: Automatically resume audio contexts
This uses the mechanism added in emscripten-core/emscripten#10843
which was applied to SDL1 and OpenAL. This adds the same for SDL2.

This also reverts commit 865eaddffed50dbd13e6564c3f73902472cf74e8
which did something similar, but the new mechanism is more effective.
2021-02-13 11:56:01 -05:00
Charlie Birks
edaf3f9c9c emscripten: Extend the "nav key" blacklist
Add the F keys and Ctrl/Alt+*. Consistent with other naviagtion
disabling. Also, none of these generate keypress events anyway.
2021-02-13 11:56:01 -05:00
Ethan Lee
a99eec7751 wayland: Minor whitespace fix 2021-02-13 02:41:29 +03:00
Ryan C. Gordon
65fbf36c9e Cleaned up a few more Bugzilla mentions. 2021-02-12 14:46:49 -05:00
Ryan C. Gordon
4ff51d29c3 Deprecate SDL_GetRevisionNumber and update things for git instead of hg.
Fixes #4063
2021-02-12 14:31:38 -05:00
soredake
39153f81b9 add Linux mapping for Ipega PG-9087S, closes #3783 2021-02-12 08:00:41 -08:00
Jay Petacat
f443a6fc7a Fix format string warnings for width-based integers
The DJGPP compiler emits many warnings for conflicts between print
format specifiers and argument types. To fix the warnings, I added
`SDL_PRIx32` macros for use with `Sint32` and `Uint32` types. The macros
alias those found in <inttypes.h> or fallback to a reasonable default.

As an alternative, print arguments could be cast to plain old integers.
I opted slightly for the current solution as it felt more technically correct,
despite making the format strings more verbose.
2021-02-11 19:41:41 -08:00
Sam Lantinga
5427f4861b Added support for trigger rumble for all Microsoft Xbox One controllers 2021-02-11 17:28:07 -08:00
Sam Lantinga
1f7ec3fa4e Added support for the PowerA Xbox One Series X Wired Controller 2021-02-11 17:27:22 -08:00
Ethan Lee
cad67082f3 wayland: Check for both _WAYLAND_CLIENT_H and WAYLAND_CLIENT_H 2021-02-11 14:27:08 -08:00
Sam Lantinga
629334f283 Fixed bug 5543 - Wayland: Fix waylandvideo.h warnings
wahil1976

This patch fixes the warnings seen when compiling the Wayland backend. This will also be required in the future to avoid issues with compilation.
2021-02-10 10:22:20 -05:00
Cameron Gutman
f70e197363 Fix waiting on condition variables with the SRW lock implmentation
When SleepConditionVariableSRW() releases the SRW lock internally, it causes
our SDL_mutex_srw state to become inconsistent. The lock is unowned yet inside,
the owner is still the sleeping thread and more importantly the owner count is
still 1.

The next time someone acquires the lock, they will bump the owner count from 1
to 2. At that point, the lock is hosed. From the internal lock state, it looks
to us like that owner has acquired the lock recursively, even though they have
not. When they call SDL_UnlockMutex(), it will see the owner count > 0 and not
call ReleaseSRWLockExclusive().

Now when someone calls SDL_CondSignal(), SleepConditionVariableSRW() will start
the wakeup process by attempting to re-acquire the SRW lock. This will deadlock
because the lock was never released after the other thread had used it. The
thread waiting on the condition variable will never be able to wake up, even if
the SDL_CondWaitTimeout() function is used and the timeout expires.
2021-02-10 10:22:20 -05:00
Sam Lantinga
d9ba20442e Backed out changeset 852a7bdbdf4b
This causes a use-after-free memory error
2021-02-10 10:22:20 -05:00
Christian Rauch
4183211a54 free the 'display' after it was added to global list 2021-02-10 10:22:20 -05:00
Manuel Alfayate Corchete
005e2c59a7 [KMS/DRM] Bugfix number #5535: Improve reliability, by wahil1976. 2021-02-10 10:22:20 -05:00
Ozkan Sezer
dc45a228b9 avoid some pedantic warnings in array initializers 2021-02-10 10:22:20 -05:00
Sam Lantinga
9c3aa7f055 SDL: fix packet handling for original version of Stadia FW 2021-02-10 10:22:20 -05:00
Ozkan Sezer
bb9e049d1d minor updates to libc function checks 2021-02-10 10:22:19 -05:00
Manuel Alfayate Corchete
19fa85d8af [KMS/DRM] Fix build warning. 2021-02-10 10:22:19 -05:00
Manuel Alfayate Corchete
6ee53258cd [KMS/DRM] Replace indent tabs with spaces, as intended. 2021-02-10 10:22:19 -05:00
Manuel Alfayate Corchete
59cd46c24a [KMS/DRM] Merge patch for bug #5532: No need to correct cursor position now that all windows are fullscreen. Link: https://bugzilla.libsdl.org/show_bug.cgi?id=5519. 2021-02-10 10:22:19 -05:00
Manuel Alfayate Corchete
538f7ad6b7 [KMS/DRM] Remove redundant SDL_SendWindowEvent() call. 2021-02-10 10:22:19 -05:00
Manuel Alfayate Corchete
7beba05013 [KMS/DRM] Restore all-windows-are-fullscreen functionality, since there is no window manager in KMSDRM. 2021-02-10 10:22:19 -05:00
Cameron Gutman
f4d58689e0 Fix Xbox Series X controller on macOS
There were two different implementations of IsBluetoothXboxOneController(), one
in SDL_hidapi_xbox360.c and one in SDL_hidapi_xboxone.c. The latter had been
updated to include USB_PRODUCT_XBOX_ONE_SERIES_X_BLUETOOTH while the former had
not.

This mismatch led to the Xbox Series X failing on macOS only. We have special
code for handling the 360Controller driver for macOS which requires us to use
the Xbox 360 driver for wired Xbox One controllers, and the SDL_hidapi_xbox360
version of IsBluetoothXboxOneController() was used to determine which devices
were wired.

In addition to adding the missing USB_PRODUCT_XBOX_ONE_SERIES_X_BLUETOOTH, this
change moves IsBluetoothXboxOneController() into a single shared function which
will ensure this bug won't happen again.
2021-02-10 10:22:19 -05:00
Sam Lantinga
ff297753db Fixed compiler warning 2021-02-10 10:22:19 -05:00
Sam Lantinga
a60af1e4d0 Backed out changeset 1cde3dd0f44d - this breaks windows which are created and then set to FULLSCREEN_DESKTOP 2021-02-10 10:22:19 -05:00
Sam Lantinga
e404b525f1 KMSDRM doesn't have a window manager, so all windows are fullscreen 2021-02-10 10:22:19 -05:00
Sylvain Becker
549bc13362 SDL_vulkan_utils: minor code clean-up 2021-02-10 10:22:19 -05:00
Sylvain Becker
c0166a29b7 SDL_ConvertColorkeyToAlpha: remove and clarify a FIXME
This function doesn't handle bpp 1 or 3 case, because those formats never have an alpha channel
2021-02-10 10:22:19 -05:00
Sam Lantinga
85235985fb Fixed detecting the paddles on the Xbox Elite Series 1 controller 2021-02-10 10:22:19 -05:00
Sam Lantinga
69e9b2acee Fixed bug 5471 - Creating a fullscreen desktop window goes windowed temporarily
This is caused by the Metal renderer recreating the window because by default we create an OpenGL window on macOS.

It turns out that at least on macOS 10.15, a window that has been initialized for OpenGL can also be used with Metal. So we'll skip recreating the window in that case.
2021-02-10 10:22:19 -05:00
Sam Lantinga
ef2f13e125 Added test command line options to force different window types 2021-02-10 10:22:19 -05:00
Sam Lantinga
2426949a18 Removed support for clock_gettime_nsec_np()
SDL_GetTicks() was broken and it's not adding any real value here.
2021-02-10 10:22:19 -05:00
Sam Lantinga
fadfa51022 Don't uncorrelate while rumble is active and stay correlated longer in case raw input messages are lagging a bit. 2021-02-10 10:22:19 -05:00
Sebastian Krzyszkowiak
e862856e6f wayland: Don't crash when the properties of already existing wl_output change 2021-02-10 10:22:18 -05:00
Sam Lantinga
cef198c9cb Fixed bug 5524 - Pass NSString to NSLog()
Hiroyuki Iwatsuki

If you pass the C string directly to NSLog(), it will be garbled with Japanese and probably other language strings, or no log will be output at all.

NSLog("Hello, World!"); // => "Hello, World!"
NSLog("こんにちは、世界!"); // => No output...

Therefore, you need to convert the string to an NSString before passing it to NSLog().

NSString *str = [NSString stringWithUTF8String:"こんにちは、世界!"];
NSLog(@"%@", str); // => "こんにちは、世界!"

Thank you.
2021-02-10 10:22:18 -05:00
Christian Rauch
0ed16ceddb free 'outputs' in 'Wayland_DestroyWindow' 2021-02-10 10:22:18 -05:00
Christian Rauch
a44678465f free the 'data_device_manager' 2021-02-10 10:22:18 -05:00
Sebastian Krzyszkowiak
3ae2ec34fa wayland: Fix transform and scale handling when setting display mode 2021-02-10 10:22:18 -05:00
Manuel Alfayate Corchete
2c76433151 [KMS/DRM] Merge patch for bug 5522#: Implement KMSDRM_GetWindowWMInfo(). 2021-02-10 10:22:18 -05:00