Commit Graph

14774 Commits (c1da39a245768a3867cd4377e855980e1f1bc42a)

Author SHA1 Message Date
Ryan C. Gordon 4d000ae3bd
audio: Change references to `streams[i]` to previously-calculated `stream`.
Reference PR #9096.
2024-02-20 15:30:01 -05:00
Mathieu Eyraud 751917cb6f Fix null pointer dereference in SDL_BindAudioStreams() 2024-02-20 15:14:07 -05:00
Frank Praznik 8b6eae2d4f cmake: Split and store the libdecor version as individual parts
It is becoming necessary to enable additional features as libdecor continues to evolve, and checking against a single base version will no longer be adequate. Libdecor doesn't provide versioning defines in its headers, so split the version string into parts to allow for discrete version detection and feature enablement at build time.
2024-02-20 11:28:02 -05:00
Sam Lantinga 8073f4aa1d Pass the real error from D3D12_CreatePipelineState() back to the application 2024-02-20 06:24:20 -08:00
Sam Lantinga 376ef4e418 Fixed the WGI driver picking up Xbox controllers handled by RAWINPUT
The WGI driver will see them first, but the RAWINPUT driver has higher priority, so we'll defer to that when it's available.

Fixes https://github.com/libsdl-org/SDL/issues/9091
2024-02-20 06:20:32 -08:00
Ozkan Sezer cb3a1a82d5 SDL_memcpy.c, SDL_memmove.c, SDL_memset.c: don't use gcc builtins if !HAVE_LIBC
__builtin_memcpy, as well as __builtin_memset and __builtin_memmove, needn't be
inlined but emitted as a libc call, leading to infinitely recursive calls.

Fixes https://github.com/libsdl-org/SDL/issues/9090
2024-02-20 01:23:18 +03:00
Sam Lantinga bb4ec5250f Added support for non-gamepad controllers to the GameInput driver 2024-02-17 22:32:44 -08:00
Sam Lantinga f63f99bd2d Setup to handle the guide button once we get an updated GameInput SDK 2024-02-17 21:55:10 -08:00
Sam Lantinga ae8a910781 Added infrastructure for reporting GameInput touchpads
PlayStation controllers don't seem to report touch info, so we'll need to figure out how to interpret the touch data once it's available.
2024-02-17 21:21:54 -08:00
Sam Lantinga ae4aa25082 Get the real GameInput device name if possible 2024-02-17 20:12:46 -08:00
Sam Lantinga 419aebebda Added infrastructure for reporting GameInput sensors
IGameInputReading::GetMotionState() isn't implemented yet, so we'll need to figure out how to interpret the motion data once it's available.
2024-02-17 20:12:46 -08:00
Sam Lantinga 85ac0381b7 IGameInputDevice::GetDeviceInfo() can never return a null pointer
The IGameInputDevice instance can't be internally instantiated without it, so it's always guaranteed to be present.
2024-02-17 20:12:14 -08:00
Sam Lantinga fbe4153214 The HIDAPI driver takes precedence over the GameInput driver
The HIDAPI driver has more functionality for supported controllers.
2024-02-17 19:13:04 -08:00
Sam Lantinga 4a59b17de2 Added infrastructure for querying battery status for GameInput 2024-02-17 19:09:29 -08:00
Sam Lantinga fd9a4eff9f Updated GameInput device info to match other joystick drivers 2024-02-17 17:52:48 -08:00
Sam Lantinga 8f0f14c312 Added automatic gamepad mapping for the GameInput driver 2024-02-17 17:42:32 -08:00
Sam Lantinga eb9a7d97f9 The GameInput driver handles Xbox controllers
Don't let the raw input driver handle them when GameInput is active
2024-02-17 17:42:23 -08:00
Sam Lantinga 698b7deaa2 Removed GAMEINPUT_JoystickEffectDataType_HapticFeedback
This refers to the HID Simple Haptics spec, which is currently only implemented by the Surface Dial accessory and WMR game controllers, which aren't currently exposed by the GameInput API.

