Commit Graph

4317 Commits (8130950e926d7a8b6322ba741447a0edc0f5b977)

Author SHA1 Message Date
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
Manuel Alfayate Corchete bfa51c3845 [KMS/DRM] Fix for bug #5518: only do async pageflips when hardware supports them. 2021-02-10 10:22:18 -05:00
Cameron Gutman 79cd8cab08 Add default handler for Alt+Tab while keyboard grab is enabled
By default, we will minimize the window when we receive Alt+Tab with a
full-screen keyboard grabbed window to allow the user to escape the
full-screen application.

Some applications like remote desktop clients may want to handle Alt+Tab
themselves, so provide an opt-out via SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED=0.
2021-02-10 10:22:18 -05:00
Sylvain Becker 9d70711342 Revert checks on destination scaling size (see bug #5510) 2021-02-10 10:22:18 -05:00
Manuel Alfayate Corchete 088fb52579 [KMS/DRM] Correct small omission on bugfix #5513: y-coord correction has to be done on WarpMouseGlobal, too. 2021-02-10 10:22:18 -05:00
Sam Lantinga 2cc70ca39e Fixed crash if the GameCube controller hasn't been opened yet 2021-02-10 10:22:18 -05:00
Sylvain Becker d6a6662fa1 Remove checks on destination scaling size (see bug #5510) 2021-02-10 10:22:18 -05:00
Manuel Alfayate Corchete 8d95aba174 [KMS/DRM] Remove unused KMSDRM_SetWindowGrab prototype in header file. 2021-02-10 10:22:18 -05:00
Manuel Alfayate Corchete b17c49509b [KMS/DRM] Patch for bug #5513. KMSDRM backend can now manage and use several displays. 2021-02-10 10:22:18 -05:00
Cameron Gutman a78bce9e38 Properly handle keys already down when the hook is installed
For keys that are already down when we install the keyboard hook, we need to
allow the WM_KEYUP/WM_SYSKEYUP message to be processed normally. This ensures
that other applications see the key up, which prevents the key from being stuck
down from the perspective of other apps when our grab is released.
2021-02-10 10:22:18 -05:00
Sylvain Becker dc0ec827aa Remove old YUV fixme 2021-02-10 10:22:18 -05:00
Sylvain Becker ebb814310a Add checks for maximun scaling size (see bug #5510) 2021-02-10 10:22:18 -05:00
Sam Lantinga 7f710e93f0 Make sure we don't create a game controller mapping for HID devices that aren't supported by HIDAPI 2021-02-10 10:22:18 -05:00
Sam Lantinga 7e19c634c1 Note that the Logitech G29 (PS4) is a racing wheel 2021-02-10 10:22:18 -05:00
Sylvain Becker d59f8dafe4 Fixed bug 5510 - simplify the scaling functions blit auto (generated file) 2021-02-10 10:22:17 -05:00
Sylvain Becker 0b338bffe6 Fixed bug 5510 - simplify the scaling functions 2021-02-10 10:22:17 -05:00
Sylvain Becker dd6e02df63 SDL_stretch: remove un-used vars, same notation as blit functions 2021-02-10 10:22:17 -05:00
Sam Lantinga 1dc9180fb6 Fixed compiler warnings 2021-02-10 10:22:17 -05:00
Sam Lantinga d59a926837 Fixed build warning 2021-02-10 10:22:17 -05:00
Sam Lantinga eb83da0234 Fixed PS4 controllers over Bluetooth on Windows 7 2021-02-10 10:22:17 -05:00
Sam Lantinga d95a9eaedc Added WIN_IsWindows8OrGreater() for internal use 2021-02-10 10:22:17 -05:00
Cameron Gutman 808249a5ca X11: Ungrab the keyboard when the mouse leaves the window
GNOME Mutter requires keyboard grab for certain important functionality like
window resizing, interaction with the application context menu, and opening the
Activites view. To allow Mutter to grab the keyboard as needed, we'll ungrab
when the mouse leaves our window.

To be safe, we'll do this for all WMs since forks of Mutter and Matacity (and
possibly others) may have the same behavior, and we don't want to have to keep
track of those.
2021-02-10 10:22:17 -05:00
Ozkan Sezer 87f0900701 SDL_LowerSoftStretchLinear: assign result from scale_mat() to ret.
otherwise it would always return -1 when SSE and NEON instrinsics
are absent.
2021-02-10 10:22:17 -05:00
Sam Lantinga 24d6fda2c3 Fixed bug 3816 - asm code in video/SDL_stretch.c
Sylvain

I propose this new version for SDL_stretch.c that drops mprotect and asm

Code is similar to the StretchLinear, but the steps computation are kept similar to the nearest.
so that:
- it's pixel perfect with nearest
- as fast as asm I think
- no asm, nor mprotect
- benefit for all archicture
2021-02-10 10:22:17 -05:00
Sam Lantinga d81eaf8da5 Added explicit case from Uint8 to int before subtracting offset 2021-02-10 10:22:17 -05:00
Sam Lantinga bec9d740ec Fixed compile warning 2021-02-10 10:22:17 -05:00
Sam Lantinga a4db44fa71 The Sharkoon Skiller SGH2 headset hangs in DirectInput enumeration, so avoid it here just in case.
See bug 5485 for details.
2021-02-10 10:22:17 -05:00
Sam Lantinga 06ad887f44 Fixed bug 3816 - asm code in video/SDL_stretch.c
Ozkan Sezer

- adds MSVC __declspec(align(x)) support,
- disables asm if PAGE_ALIGNED no macro is defined,
- still disables asm for gcc < 4.6, need more info,
- drops Watcom support.
2021-02-10 10:22:17 -05:00
Sam Lantinga 1e5f0073c6 Fixed building with mingw64 2021-02-10 10:22:17 -05:00
Sylvain Becker 70b353d1a5 SDL_Update{YUV,NV}Texture: also intersect rect with texture dimension 2021-02-10 10:22:17 -05:00
Sylvain Becker 13626c3681 SDL_UpdateTexture: intersect update rect with texture dimension
- fix crash with software renderer
- fix non texture update with opengl/gles2
2021-02-10 10:22:17 -05:00
Sylvain Becker 5e3cf0d1f4 SDL_SoftStretch: disable asm path if mprotect isn't available (see bug #3816) 2021-02-10 10:22:17 -05:00
Cameron Gutman 6b057c6783 Expose separate keyboard and mouse grab support
This adds SDL_SetWindowKeyboardGrab(), SDL_GetWindowKeyboardGrab(),
SDL_SetWindowMouseGrab(), SDL_GetWindowMouseGrab(), and new
SDL_WINDOW_KEYBOARD_GRABBED flag. It also updates the test harness to exercise
this functionality and makes a minor fix to X11 that I missed in
https://hg.libsdl.org/SDL/rev/02a2d609369b

To fit in with this new support, SDL_WINDOW_INPUT_CAPTURE has been renamed to
SDL_WINDOW_MOUSE_CAPTURE with the old name remaining as an alias for backwards
compatibility with older code.
2021-02-10 10:22:17 -05:00
Sylvain Becker ff827fc767 SDL_SoftStretch: re-enable USE_ASM_STRETCH path for gcc >= 4.6 2021-02-10 10:22:17 -05:00
Cameron Gutman a1d288bea1 DirectFB: Split input grab handling into keyboard and mouse parts
The grabbed_window field is superfluous now since SDL added the
SDL_GetGrabbedWindow() function, so it can be removed.

DirectFB_SetWindowMouseGrab() is also simplified because SDL handles ungrabbing
any previously grabbed window prior to calling SetWindowMouseGrab() now.

Compile-tested only.
2021-02-10 10:22:16 -05:00
Sam Lantinga de85d61256 Fixed bug 5497 - SDL_COMPOSE_ERROR is wrong
UMU

#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str

I think SDL_STRINGIFY_ARG should be removed.

#define SDL_COMPOSE_ERROR(str) __FUNCTION__ ", " str

(verified with Visual Studio 2019)
2021-02-10 10:22:16 -05:00
Sam Lantinga ac72a2ba8e Fixed bug 5493 - Hint to let the user opt out of having Switch controllers' Home button lit when opened
jibb

New hint to let the user opt out of having Switch controllers' Home button lit when opened.

This is more consistent with the Switch itself (which doesn't light the button normally) and may be preferred by users who may disconnect their controller without letting the application close it.

I think this warrants a Switch-specific hint because the default behaviour is unusual (inconsistent with using a Switch controller on a Switch itself or with some other programs on PC), and because of that it's distinct from other lights (the player number on Switch controllers and the player colour on PlayStation controllers).
2021-02-10 10:22:16 -05:00
Sam Lantinga f23022ef97 Removed non-functional window grab implementations 2021-02-10 10:22:16 -05:00
Cameron Gutman a0d3c6c63c Rename SetWindowGrab() to SetWindowMouseGrab() 2021-02-10 10:22:16 -05:00
Cameron Gutman d133a5f6f7 wayland: cancel key repeat when keyboard focus is lost
SDL_SetKeyboardFocus(NULL) will lift any keys still pressed when keyboard focus
leaves the window, but then key repeat comes behind our backs and presses the
key down again. This results in an infinite stream of SDL_KEYDOWN events when
focus leaves the window with a key down (particularly noticeable with Alt+Tab).
2021-02-10 10:22:16 -05:00
Cameron Gutman 2793c9cfb0 Fix grabbing Alt+Tab and Alt+Esc on Windows 7 2021-02-10 10:22:16 -05:00
Cameron Gutman e1f73e642b Refactor keyboard grab to be managed by the video core
This gives us flexibility to add others hints to control keyboard grab behavior
without having to touch all of the backends. It also allows us to possibly
expose keyboard grab separately from mouse grab for applications that want to
manage those independently.
2021-02-10 10:22:16 -05:00
Sylvain Becker f40551c5f6 GLES2 SDL_Renderer: remove old ZUNE_HD defines and simplify shader cache 2021-02-10 10:22:16 -05:00
Ozkan Sezer b852590ba5 minor clean-up in SDL_os2audio.c 2021-02-10 10:22:16 -05:00
Brandon DeRosier 141f441633 fix build failure due to -Werror=declaration-after-statement (bug #5500) 2021-02-10 10:22:16 -05:00
Manuel Alfayate Corchete 8e1005f8b0 [KMS/DRM] Bugfix for #5489: Non-FULLSCREEN windows incorrecty use videomode changing to look fullscreen. 2021-01-24 00:51:26 -05:00
Ethan Lee e787282ba8 Implement Wayland_SetWindowResizable 2021-01-24 00:51:26 -05:00
Simon McVittie c16cfc0e92 waylandtouch: Don't export interface structs
These are explicitly written in C code rather than generated at build
time, so they weren't affected by changing how we invoke
wayland-scanner.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-24 00:51:26 -05:00
Sam Lantinga c857b5e0c9 Minor cleanup 2021-01-24 00:51:26 -05:00
Sam Lantinga 1981d23f4b Fixed bug 5466 - Add haptic support for Stadia Controller
Dimitriy Ryazantcev

Consider adding support for Stadia Controller haptics.

Here is example code how to deal with it:
99314be815/device/gamepad/hid_haptic_gamepad.cc (L45)
2021-01-24 00:51:26 -05:00
Sam Lantinga 96cfb81232 Fixed bug 5467 - SDL sys timer Mac OS update proposal
David Carlier

Change of api from 2016 which reduce code complexity a bit.
2021-01-24 00:51:25 -05:00
JibbSmart 0f57864c9e Hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS added so we can recognise a Joy-Con as half a Pro Controller, so we can read its analog input and read its sensors just like we do a Pro Controller. 2021-01-24 00:51:25 -05:00
Cameron Gutman bd553ea868 Implement support for inhibiting the screensaver on Wayland
We support both the org.freedesktop.ScreenSaver D-Bus API (same as the X11
backend) and the Wayland idle_inhibit_unstable_v1 protocol.

Some Wayland compositors only support one or the other, so we need both to
for broad compatibility.
2021-01-24 00:51:25 -05:00
Cameron Gutman 7ff3832e4d Fix continuous scrolling speed on Wayland
Wayland compositors seem to have standardized on 10 units per "wheel tick" for
continuous scroll events, so we need to convert these axis values to ticks by
dividing by 10 before reporting them in SDL_MOUSEWHEEL events.
2021-01-24 00:51:25 -05:00
Cameron Gutman 8c921d8201 Implement keyboard grab support for Windows
This is implemented via a low-level keyboard hook. Unfortunately, this is
rather invasive, but it's how Microsoft recommends that it be done [0].
We want to do as little as possible in the hook, so we only intercept a few
crucial modifier keys there, while leaving other keys to the normal event
processing flow.

We will only install this hook if SDL_HINT_GRAB_KEYBOARD=1, which is not
the default. This will reduce any compatibility concerns to just the SDL
applications that explicitly ask for this behavior.

We also remove the hook when the grab is terminated to ensure that we're
not unnecessarily staying involved in key event processing when it's not
required anymore.

[0]: https://docs.microsoft.com/en-us/windows/win32/dxtecharts/disabling-shortcut-keys-in-games
2021-01-24 00:51:25 -05:00
Ozkan Sezer fd65aaa9a8 move outdated winmm and psp joystick codes to struct _SDL_JoystickDriver
build-tested only. (bug #5472.)
2021-01-24 00:51:25 -05:00
Ozkan Sezer 8f1025899a os2audio: changed backend name from MMOS2 to DART (like SDL-1.2) 2021-01-24 00:51:25 -05:00
Ozkan Sezer 2376458841 renamed SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H to SDL_HAVE_MACHINE_JOYSTICK_H 2021-01-24 00:51:25 -05:00
Sam Lantinga f68b36df75 Added support for the EVORETRO GameCube Adapter in PC mode 2021-01-24 00:51:25 -05:00
Sam Lantinga 9c88eac856 ControllerList: fix typo 2021-01-24 00:51:25 -05:00
Ozkan Sezer 11fce32162 SDL_dinputjoystick.c: fixes to dfDIJoystick2[] array from Wine git.
Fix V/A/FSlider dwOfs values in c_dfDIJoystick2
af2f419426

Add missing ASPECT flags for c_dfDIJoystick2
e2e100272f

Closes bug #5474.
2021-01-24 00:51:25 -05:00
Ozkan Sezer 4a776557af old os2 analogue joystick code ported from SDL-1.2. disabled by default,
build-tested only.
2021-01-24 00:51:25 -05:00
Ozkan Sezer e91f83c1e0 hidapi.h: adjust so that it gives a smaller diff against mainstream 2021-01-24 00:51:25 -05:00
Sam Lantinga d4794028bb Fixed build 2021-01-24 00:51:25 -05:00
Sam Lantinga 9e45372a2f Fixed build on Android and iOS 2021-01-24 00:51:25 -05:00
Cameron Gutman 19236b462a Implement support for minimizing windows on Wayland
This required a bit of extra code to deal with the transition from minimized
back to fullscreen
2021-01-24 00:51:25 -05:00
Cameron Gutman cf84ec441f Improve reliability of cursor hiding on GNOME Wayland
Hiding the cursor doesn't appear to work reliably on GNOME when another window
steals mouse focus right as we call SDL_ShowCursor(SDL_DISABLE). This can happen
when the keyboard shortcut inhibition permission prompt appears in response to a
call to SDL_SetRelativeMouseMode() with SDL_HINT_GRAB_KEYBOARD=1. The result is
that the default cursor is stuck locked in position and visible on screen
indefinitely.

By redrawing the cursor on pointer focus enter, the cursor now disappears upon
the first mouse motion event. It's not perfect but it's way better than the
current behavior.
2021-01-24 00:51:25 -05:00
Sam Lantinga bf53651d73 Make sure we only do GameCube adapter initialization if we were able to load libusb 2021-01-24 00:51:24 -05:00
Sam Lantinga 3527b49459 Fixed initializing the Nyko and EVORETRO GameCube adaptors
This requires root on most Linux distributions, as we have to directly send USB messages to the devices to enable input reports.
2021-01-24 00:51:24 -05:00
Ozkan Sezer b6ae9a7cba renamed my_gradd.h to SDL_gradd.h 2021-01-24 00:51:24 -05:00
Sam Lantinga 178ae70a29 Don't add paddle mappings for the Xbox One Elite Series 1 controller, since they can't be unmapped and read directly on that controller. 2021-01-24 00:51:24 -05:00
Cameron Gutman d789ba8332 Implement keyboard grab support for Wayland
Use zwp_keyboard_shortcuts_inhibit_manager_v1 to allow SDL applications
to capture system keyboard shortcuts like Alt+Tab when keyboard grab is
enabled via SDL_HINT_GRAB_KEYBOARD.
2021-01-24 00:51:24 -05:00
Cameron Gutman 6e97170e96 Use PS4 rumble hint as the default for the PS5 rumble hint
Existing SDL applications may not know about the need to set a specific
hint to enable rumble on PS5 controllers, even though they may already
set the equivalent SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE hint for PS4
controller rumble support.

Rather than requiring those developers update their apps, let's use the
SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE value as an indication of the behavior
they are expected for all PlayStation controllers.
2021-01-24 00:51:24 -05:00
Ozkan Sezer 07f83cd5a6 hidapi/libusb/hid.c: fix race condition on device close (bug #5484)
From hidapi mainstream git: https://github.com/libusb/hidapi/issues/142
d2c3a9862e

Read callback may fire itself on its own even after its been requested
to stop and exactly before the calling code waits for its completion in
indefinite loop.  Explicitly preventing re-fireing the submission loop
fixes the issue.
2021-01-24 00:51:24 -05:00
Manuel Alfayate Corchete ee93f0edee [KMS/DRM] Revert unaproved fix for bug #5465. 2021-01-24 00:51:24 -05:00
Ozkan Sezer 6393d14de5 SDL_virtualjoystick.c: remove wrong #endif comment. 2021-01-24 00:51:24 -05:00
Ozkan Sezer 327ea97436 hidapi/libusb/hid.c: whitespace tidy-up. 2021-01-24 00:51:24 -05:00
Manuel Alfayate Corchete e1d932f8b6 [KMS/DRM] Fix for bug #5468: corruption on dynamic cursor changing caused by wrong buffer size. 2021-01-24 00:51:24 -05:00
Manuel Alfayate Corchete 99facb1df3 [KMS/DRM] Fix for bug #5470: ratio correction for fullscreen windows with no matching resolution. Correct bracket position in else statements so they follow the coding style. 2021-01-24 00:51:24 -05:00
Sam Lantinga c265e73f3b Fixed bug 5473 - Add WSCONS support for NetBSD
wahil1976

This patch adds WSCONS support for NetBSD.
2021-01-24 00:51:24 -05:00
Ozkan Sezer f3835702d3 fix build with --disable-directx 2021-01-24 00:51:24 -05:00
Sam Lantinga 2ea393bd83 Fixed the screenshot button mapping on third party Bluetooth Nintendo Switch Pro controllers 2021-01-24 00:51:23 -05:00
Manuel Alfayate Corchete 03665004d0 [KMS/DRM] Small fix to KMSDRM_Waitpageflip(). More comments on how it works. 2021-01-24 00:51:23 -05:00
Ozkan Sezer bdb3e6b84f SDL_hidapi_switch.c: fix build with older compilers 2021-01-15 12:40:00 +03:00
Sam Lantinga e3dbae5010 Get the serial number for the Nintendo Switch Pro controller 2021-01-14 23:49:41 -08:00
Sam Lantinga 5fc743c4fd Phantom Nintendo Switch Pro Controller initialization problem 2021-01-14 23:49:37 -08:00
Sam Lantinga 92742306a6 Fixed rumble reset failing for Switch Pro controllers in USB mode 2021-01-14 23:49:33 -08:00
Sam Lantinga d0b87fede6 Added HIDAPI rumble debug info 2021-01-14 23:49:27 -08:00
Sam Lantinga e2f46ed8ef Always lock the HIDAPI device when closing, in case rumble is pending 2021-01-14 23:49:20 -08:00
Sam Lantinga 907b8eebc3 Make sure the HIDAPI device is locked when closing it, in case there is rumble pending that didn't complete 2021-01-14 23:49:16 -08:00
Sam Lantinga b3848c5120 Fixed bug 5445 - Incorrect Switch Pro Controller face buttons when SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS disabled
jibb

I'm testing with DualShock 4, DualSense, Switch Pro Controller, and PowerA Switch Controller.

I'm using the standard mapping file from here:
https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt

With SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS turned off (set to "0") I expect the button positions to be the same on all devices, based on Xbox controller button naming (eg SDL_GameControllerGetButton(g, SDL_CONTROLLER_BUTTON_Y) gives me whether the North face button is pressed).

However, the Switch Pro Controller layout is wrong (matching labels rather than positions, so X and Y are swapped and A and B are swapped). And with the PowerA controller the East and West buttons are correct, but the North and South buttons are swapped instead.

Mathias Kaerlev

Also seeing this on 2.0.14. This is most likely a regression, since we weren't seeing this on an earlier SDL version.

I suspect it might be caused by this commit:
a569b21188 (diff-da9344d94c66b8c702a45e7649f412039f08bba83bd82de33f5c80ea9c8c39d5)

It seems like both the HIDAPI driver and SDL_gamecontroller.c will try to swap the buttons if the hint is set to 0, causing the button remap to cancel out.
2021-01-14 15:15:57 -08:00
Sam Lantinga bdc6e4ffc5 Fixed bug 5195 - Replugging in "mixed" controller types crashes on macOS
RustyM

This is related to Bug 5034, but crashes under a somewhat different condition.

In the latest tip (changeset 13914) or with the SDL 2.0.12 source + David?s 5034 patch, unplugging and then replugging in certain controller types on macOS will crash. A mix of new controllers like Switch Pro, PS4 and Xbox One all work without issue. But if a controller without a rumble function, like many SNES retro USB gamepads, is mixed with a PS4 or Switch Pro controller it will crash.

File: joystick/darwin/SDL_sysjoystick.c
Function: static recDevice *FreeDevice(recDevice *removeDevice)
On line 159: while (device->pNext != removeDevice) {
Causes: Thread 1: EXC_BAD_ACCESS (code=1, address=0x188)

This can be reproduced in testgamecontroller" by starting the test program with both a ?retro? controller plugged in and a ?modern rumble? controller (Switch Pro/PS4). This may crash on launch, but it depends on which controller ends up as device 0. If it doesn?t crash, unplug the ?modern rumble? controller and plug it back in.

Some of the "retro" controllers I?ve seen this crash with:
- iBuffalo SNES Controller
- 8Bitdo SN30 Gamepad (in MacOS mode)
- Retrolink NES Controller
- HuiJia SNES Controller Adaptor

The issue appears macOS specific. Seen on 10.12.6 and 10.14.6. Not seen on Windows 10.

The while loop in FreeDevice() assumes that every device is not NULL.

    recDevice *device = gpDeviceList;
    while (device->pNext != removeDevice) {
        device = device->pNext;
    }
    device->pNext = pDeviceNext;

So maybe we should check for NULL here? Or instead prevent adding NULL devices to the list in the first place? Checking device for NULL before entering the loop appears to work.

    recDevice *device = gpDeviceList;
    if (!device) {
        while (device->pNext != removeDevice) {
            device = device->pNext;
        }
    }
    device->pNext = pDeviceNext;
2021-01-14 15:03:11 -08:00
Sam Lantinga 6a342954e8 Fixed bug 5451 - Can't create EGLSurface in Wayland from SDLWindow (no EGLNativeWindow pointer)
sashikknox

In some cases, need create EGLWindow with SDLWindow. In X11 i can get pointer to NativeWindow from **struct SDL_SysWMinfo wmInfo**
```C++
struct SDL_SysWMinfo wmInfo;
SDL_GetWindowWMInfo(ptSDLWindow, &wmInfo)
#if defined(__unix__) && defined(SDL_VIDEO_DRIVER_X11)
nativeWindow=(EGLNativeWindowType)wmInfo.info.x11.window;
nativeDisplay=(EGLNativeDisplayType)wmInfo.info.x11.display;
#endif
```
than i can create EGLSurface
```
eglCreateWindowSurface(nativeDisplay, EGL_CONFIG, nativeWindow, SURFACE_ATTRIBUTES);
```
in Wayland i can do it with same way, just need pointer to **EGLWindow**, we already have pointer to **wl_display** from **SDL_sysWMInfo**, need add to **wl** struct in SDL_SysWMInfo another pointer to **struct wl_egl_window *egl_window;**. And in wayland backend, in function **Wayland_GetWindowWMInfo** return pointer to **egl_window** from **SDL_WindowData**
Now i use patched statically built SDL2 in port of Quake 2 GLES2 for SailfishOS (it use QtWayland):
link to SDL2 commit and changed string for patch:
- 6858a618cd
- b1e29e87b9/SDL2/src/video/wayland/SDL_waylandwindow.c (L463)

link to use in Quake2 port:
1. here i get pointer to EGLNativeWindowType:  6d94fedb1b/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c (L319)
2. then use it for create EGLSurface: 6d94fedb1b/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c (L391)
2021-01-14 14:42:53 -08:00
Sam Lantinga 82aafa9aa8 Fixed bug 5461 - Add rewritten WSCONS driver for OpenBSD
wahil1976

This patch adds a written-from-scratch WSCONS driver for OpenBSD. It does not have hardcoded keymaps, and it features mouse support when wsmux is available.

For this to work, it needs access to the /dev/wskbd* devices which are not available to non-root users by default. Access to those can be granted by changing /etc/fbtab to give the logging user the ownership of those devices.
2021-01-14 14:32:11 -08:00
Manuel Alfayate Corchete 1adadc7702 [KMS/DRM] Adjust come return values. Improve comments. 2021-01-14 10:18:40 +01:00
Manuel Alfayate Corchete 57661e42c3 [KMS/DRM] Remove unused header. 2021-01-13 20:17:50 +01:00
Manuel Alfayate Corchete ead3c406a2 [KMS/DRM] Refactor, improve and re-comment async pageflips code. 2021-01-13 20:11:01 +01:00
Sam Lantinga fbd7c718b6 Don't blink the Xbox 360 LED when setting the player slot, it's probably already been set by a driver 2021-01-13 11:02:07 -08:00
Sam Lantinga d757ec7f5c Only select the gamepad interfaces on the Xbox 360 wireless adapter 2021-01-13 11:02:01 -08:00
Manuel Alfayate Corchete aac74db685 [KMS/DRM] Enable async pageflips. 2021-01-13 15:54:26 +01:00
Manuel Alfayate Corchete 9384e59561 [KMS/DRM] Add warning comentary to avoid future experiments with scaling. 2021-01-12 20:15:37 +01:00
Ryan C. Gordon b99543b682 opengl: More work on making line drawing match software renderer. 2021-01-11 20:40:11 -05:00
Manuel Alfayate Corchete 8442754912 [KMS/DRM] Refactor KMSDR_CreateSurface to group all non-Vulkan stuff in a block. 2021-01-12 00:22:58 +01:00
Manuel Alfayate Corchete 87eb734c4e [KMS/DRM] Don't ask SDL to scale image when in Vulkan mode. 2021-01-11 23:59:40 +01:00
JibbSmart e9887045a2 Gyro and Accel sensor support for Switch Pro Controller.
Note that axes are changed to match the axes we're using with PlayStation controllers, since users will appreciate consistent behaviour across devices.
2021-01-11 15:36:40 +08:00
Manuel Alfayate Corchete 85e8adf78d [KMS/DRM] Unused code cleaning. 2021-01-11 22:28:27 +01:00
Manuel Alfayate Corchete 5105ecf8b1 [KMS/DRM] Move surface size info to window driverdata, for coherency. 2021-01-11 21:02:07 +01:00
Manuel Alfayate Corchete 2067a7db8e [KMS/DRM] Fix fullscreen to windowed transition. Fix aspect ratio correction without using planes. 2021-01-11 20:29:09 +01:00
Sylvain Becker 958e5d5b34 SDL_UpdateNVTexture: fixed pitch/bpp for GLES2 (bug #5430) 2021-01-11 10:01:24 +01:00
Sylvain Becker 68815b6c06 Fixed bug 5465 - Invalid memcpy inside SDL_GestureDelTouch (Thanks dmikushin and Yuki Okumura) 2021-01-10 22:21:12 +01:00
Sylvain Becker b94718e0a7 SDL_UpdateNVTexture: for D3D11, same notation as SDL_UpdateTexture (bug #5430) 2021-01-09 21:22:21 +01:00
Manuel Alfayate Corchete 850d9c8c0d [KMS/DRM] Cleanup remainings from plane/scaling usage. 2021-01-09 02:25:13 +01:00
Manuel Alfayate Corchete 2aeb317743 [KMS/DRM] Fix vkQuake3 in OpenGL mode. 2021-01-08 22:00:28 +01:00
Sam Lantinga 8746788fea KMSDRM_LEGACY is no longer legacy 2021-01-08 11:08:23 -08:00
Sam Lantinga 50ea3b77f1 Fixed bug 5080 - SDL_netbsdaudio: Always use the device's preferred frequency
Nia Alarie

The NetBSD kernel's audio resampling code is much simpler and lower quality than libsamplerate.

Presumably, if SDL always performs I/O on the audio device in its native frequency, we can avoid resampling audio in the kernel and let SDL do it with libsamplerate instead.
2021-01-08 10:09:37 -08:00
Sam Lantinga 2f72535c62 Fixed joysticks generating SDL mouse events 2021-01-08 09:54:55 -08:00
Sam Lantinga a5dba7d3ab Fixed Xbox One Series X share button incorrectly triggering on newer firmware 2021-01-08 09:54:52 -08:00
Manuel Alfayate Corchete b24494734b [KMS/DRM] Go back to the LEGACY interface only because using planes breaks compatibility with HW, so no advantage on using ATOMIC. 2021-01-08 18:57:12 +01:00
Manuel Alfayate Corchete 940e1b8dd9 [KMS/DRM] Small readability changes. 2021-01-08 16:33:50 +01:00
Manuel Alfayate Corchete e5bf1850f5 [KMS/DRM] Fix cpmpilation warnings. Thanks to Ozkan Sezer for pointing this out! 2021-01-08 15:39:05 +01:00
Manuel Alfayate Corchete cef1bd0639 [KMS/DRM] Prevent creating another default cursor everytime a window is created. Other fixes and cleanups. 2021-01-08 13:14:42 +01:00
Sam Lantinga e778881ada Fixed bug 5449 - SDL_DROPFILE update mouse location of drop in Cocoa
Dominik Reichardt

Exult (http://exult.info) has an editor app that uses GTK+2. Up to now we were using X's drag'n'drop to allow dropping of assets from the editor onto Exult.
There is now an experimental branch that makes use of SDL_DROPFILE. That works under X, dropping in Exult's SDL2 window puts the asset right at the spot you dropped at.
On macOS with native Exult and Quartz GTK+2 this doesn't work, the location of the drop is where the mouse was last tracked before you left the window (usually one of the edges, unless you tabbed out).
All we tried out pointed to the fact that the location update needs to be done by the dropfile event in SDL2, not by our own (which always only worked after the Exult window getting focus).

This patch adds this to SDL_cocoawindow.m and it works perfectly, passing the correct coordinates to our code (SDL_GetMouseState()).
2021-01-07 11:49:28 -08:00
Sam Lantinga c8a64ad90c Fixed building when SDL_LIBUSB_DYNAMIC is defined 2021-01-07 10:23:55 -08:00
Manuel Alfayate Corchete d079130c24 [KMS/DRM] Don't use primary plane for scaling because that's unsupported on most LEGACY-only HW. 2021-01-07 18:44:34 +01:00
Manuel Alfayate Corchete e168d1138c [KMS/DRM] Correct drmModeSetCursor() dimensions. 2021-01-07 14:40:24 +01:00
Manuel Alfayate Corchete 335d78ff86 [KMS/DRM] Add the missing files for Vulkan support to the KMSDRM_LEGACY backend, had forgotted to do -hg add-. 2021-01-07 11:30:33 +01:00
Manuel Alfayate Corchete 661bacfe27 [KMS/DRM] Add Vulkan suport to the KMSDRM_LEGACY backend.Minor text spacing tweaks for better readability. Comment out unused function. 2021-01-07 00:47:21 +01:00
Ozkan Sezer dfb0afe36a fix build after commit 5730b2005da1 2021-01-07 00:41:32 +03:00
Manuel Alfayate Corchete 67e0b1dd4e [KMS/DRM] Rewrite KMSDRM_LEGACY backend to accomodate Vulkan compatibility. Fix several bugs on that backend. 2021-01-06 22:15:26 +01:00
Sylvain Becker 57a5c45372 Fix D3D11 UpdateTextureNV in non fullscreen (bug #5430) 2021-01-05 22:06:51 +01:00
Sylvain Becker fc61ecb25c Fix software UpdateNVTexture non fullscreen (bug #5430) 2021-01-05 21:54:03 +01:00
Sylvain Becker 204ef3b509 Fix D3D11 UpdateNVTexture (bug #5430) 2021-01-05 20:38:31 +01:00
Sylvain Becker c0df40e003 Add more SDL_HAVE_YUV defines 2021-01-05 17:39:48 +01:00
Ozkan Sezer 76295cecf3 video/windows: ANSI/UNICODE updates (cf. bug 5435):
- explicitly use UNICODE versions of DrawText, EnumDisplaySettings,
  EnumDisplayDevices, and CreateDC: the underlying structures have
  WCHAR strings.
- change WIN_UpdateDisplayMode and WIN_GetDisplayMode() to accept
  LPCWSTR instead of LPCTSTR for the same reason.
- change WIN_StringToUTF8 and WIN_UTF8ToString to the explicit 'W'
  versions where appropriate.
2021-01-05 15:50:10 +03:00
Ozkan Sezer 265a1cc97a use WIN_StringToUTF8W instead of WIN_StringToUTF8 where needed (#2)
cf. bug #5435.
- SDL_wasapi_win32.c (GetWasapiDeviceName): pwszVal is WCHAR*
- windows/SDL_sysfilesystem.c (SDL_GetBasePath, SDL_GetPrefPath)
- windows/SDL_sysurl.c (SDL_SYS_OpenURL): wurl is WCHAR*
- SDL_windowssensor.c (ConnectSensor): bstr_name is WCHAR*
- windows/SDL_systhread.c (SDL_SYS_SetupThread): strw is WCHAR*
2021-01-05 15:50:02 +03:00
Ozkan Sezer 516042b4d6 ran gendynapi.pl after SDL_UpdateNVTexture addition 2021-01-05 15:15:50 +03:00
Ozkan Sezer 31751bdcce wmmsg.h: constified wmtab 2021-01-05 15:15:37 +03:00
Sylvain Becker b032504162 Fix unused variable warning on METAL (see bug #5430) 2021-01-05 12:36:34 +01:00
Sylvain Becker c1eb9ecf99 Add SDL_UpdateNVTexture for META (bug #5430)
(not tested)
2021-01-05 12:29:43 +01:00
Sylvain Becker 73d93dbc38 Fix compilation on Window10 (see bug #5430) 2021-01-05 12:20:02 +01:00
Sylvain Becker df6b813108 Fix compilation (implicit declaration of function) (see bug #5430) 2021-01-05 12:16:32 +01:00
Sylvain Becker d1f031c8ee Add SDL_UpdateNVTexture for d3d11 (bug #5430)
(not tested)
2021-01-05 12:08:16 +01:00
Sylvain Becker f5eba2ccd6 Fixed invalid read in yuv_rgb_sse() (see bug #5430) 2021-01-05 12:00:54 +01:00
Sylvain Becker be4cfd51c3 Add SDL_UpdateNVTexture() to update NV12/21 Texture (bug #5430)
for renderer software, opengl, and opengles2
2021-01-05 11:56:22 +01:00
Sam Lantinga d72dbd9883 Fixed detection of the Wooting Two keyboard, which shows up as an Xbox 360 controller 2021-01-04 17:30:28 -08:00
Sam Lantinga b2a0c712cb Allow setting the player index to -1, which turns off the player LED for PS5 controllers 2021-01-04 12:24:44 -08:00
Sam Lantinga bf754b52bf Valve contributed code is under the Zlib license 2021-01-04 12:17:24 -08:00
Ozkan Sezer 8cb421b26d SDL_windows_main.c: use new WIN_StringToUTF8W macro 2021-01-04 10:20:10 +03:00
Ozkan Sezer a594b85031 use WIN_StringToUTF8W macro instead of WIN_StringToUTF8, where needed:
i.e. where the string is known guaranteed to be WCHAR*, in:
- SDL_dinputjoystick.c (WIN_IsXInputDevice): VARIANT->var is BSTR (WCHAR*)
- SDL_rawinputjoystick.c (RAWINPUT_AddDevice): string is WCHAR*
- SDL_windows_gaming_input.c (IEventHandler_CRawGameControllerVtbl_InvokeAdded):
  string is WCHAR*

There should be more of these..
2021-01-04 10:00:30 +03:00
Ozkan Sezer 5b14bbff5f make ANSI/UNICODE versions of WIN??UTF8 macros individually available. 2021-01-04 10:00:10 +03:00
Ozkan Sezer f2bd861cd7 move SDL_tcsstr definition to core/windows/SDL_windows.h 2021-01-04 08:50:00 +03:00
Ozkan Sezer ae18109a92 SDL_windowsjoystick.c (SDL_CreateDeviceNotification): use L, not TEXT()
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer 390fd14f54 SDL_windowswindow.c (SDL_HelperWindowCreate): adjust for ANSI/UNICODE:
change SDL_HelperWindowClassName and SDL_HelperWindowName from WCHAR *
to be const TCHAR*

cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer 398d2764c7 RAWINPUT_InitWindowsGamingInput: change pNamespace from LPTSTR to PCWSTR
because WindowsCreateStringReference specifically accepts const WCHAR *
- WGI_JoystickInit(): ditto.

cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer f09e0af7aa SDL_dinputjoystick.c (IsXInputDevice): adjust to be ANSI/UNICODE-agnostic
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer ed39f2f3f9 SDL_wasapi_win32.c (WASAPI_PlatformThreadInit): use L instead of TEXT()
because AvSetMmThreadCharacteristicsW specifically accepts WCHAR* input
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Ozkan Sezer 01a2f27679 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle()
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Cameron Gutman 014f507c40 Use specific acquire and release variants of InterlockedExchange on ARM
_InterlockedExchange_rel() is required for correctness on ARM because
the _ReadWriteBarrier() macro is only a compiler memory barrier, not a
hardware memory barrier. Due to ARM's relaxed memory model, this means
the '*lock = 0' write may be observed before the operations inside the
lock, causing possible corruption of data protected by the lock.

_InterlockedExchange_acq() is more efficient on ARM because it avoids an
expensive full memory barrier that _InterlockedExchange() does.
2021-01-03 12:13:40 -06:00
Sam Lantinga 393c8c1f16 Fixed bug 5440 - MacCatalyst build failures
C.W. Betts

I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues:

* MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst.
* OpenGL ES is unavailable under Mac Catalyst.
* Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled.
* Set Metal as the default renderer on Mac Catalyst

Attaching a patch that will make SDL2 build for Mac Catalyst.
2021-01-03 10:32:55 -08:00
Cameron Gutman 6cbd4417f0 Add a hint for D3D9Ex to avoid having to choose at compile-time 2021-01-02 14:45:15 -06:00
Cameron Gutman 59594a7891 Implement PAUSE_INSTRUCTION() for Windows ARM platforms 2021-01-02 13:43:04 -06:00
Sylvain Becker fea49a3e2f SDL_stretch.c: compilation NEON on Windows 10 2021-01-03 15:24:47 +01:00
Sylvain Becker acccc71f27 Fixed bug 5436 - MSVC 2019 ARM64 build fails to compile SDL_stretch.c 2021-01-02 22:31:44 +01:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Cameron Gutman 414ddc32c5 Do not wait in GetOverlappedResult() in hid_read_timeout()
This is unsafe because the event is auto-reset, therefore the call to
WaitForSingleObject() resets the event which GetOverlappedResult() will
try to wait on.

Even though the overlapped operation is guaranteed to be completed at
the point we call GetOverlappedResult(), it will still wait on the event
handle for a short time to trigger the reset for auto-reset events. This
amounts to roughly a 100 ms sleep each time GetOverlappedResult() is called
for a completed I/O with a non-signalled event.

In the context of HIDAPI, this extra sleep means that callers that loop
on hid_read_timeout() with timeout=0 will loop forever, since the 100 ms
sleep each iteration ensures ReadFile() will always have new data.
2021-01-01 17:34:07 -06:00
Sam Lantinga 963c9495d3 Fixed bug 5431 - SDL_Metal_GetDrawableSize is inaccurate for high dpi displays if a Metal view has not already been created
Caleb Cornett

For a window created with SDL_WINDOW_ALLOW_HIGHDPI, SDL_GL_GetDrawableSize will return the high-dpi drawable size even before any GL context creation happens. But SDL_Metal_GetDrawableSize will return the size of the window if the Metal view has not been created. This is confusing and inconsistent behavior.

An easy way to test this is to build testgl2 and testvulkan on macOS with the SDL_WINDOW_ALLOW_HIGHDPI flag enabled during window creation. The GL2 program will report a drawable size of 2x window width and 2x window height, while the Vulkan program will report the window size.

This patch addresses the issue by falling back to using the content view dimensions if no Metal view exists in the window. (The code for this was taken directly from Cocoa_GL_GetDrawableSize.) With this change, the testvulkan behavior matches that of testgl2.

Note that I haven't tested for this issue on UIKit. It's possible a similar change will need to be made there too.
2021-01-02 10:11:08 -08:00
Sam Lantinga d25eff6505 Fixed bug 5429 - spinlock implements PAUSE_INSTRUCTION for PPC platforms
David Carlier

This form of 'or' provides a hint that performance
will probably be improved if shared resources dedicated
to the executing processor are released for use by other
processors
2021-01-02 10:06:22 -08:00
Sam Lantinga f0b6c78733 Fixed Windows XP compatibility with recent hidapi commit 2021-01-02 09:58:08 -08:00
Sylvain Becker 3edf337d66 Simplify RenderGetViewportSize 2021-01-02 17:29:34 +01:00
Sylvain Becker 2af765da11 SDL_RenderGetViewportF: only need the size of viewport (see bug #5424) 2021-01-02 17:18:13 +01:00
Sylvain Becker 41597249e8 SDL_RenderGetViewportF: remove debug messages 2021-01-02 16:15:22 +01:00
Sylvain Becker 8c48c4238a Add SDL_RenderGetViewportF: fix lost of precision while scaling (see bug #5424) 2021-01-02 16:12:30 +01:00
Sylvain Becker c005267fb1 SDL_BlitScaled: better and safer fix clipping bug #2687
And re-use SDL_round(), since it's been re-added
(remove in https://hg.libsdl.org/SDL/rev/34043108b7e4 )
2021-01-02 09:38:19 +01:00
Sylvain Becker 2127ed2574 SDL_SoftStretch: add a check for input pixel format
and function re-naming
2021-01-02 09:28:16 +01:00
Sam Lantinga ab55ec4850 Fix use-after-free SBH corruption due to overlapped ReadFile in hidapi not being canceled for all threads before device close
- hidapi already called CancelIo on hid_close but that only cancels pending IO for the current thread. Controller read/writes originate from multiple
  threads (serialized, but on a different thread nonetheless) but device destruction was always done on the main device thread which left any
  pending overlapped reads still running after hidapi's internal read buffer is deallocated leading to intermittent free list corruption.
2021-01-01 11:12:41 -08:00
Sam Lantinga 480c1f9fef Make sure we're not starving report reads when there's lots of rumble 2021-01-01 11:12:36 -08:00
Sam Lantinga 223af86c62 Added SDL_RenderGetD3D11Device() to get access to the device associated with the D3D11 renderer 2021-01-01 11:12:30 -08:00
Sam Lantinga 5f0b2a7f54 Fixed resource leak with D3D11 NV12 textures 2021-01-01 11:12:22 -08:00
Manuel Alfayate Corchete 21003b7db2 [KMS/DRM] Small refactoring on the SwapWindow function. 2020-12-31 14:31:29 +01:00
Manuel Alfayate Corchete e1fb969b76 [KMS/DRM] Correct comments about last bugfix. 2020-12-31 01:40:15 +01:00
Manuel Alfayate Corchete e34caa9779 [KMS/DRM] Correct EGL/GL library loading on window creation, thus saving window re-creation. 2020-12-31 01:31:57 +01:00
Sylvain Becker d81fe9239f SDL_BlitScaled: remove un needed -1 +1 offset in calculation 2020-12-30 22:03:32 +01:00
Ozkan Sezer 8476df3e31 SDL_mixer.c: remove calls to non-existing m68k asm code. 2020-12-30 23:55:10 +03:00
Sylvain Becker 590a5469ed Fixed bug 5424 - Renderer doesn't use entirely the viewport when scaling is used
Viewport/Clip dimensions are calculated usingg SDL_ceil whereas all renders use SDL_floor
2020-12-30 16:12:14 +01:00
Ozkan Sezer 8a32ee24db removed MSVC strtok_s use from SDL_strtokr().
no other ??_s are used elsewhere in SDL_stdinc. besides, C11 has a
strtok_s with a different signature.
2020-12-30 01:00:24 +03:00
Sam Lantinga 0684572ccc Added a hint to control whether the player LEDs should be lit to indicate which player is associated with a PS5 controller. 2020-12-29 12:13:10 -08:00
Sylvain Becker 80cf8a8b76 SDL_BlitScaled: also prevent crash if dest width or height is negative 2020-12-29 17:29:31 +01:00
Sylvain Becker f08b9a5b6b SDL_BlitScaled: prevent crash if dest width or height is 0 2020-12-29 16:02:52 +01:00
Manuel Alfayate Corchete 427c96ec11 [KMS/DRM] Rework some functions. 2020-12-29 14:24:38 +01:00
Sam Lantinga 67f0b9b86d Fixed bug 5418 - Add system features detection for Elbrus (E2K)
Ivan Kuzmenko

MCST Elbrus 2000 (E2K, https://en.wikipedia.org/wiki/Elbrus_2000) is a russian processor architecture based on VLIW/EPIC instruction set (like Intel Itanium (IA-64) architecture). Architecture has half native / half software support of most Intel/AMD SIMD (e.g. MMX/SSE/SSE2/SSE3/SSSE3/SSE4.1/SSE4.2/AES/AVX/AVX2 & 3DNow!/SSE4a/XOP/FMA4).
It also has built-in x86/x86_64 <-> e2k binary translators  (RTC, http://www.mcst.ru/rtc and Lintel, http://www.mcst.ru/lintel) that can run code for x86/x86_64 architecture (Transmeta did something similiar with their Crusoe series) with SIMD extensions support.
Attached patch allows SDL2 to detect extensions supported by E2K like MMX, 3dNOW!, AVX etc. (test/testplatform log: https://termbin.com/7qs3).
2020-12-28 20:58:47 -08:00
Sam Lantinga 3cb0e840e6 Fixed bug 5422 - KMSDRM_LEGACY: Add OpenBSD support
wahil1976

This patch adds support for OpenBSD to KMSDRM_LEGACY. Note that the patch won't be ported to the atomic KMSDRM backend because OpenBSD does not support atomic KMS properly yet.
2020-12-28 11:47:53 -08:00
Joel Linn 8fc0baad98 Add SDL_cond implementation using Windows Condition Variables
Is automatically used when the SRW SDL_mutex implementation is active.
Otherwise falls back to the generic implementation.

v2: - Rebase onto master fa3ea1051a4b
2020-12-28 11:43:11 -08:00
Joel Linn 2443e51e0e Add optional suffix `_generic` to generic SDL_cond impl
Allows for runtime selectable implementation
2020-12-28 11:42:49 -08:00
Manuel Alfayate Corchete 7539ac8087 [KMS/DRM] Restore hacky code to point to TTY buffer on surface destruction b/c I lack alternatives. 2020-12-28 18:22:07 +01:00
Sylvain Becker 5dabc4d72f Revert changeset 14590 544ac819e8b3 , does not fully fix 2020-12-28 18:17:25 +01:00
Sylvain Becker 9efdafd43d SDL_RenderCopy: scale before doing intersection
this prevents drawing 1 pixel outside the screen, in letterbox mode
2020-12-28 18:07:03 +01:00
Manuel Alfayate Corchete 86b81abea6 [KMS/DRM_LEGACY] Prevent mouse cursor from staying onscreen after window destruction. Patch by Ozkan Sezer. 2020-12-28 16:19:19 +01:00
Manuel Alfayate Corchete 0feaf7d196 [KMS/DRM][Vulkan] Correct non-existing property. Remove hacky surface destruction code (TTY buffer isn't there after a Vulkan window is created). 2020-12-28 14:37:58 +01:00
Sylvain Becker 7186584b8d fix indentation (bug 5313) 2020-12-28 10:41:37 +01:00
Sylvain Becker c2735c0bb9 Better scaling fallbacks for the SW renderer (bug 5313) 2020-12-27 23:53:28 +01:00
Ozkan Sezer a6beb2d264 SDL_PrivateLowerBlitScaled: remove unused local var 'a' 2020-12-28 01:10:02 +03:00
Sylvain Becker 30df2e4e36 Scaling fallbacks for the SW renderer (bug 5313) 2020-12-27 23:00:11 +01:00
Luca Weiss 040bd7a91b Fix udev not detecting ID_INPUT_KEY devices when udev is not running
https://bugzilla.libsdl.org/show_bug.cgi?id=5308

The udev code labels devices that are found by this code with
ID_INPUT_KEY which in turn gets used by SDL to label the devices as
SDL_UDEV_DEVICE_KEYBOARD.

This was missing for the code path when udev is not running and as such
devices such as the power button of a phone was not detected as keyboard
input and no devices were emitted.
2020-12-28 00:55:28 +03:00
Sylvain Becker f9b5f6cc0f Forward scale mode to SW renderer (Bug 5313) 2020-12-27 20:28:24 +01:00
Manuel Alfayate Corchete 46d31d570d [KMS/DRM][Vulkan] Fix segfault when changing fullscren mode and permanent cursor when changing between Vulkan and GL renderers in vkQuake3. Tidy up window destruction code. 2020-12-27 00:43:06 +01:00
Joel Linn e7c479414b Disable WaitOnAddress SDL_sem implementation on Windows Phone
Apps that use the required APIs do not pass certification.
2020-12-25 17:10:02 +03:00
Joel Linn d6afc1c608 thread/windows: Statically link synchronization APIs on WINRT
GetModuleHandleW is not available on those platforms
---
 .../WinPhone81_VS2013/SDL-WinPhone81.vcxproj         |  8 ++++----
 VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj     | 12 ++++++------
 src/thread/windows/SDL_sysmutex.c                    | 12 ++++++++++++
 src/thread/windows/SDL_syssem.c                      | 11 +++++++++++
 4 files changed, 33 insertions(+), 10 deletions(-)
2020-12-25 04:00:20 +03:00
Sam Lantinga ff913a22f4 Fixed compile warnings on platforms without hidapi support 2020-12-23 16:16:55 -08:00
Sam Lantinga 047b20e3b6 Fixed compile warnings on platforms without hidapi support 2020-12-23 16:11:16 -08:00