We can add support for other effects in the future, but for now we don't need this or the SDL_gameinputjoystick_c.h header.
2024-02-17 16:33:45 -08:00
Sam Lantinga f35ede7281 Generalized the idea of joystick driver priority
Joystick drivers are sorted by priority in the driver list, and higher priority drivers report whether they are handling a device when lower priority drivers want to add it to their device list.

This has been handled ad-hoc with the Windows and HIDAPI drivers, but this formalizes the idea and makes sure that GameInput has the highest priority of the Windows drivers.
2024-02-17 16:06:07 -08:00
Robert Edmonds 7f33464bed opengles2: Call glClearColor() with r,g,b,a, not r,g,g,a 2024-02-17 14:11:59 -08:00
Sam Lantinga fee140bdfe Added the option for GameInput support to the Win32 SDL build
GameInput is designed to be used by Win32 C applications, so no need to restrict it to the GDK build.
2024-02-17 14:07:42 -08:00
Nikita Krapivin 534f753e20 GameInput backend for SDL (Gamepad-only for now) 2024-02-17 11:33:51 -08:00
Sam Lantinga 7ed1f3554d Define HAVE_LIBC for the platforms with a C library
Allow the Visual Studio project to define HAVE_LIBC=0 to enable building without a C runtime on Windows entirely through Visual Studio project changes.
2024-02-17 11:31:06 -08:00
Sam Lantinga ed615e92b7 Updated automated test now that getting an invalid property isn't an error 2024-02-17 09:30:50 -08:00
Sam Lantinga dc7baa415e Show the window after creating the renderer
This hides any window recreation that might need to be done by the OpenGL renderers
2024-02-17 09:21:30 -08:00
Sam Lantinga ff01d0b568 Fixed building without HAVE_LIBC on Windows
Fixes https://github.com/libsdl-org/SDL/issues/9064
2024-02-17 08:12:10 -08:00
Sam Lantinga 8ce786d2b6 Property query functions don't set an error if they return the default value
You can call SDL_HasProperty() if you want to check to see if a property exists.

Fixes https://github.com/libsdl-org/SDL/issues/9067
2024-02-17 07:59:04 -08:00
Sam Lantinga 202886f873 Make use of the HDR light range when playing HDR video 2024-02-16 20:05:11 -08:00
SDL Wiki Bot 317099b01f Sync SDL3 wiki -> header 2024-02-17 03:51:21 +00:00
Sam Lantinga cb38649490 Added SDL_PROP_DISPLAY_HDR_WHITE_LEVEL_FLOAT 2024-02-16 19:50:41 -08:00
Michał Janiszewski 631b05b211 Drop stray trailing whitespace for android-project 2024-02-16 09:22:23 -05:00
Ryan C. Gordon 6472e36264
x11: Minor cleanup in new mouse cursor selection code.
- Move legacy name choice to a separate function, so we can `return` a
  string in one line instead of assign a variable and `break` for each item.
- Have the case statement cover SDL_NUM_SYSTEM_CURSORS, and not `default`, so
  compiler will (maybe) warn us if an enum value is added but not included
  here.
- Only choose a legacy name if necessary.

(cherry picked from commit df00a7dd4c3deb03839e799187a3c75fc4e8854b)
2024-02-16 08:44:29 -05:00
Simon McVittie b986bc8be9 emscripten, wayland, x11: Share the table of CSS cursor names
As suggested in #8939.

This results in some minor changes for emscripten and x11. Both
previously mapped SIZEALL to "move", but "move" is not guaranteed to be
a four-pointed arrow: according to the CSS spec, it's actually intended
to be a drag-and-drop cursor, analogous to "alias" and "copy".
Map it to "all-scroll" instead, as in Wayland: while this is *also* not
semantically guaranteed to be a four-pointed arrow, it is at least
*suggested* to make it a four-pointed arrow.

Also, emscripten was previously using two-pointed arrows for resizing
(BOTTOMLEFT mapped to "nesw-resize", and so on). This commit changes
it to use the more specific "sw-resize" and so on, which might be
single-directional.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:43 -05:00
Simon McVittie 7dbd6669c3 wayland: Move calls to WAYLAND_wl_cursor_theme_get_cursor out of the switch
This will make it easier to potentially share the switch statement
between X11 and Wayland.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:43 -05:00
Simon McVittie 40a6c1c0a7 wayland: Use CSS/freedesktop cursor name "default" as a fallback
The "left_ptr" name is an X11 thing, and there's no guarantee that
Wayland cursor themes contain it. In particular, GNOME's Adwaita theme
as of version 46.beta only contains the CSS/freedesktop names.

To test, either move one of the known cursors out of the way, or edit
the switch statement above to use a wrong name for one of them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:43 -05:00
Simon McVittie 791646535a wayland: Reference CSS cursor name vocabulary
The freedesktop.org cursor spec recommends the same names as CSS, and
GNOME is treating the CSS vocabulary as canonical.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 07:52:43 -05:00
Ryan C. Gordon cb9565354c
x11: Use XcursorLibraryLoadCursor to load system cursors when available.
Apparently this is necessary on the latest Gnome to get properly themed
cursors, vs ancient X11 standard cursors, as Gnome has dropped the old
theme names that XCreateFontCursor eventually expected to find.

Fixes #8939.
2024-02-16 02:08:37 -05:00
Sam Lantinga d451fcd7a7 Fixed HDR video content being too bright on Apple platforms
This probably isn't the exact formula that we need, but it's much closer to correct.
2024-02-15 16:39:13 -08:00
Sam Lantinga c09daf8388 Removed unused variables 2024-02-15 14:11:04 -08:00
Ozkan Sezer 6efe5f30ed don't let SDL_render.c:render_drivers[] have an empty initializer list. 2024-02-15 20:55:04 +03:00
Ozkan Sezer aae2d22852 Check the SDL_VIDEO_RENDER_??? macros with #if instead of #ifdef
Allows users to disable them by defining them as 0.

Closes https://github.com/libsdl-org/SDL/issues/8996

(manual port of https://github.com/libsdl-org/SDL/pull/9063 to SDL3.0)
2024-02-15 20:55:02 +03:00
Ryan C. Gordon 8ddddd36cd
audio: Deal with race conditions against default device changes.
This catches the case where we obtain a logical device while the default is
changing in another thread, so you accidentally end up with the previous
default physical device locked and returned from ObtainLogicalAudioDevice.
2024-02-15 14:13:26 -05:00
Frank Praznik 4eae38580f cocoa: Remove resize hack when changing the window backing scale
Zeroing the window width and height was necessary in SDL2 to short-circuit the resize event deduplication code when the window backing scale changed, but not the logical size. This is no longer necessary in SDL3, as it will explicitly check for scale changes on resize events and dispatch pixel size/scale changed events as appropriate, even if the window's logical size hasn't changed.
2024-02-14 17:33:06 -05:00
Frank Praznik f9ba0e1dbd wayland: Don't store wl_output pointers in mode driver data
They aren't used for anything, and cause problems if the video core tries to free them.
2024-02-14 10:42:15 -05:00
Ryan C. Gordon 5e1d9d19a4
audio: Don't use SDL_BindAudioStream inside SDL_OpenAudioDeviceStream().
It has a lot of complex validation and locking we want to avoid here.
2024-02-13 15:23:27 -05:00
Sam Lantinga 5e6ae85b63 Update the draggable state when the hit test callback changes
Fixes https://github.com/libsdl-org/SDL/issues/7617
2024-02-13 09:26:39 -08:00
SDL Wiki Bot 4d4c24acdd Sync SDL3 wiki -> header 2024-02-13 17:07:23 +00:00
Ryan C. Gordon bc984f78bf android: Remove blocking permission request code. Async only in SDL3!
(this actually still blocks at our internal points of usage, though, for
replacement at a later time.)
2024-02-13 12:06:51 -05:00
Ryan C. Gordon af61cfd5e0 android: Added SDL_AndroidRequestPermissionAsync. 2024-02-13 12:06:51 -05:00
Frank Praznik 310f21bf84 video: Ensure that all references to a destroyed fullscreen window are removed
Windowing systems that receive fullscreen state changes asynchronously may not receive a configure event notifying SDL that the window has left fullscreen when the window is being destroyed. Ensure that no display holds a reference to a destroyed fullscreen window.
2024-02-13 09:56:07 -05:00