Commit Graph

11462 Commits

Author SHA1 Message Date
Sam Lantinga 23828b62d4 Added SDL_IsMainThread() and SDL_RunOnMainThread() 2024-12-05 13:53:51 -08:00
Sam Lantinga fffa6c7a2b Add missing include of fcntl.h
Fixes https://github.com/libsdl-org/SDL/issues/11590
2024-12-05 13:45:17 -08:00
Sam Lantinga 235e5c6a6c Fixed crash if a device doesn't have a USB product or manufacturer string
This happens with the Razer Huntsman V3 Pro Tenkeyless keyboard
2024-12-05 10:42:02 -08:00
Ryan C. Gordon 9784e10a75
audio: Let emscripten update device->sample_frames at device open time.
Fixes #11435.
2024-12-04 19:16:28 -05:00
Ozkan Sezer 5bfece34f9 ran gendynapi.pl after PR/11170. 2024-12-05 02:28:50 +03:00
Semphris a4852f3a10 SDL_ShowFileDialogWithProperties with more options 2024-12-04 15:10:15 -08:00
Lucas Murray dc5a2ddfd0 GPU: Forward D3D12 validation warnings to the SDL log 2024-12-04 14:34:43 -08:00
Lucas Murray efb59bd0bf GPU: Fix validation warning in D3D12 blit code 2024-12-04 12:35:36 -08:00
Caleb Cornett 45869d6177
GPU: Vulkan requires drawIndirectFirstInstance feature (#11583) 2024-12-04 15:05:35 -05:00
Caleb Cornett d8eb68a6c5 GPU: Clean up D3D12 blit shader compilation 2024-12-04 14:56:36 -05:00
Frank Praznik 24ed947cc3
kmsdrm: Fix an LTO type mismatch warning
Include SDL_kmsdrmopengles.h before SDL_kmsdrmvulkan.h, as the Vulkan header can pull in Wayland headers, which pull in EGL headers with EGL types defined as Wayland types, which causes warnings when building with strict-aliasing and LTO.
2024-12-04 12:34:02 -05:00
Frank Praznik 31128b6cdd
kmsdrm: Clean up GLES function definitions
Several functions were redundantly declared in both in the general subsystem header and the GLES header, and some signatures didn't match in both locations.

Move them all to the GLES header, as the definitions are in the GLES source file.
2024-12-04 12:34:02 -05:00
numzero 123306b18c X11: support _NET_WM_SYNC_REQUEST 2024-12-04 11:59:46 -05:00
expikr d320d7143d
Fix rawmouse wrong timestamp (#11553)
Currently, the rawinput thread incorrectly spreads the timestamps over idle time if the poll interval is less than 100ms, and abruptly switches to lumping all accumulated inputs to happen simultaneously if it exceeds 100ms.

This means that any game which implements retroactive event handling based on timestamps will jarringly snap between the two polar opposite extremes of incorrect behaviour.

This PR replaces the arbitrary 100ms threshold with logic based on measuring the idle start and end time.

If the thread idled for more than 125000 nanoseconds, it is considered to have not had any input in its queue before it entered idle, and the events are spread over the interval between thread wake-up and pump finish, with the final input aligned to the pump finish time.

If the thread idled for less than 125000 nanoseconds, it is considered to have events entered at some point between last pump finish and thread entering sleep, and the events are spread over the full pump-to-pump interval.
2024-12-03 20:40:34 -08:00
Ozkan Sezer 830b132cd4 SDL_asyncio_liburing.c: replace __kernel_time64_t use with SDL's Sint64 2024-12-03 23:39:11 -05:00
Ozkan Sezer 4ac78706bf SDL_asyncio_liburing.c: replace size_t casts on pointers with intptr_t 2024-12-03 23:39:11 -05:00
Sam Lantinga 1377cdb3f2 Fix the Indonesian language code on Android 2024-12-03 15:04:29 -08:00
Ryan C. Gordon 46f43c2e6e asyncio: Remove `SDL_AsyncIOTask` from the public API. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon 4745aa3324 asyncio: Windows IoRing support, other tweaks and fixes. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon 3ca629ceb5 asyncio: Allow file closes to request a flush/fsyncdata. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon 022a6a9f97 asyncio: Added Linux io_uring support. 2024-12-03 17:32:20 -05:00
Ryan C. Gordon e79ce2a200 asyncio: Added async i/o APIs. 2024-12-03 17:32:20 -05:00
Sam Lantinga 6aab5a089d Fixed potential buffer overflow 2024-12-03 08:33:51 -08:00
Ryan C. Gordon 65c9a58f5e
audio: Make sure a few bitflag checks convert to bools correctly.
This might just be defensive coding, but better safe than sorry on this.
2024-12-03 11:04:52 -05:00
Anonymous Maarten ec2ef5f9b5 dynapi: order headers for reproducible behavior 2024-12-02 18:25:48 +01:00
Frank Praznik 2762644e96 video: Don't error when setting an unbounded max window size while a minimum is set
If the maximum size was changed to 0 (unbounded) while a minimum was set, the sanity check ensuring that the max size isn't less than the minimum size would incorrectly cause the operation to error out.
2024-12-02 09:55:19 -05:00
Ryan C. Gordon ce573b01f8 audio: Added SDL_IsAudioDevicePhysical and SDL_IsAudioDevicePlayback.
Fixes #11529.
2024-11-29 17:31:37 -05:00
Ryan C. Gordon f5ad66ef4b audio: Allow channel maps to specify -1 to mute a channel.
Fixes #11373.
2024-11-28 00:00:30 -05:00
Ryan C. Gordon f852038384 filesystem: Added SDL_GetCurrentDirectory().
Fixes #11531.
2024-11-27 23:42:11 -05:00
Ivan Epifanov b8233aff8e Vita: implement mousewheel and buttons 4/5 2024-11-27 08:23:16 -08:00
Frank Praznik bbc9c75618
x11: Fix memory leaks in clipboard event handler
XGetWindowProperty and XGetAtomName return data which must be freed by the client, and was being leaked.
2024-11-26 10:54:59 -05:00
Caleb Cornett 5c8bed3780 GPU: Fix D3D12 tearing query 2024-11-25 22:33:48 -05:00
expikr d55e6dfc5e hint for which system cursor to use as default
Co-Authored-By: Sam Lantinga <slouken@libsdl.org>
2024-11-25 13:08:37 -08:00
Susko3 e0e61775b8 Add missing SDL_WindowFlags to SDL_test_common.c
This fixes some flags not printing in testwm.c
2024-11-25 10:56:16 -08:00
Sam Lantinga 6fab61b69d hidapi: check each usage on a device before ignoring it completely 2024-11-25 10:49:05 -08:00
Sam Lantinga c508396e33 Avoid usage of CreateEventEx in WASAPI code
This also uses FALSE as parameters consistently for CreateEvent()
2024-11-24 17:49:17 -08:00
Starbuck5 7a3f5ef129 Speed up full-surface fills 2024-11-24 17:44:00 -08:00
Anonymous Maarten 88926f2b73 emscripten: send drag and drop events 2024-11-24 13:22:46 -05:00
Clownacy 79f6f766d4
Avoid usage of `CreateEventEx` in D3D12 GPU backend
Unavailable in Windows XP.
2024-11-24 01:02:06 +00:00
Ryan C. Gordon 465881d560 android: patched to compile. 2024-11-22 15:01:09 -05:00
Ryan C. Gordon c135386f58 events: Add render category to SDL_EventCategory. 2024-11-22 15:01:09 -05:00
Ryan C. Gordon 615c935d11 events: Added SDL_RenderEvent.
Fixes #11465.
2024-11-22 15:01:09 -05:00
Wouter Wijsman 3a2b595c4f PSP: Add locale support 2024-11-22 08:37:14 -08:00
Frank Praznik df73cae2b0 cocoa: Clear the pending flags on non-spaces fullscreen transitions
Transitions to or from a non-spaces fullscreen state are synchronous, so clear both the enter and leave pending flags when changing the state.
2024-11-21 11:47:21 -05:00
Sam Lantinga 5ee4d176f1 Added support for the Razer Wolverine V3 Pro 2024-11-21 05:51:57 -08:00
Marcin Serwin 587384756f render: use nearest pixel scaling for debug text
The debug text font is less legible when scaled linearly.
2024-11-20 18:06:53 -08:00
Ryan C. Gordon 2b744c7df3
cocoa: Refuse to SDL_Init(SDL_INIT_VIDEO) from background thread.
Fixes #11437.
Reference PR #11502.
2024-11-20 20:22:36 -05:00
Sam Lantinga 932bb968d7 Fixed infinite recursion when the microphone is unavailable 2024-11-20 16:07:43 -08:00
Sam Lantinga 1413848f41 Fixed crash if a window ends up without a display 2024-11-20 13:27:43 -08:00
Sam Lantinga 35e6c92c3c Added the ROG Ally X to the list of Xbox controllers
This prevents Steam from opening the DirectInput versions of this controller that are added by installing Zenless Zone Zero.
2024-11-20 12:09:30 -08:00
Frank Praznik aa352837d5 cocoa: Don't sync on a pending fullscreen event if the window is miniaturized
The fullscreen event will be processed after deminiaturization is complete. Fixes a delay when restoring a miniaturized window that will return to fullscreen.
2024-11-19 16:53:31 -05:00
Frank Praznik 18b7a2315c cocoa: Restore fullscreen state on the window regaining key status
Ensure that fullscreen state is restored if a non-minimized fullscreen window regains key status. This can happen if a fullscreen window was requested to minimize on loss of key status, but the minimization didn't actually occur.
2024-11-19 12:10:31 -05:00
Frank Praznik 014196d98d cocoa: Fix minimizing fullscreen windows on Sequoia
Sequoia seems to require that the window briefly be made key when minimizing it after coming out of fullscreen.
2024-11-19 12:10:31 -05:00
Sam Lantinga 7a074f582e Steam Controller handling improvements
* Only handle the controller interfaces on a Steam Controller and wireless dongle
* Wait until we get the connected status when initializing a wireless dongle
2024-11-18 21:36:23 -08:00
Sam Lantinga 0c53d9a1ee Implemented SendEffect for Steam Controllers 2024-11-18 18:26:07 -08:00
Sam Lantinga d8f8cf3e99 Added SDL_HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED 2024-11-18 14:50:37 -08:00
Sam Lantinga 184da780f5 Fixed a crash when unplugging a Steam Controller dongle 2024-11-18 12:13:42 -08:00
Frank Praznik 70fe38bcb2
wayland: Rename some display related variables to better reflect their purpose
Use the 'logical' prefix for the logical width and height, and clarify that the physical dimensions reflect the width/height in millimeters.
2024-11-18 11:39:27 -05:00
Sam Lantinga e027b85cc4 Validate that pixel formats have the correct attributes
Also added a test to save and load as BMP format to make sure pixel transformations are working correctly.

Fixes https://github.com/libsdl-org/SDL/issues/11483
2024-11-17 11:58:57 -08:00
Ozkan Sezer 0f9e551d71 joystick/gdk/SDL_gameinputjoystick.c: fix build errors due to -Wformat 2024-11-17 00:45:02 +03:00
Sam Lantinga af6ce629c4 Make sure pairing remains enabled for the entire time dongle pairing is active 2024-11-16 13:42:12 -08:00
Sam Lantinga 2b10a040ff Fixed rare case of wireless Steam Controller not being detected at startup 2024-11-16 13:10:02 -08:00
expikr e9f7a1b359 fix relative system scale function on Windows
source: https://web.archive.org/web/20161202223814/https://ihme.org/~orbik/random_stuff/donewmouseaccel.png
Co-Authored-By: Sam Lantinga <slouken@libsdl.org>
2024-11-15 16:00:19 -08:00
expikr 25390d6c21 fix relative warp emulation broken by #11460 2024-11-15 15:58:09 -08:00
Cameron Gutman e0166256ff joystick: Fix connection type for Steam Controller and Xbox 360 dongles 2024-11-15 17:54:14 -06:00
Sam Lantinga 8657fa8b3b Improved reliability of the Steam Controller driver 2024-11-15 15:55:13 -08:00
expikr f8468d580d add brace for contitional
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2024-11-15 10:20:17 -08:00
expikr eaef956a9a fix errenous delta when warping
The following changes do not alter any logic:
- rename x/ydelta fields to x/y_accu to better reflect what it actually is about
- coalesce the logic for modifying internal state to one spot, branch based on whether the input was a move or a warp

The following changes alter the logic:
- put the x/y_accu addition under the relative branch only, warps should not add to the accumulation buffer by any definition
- (MAIN FIX) when the destination window desires relative mode, warp events should be dropped if SDL_MOUSE_RELATIVE_WARP_MOTION is false, or have x/yrel set to zero if true
2024-11-15 10:20:17 -08:00
Sam Lantinga b54f6044a5 Removed Linux Steam Controller support
The HIDAPI driver has all the functionality we need on Linux
2024-11-15 08:53:40 -08:00
Sam Lantinga b43b333d25 Moved the GPU renderer to the bottom of the list
We've gotten the feedback we wanted from having it first, so we'll move the other renderers back up for the widest compatibility across devices and platforms.

Fixes https://github.com/libsdl-org/SDL/issues/11468
2024-11-15 08:32:49 -08:00
Sam Lantinga b71151a697 Added support for pairing controllers to the Steam Controller dongle 2024-11-14 20:04:31 -08:00
Sam Lantinga f0b61c69e7 Fixed duplicate controllers showing up on the Steam Controller wireless dongle 2024-11-14 14:19:16 -08:00
Sam Lantinga fe3566ca46 Ignore Steam Controllers in the Linux driver if HIDAPI is handling them 2024-11-14 11:20:52 -08:00
Sam Lantinga 7959b08a4d Fixed spacing 2024-11-14 09:25:57 -08:00
Sam Lantinga 0f9505256d Steam Controller support defaults off on mobile platforms
These platforms require prompting for Bluetooth permissions, so don't enable this by default.
2024-11-14 09:05:16 -08:00
Sam Lantinga 140aba9e5d Enable Steam Controller support by default
It now handles both wired and wireless controllers and Steam will set SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES for Steam Controllers if it's handling them.
2024-11-14 08:18:03 -08:00
Cameron Gutman 68c2cf84f6 hidapi: Add support for the Steam Controller wireless dongle 2024-11-14 06:57:22 -08:00
Cameron Gutman 1a311bc638 hidapi: Add support for Steam controllers connected via USB 2024-11-14 06:57:22 -08:00
Cameron Gutman e67ae274a5 hidapi: Fix bus type in HIDAPI_IGNORE_DEVICE() on Linux
This bug prevented the Steam Controller's keyboard and mouse
interfaces from being properly ignored by the HIDAPI joystick
driver on Linux.
2024-11-13 22:06:37 -06:00
Ryan C. Gordon 7007b4762b
events: Fix a compiler warning.
Fixes #11410.
2024-11-13 20:03:21 -05:00
Sam Lantinga 9a4ae4b9ed Fixed crash if SDL_GetVideoDisplayForWindow() returns NULL 2024-11-13 10:45:01 -08:00
cosmonaut 5a74aadac9 GPU: Null check shader inputs in CreateGPUGraphicsPipeline 2024-11-12 14:31:13 -08:00
Ryan C. Gordon 32cc92dceb
pipewire: i/o callbacks should avoid higher-level iteration during device open.
Sometimes these callbacks will fire while we're still waiting on state to
settle down in PIPEWIRE_OpenDevice, which means we're holding the device lock,
but then the i/o callback will fire from a background thread and also try to
grab the device lock, but can't, because PIPEWIRE_OpenDevice is holding it and
waiting for this i/o callback to finish...hence, a deadlock.

So now, if the device is still opening, output callbacks will write silence
and input callbacks will just flush the buffer, without calling the main
iterate function, and thus avoid obtaining the lock.
2024-11-12 15:18:41 -05:00
Evan Hemsley 119b4fa5f5
GPU: Remove D3D11 backend and allow D3D12 to ingest DXBC (#11456) 2024-11-12 10:55:21 -08:00
Andrei Alexeyev 332fd824f0
GPU Vulkan: release submitted command buffer after defrag (#11430) 2024-11-08 09:40:26 -08:00
Sam Lantinga 54ff1f35bd Fixed audio dropouts when plenty of audio is queued on Android 2024-11-07 19:29:51 -08:00
Sam Lantinga 37b49c98dc Fixed setting up surround sound on NVIDIA Shield TV 2024-11-07 19:05:29 -08:00
Semphris 3e2ef64c98 Add SDL_SaveFile and SDL_SaveFile_IO functions 2024-11-07 17:55:02 -08:00
Sam Lantinga 97dac37373 Added SDL_HINT_ANDROID_LOW_LATENCY_AUDIO 2024-11-07 16:34:34 -08:00
Sam Lantinga 6836ef8fd2 Added logging for low latency audio state 2024-11-07 16:31:35 -08:00
Sam Lantinga 908bd84c5e Fixed reopening a controller on Android 2024-11-07 15:36:32 -08:00
Sam Lantinga 908b42f2b9 Fixed 8BitDo M30 mapping to match fighting game conventions and the layout in XInput mode 2024-11-05 11:43:28 -08:00
Sam Lantinga 028194286c Added mappings for the various firmware versions of the 8BitDo SN30 Pro controller
Fixes https://github.com/libsdl-org/SDL/issues/9460
2024-11-05 11:43:28 -08:00
Sam Lantinga ed943318e2 Support multiple joystick buttons bound to the same gamepad button 2024-11-05 11:43:28 -08:00
Sam Lantinga 27b828754a Use HIDAPI to provide better names for DirectInput controllers
Fixes https://github.com/libsdl-org/SDL/issues/10207
2024-11-05 11:43:28 -08:00
Sam Lantinga 5a7b75607a Added the OpenVR license to openvr_capi.h
License taken from https://github.com/ValveSoftware/openvr/blob/master/LICENSE
2024-11-04 13:32:59 -08:00
Sam Lantinga c1246e31a4 Added support for the PowerA OPS v1 and v3 Pro wireless controllers 2024-11-04 12:05:57 -08:00
Sam Lantinga d3b882b4f9 Added support for the PowerA Fusion Pro 4 and Fusion Pro Wireless controllers 2024-11-04 10:48:50 -08:00
Petar Popovic 96729e745a SDL_GetClosestFullscreenDisplayMode(): Rename parameter `mode` to `closest`
Also: Check, if the parameter is NULL inside the function.
2024-11-03 21:03:44 -08:00
Sam Lantinga 683991ab71 Get the full display bounds if the window doesn't fit in the usable bounds. 2024-11-03 20:58:18 -08:00
Sam Lantinga 6823e3f005 Fixed gaps in scaled 9-grid texture rendering 2024-11-03 20:47:45 -08:00
Frank Praznik 458f616c53
wayland: Send a display removed event when a display is disconnected
An event would be dispatched if a display was dynamically added after initialization, but not if one was removed.
2024-11-03 12:43:47 -05:00
Petar Popovic 73e0e8cf5b SDL_GetDisplayForPoint(), SDL_GetDisplayForRect(): Check argument for NULL. 2024-11-03 07:55:07 -08:00
Sam Lantinga 8026866994 wayland: fixed memory leak at shutdown 2024-11-02 22:56:03 -07:00
Sam Lantinga 7031b240df Added SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER 2024-11-02 22:22:29 -07:00
Sam Lantinga 87dade4421 Set SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER for the GPU renderer
Fixes https://github.com/libsdl-org/SDL/issues/11393
2024-11-01 18:38:42 -07:00
Sam Lantinga 927d297161 Updated to version 3.1.7 for development 2024-11-01 15:49:31 -07:00
Sam Lantinga 78cc5c1734 Updated to version 3.1.6 for the preview release 2024-11-01 14:27:01 -07:00
Sam Lantinga c5f12b135d Fixed the D-pad on wireless Xbox 360 controllers 2024-11-01 09:02:55 -07:00
Sam Lantinga 8b48b70c6e Fixed return value setting state on combined Joy-Con controllers 2024-10-31 20:37:23 -07:00
expikr e2857fc5a2 Update SDL_mouse.c 2024-10-30 12:01:51 -07:00
Maia 5699ba799e Add return to CHECK_VULKAN_ERROR_AND_RETURN macro 2024-10-30 11:52:42 -07:00
Sam Lantinga 09495059df Fixed the PS5 controller face buttons on Amazon Fire TV, Android 11 2024-10-30 05:23:00 -07:00
Sam Lantinga c099d0525e sort_controllers.py: fixed parsing SDL_PRIVATE_GAMEPAD_DEFINITIONS 2024-10-30 05:21:59 -07:00
M. P. Halpin 24bdbb8bf4 Supress Metal warning when compiling against macOS 10.11-10.13 2024-10-29 20:03:18 -07:00
Sam Lantinga 51628034d9 Don't offset the view if there's no text input rect
Otherwise this will shift the entire view upwards, which probably isn't what you want.
2024-10-29 16:42:16 -07:00
Sam Lantinga c8a04eec06 Autorelease keys should go down when pressed. 2024-10-29 16:24:40 -07:00
Evan Hemsley b4dff42dcd
GPU: Add SDL_CancelGPUCommandBuffer (#11316)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-10-29 14:43:22 -07:00
cosmonaut 014b473bcc GPU D3D12: Fix depth texture sampling 2024-10-29 12:05:35 -07:00
cosmonaut ff14a1781f GPU D3D12: Fix indirect buffers not being refcounted 2024-10-29 10:34:54 -07:00
d-musique 35e53f76a9
metal: check success of device creation (#11367)
When macOS runs under a virtual environment, it is possible that
MTLCreateSystemDefaultDevice() does not succeed.
Not checking this failure results in a crash down the road.
This change allows to skip GPU renderer and use an adequate fallback.

Co-authored-by: D.musique <d-musique@users.noreply.github.com>
2024-10-29 12:35:13 -04:00
Caleb Cornett 54836050c9 metal: Add availability checks 2024-10-29 08:13:51 -07:00
Frank Praznik 8f9a562969
wayland: Remove vestigial struct member 2024-10-29 10:51:18 -04:00
Frank Praznik 36c209080c wayland: Refactor some shell surface related names 2024-10-28 14:30:08 -04:00
Frank Praznik 2b7dc55364 wayland: Check the WM capabilities before sending a minimize event
Wayland gives no feedback to windows regarding whether a minimize request was successful, so we would universally send the minimize event and assume that the request succeeded.

Check the window manager capabilities, if available, for whether window minimization is supported, and don't send the minimized event in the case that it is unsupported.
2024-10-28 14:30:08 -04:00
Frank Praznik 1abbd13414 wayland: Throttle interactive user resize events
Excessive resize events generated during interactive window resizing can cause applications to lag, severely in some cases. Throttle interactive resize events to once per frame callback interval.
2024-10-28 14:30:08 -04:00
Petar Popovic cb0c7c9680 SDL_CreateDirectory(): directory tree creation for absolute paths for non-Windows platforms 2024-10-28 01:56:48 -04:00
Petar Popovic a10578acbd SDL_SYS_RenamePath(): Fix error message. 2024-10-27 16:54:13 -07:00
Petar Popovic 8468c372b2 SDL_EnumerateDirectory(): (posix) Fix return value when directory is invalid 2024-10-25 22:52:56 -07:00
Dan Ginsburg 4f160d69a6 Closes #10318 - implement Android prerotation in the Vulkan renderer 2024-10-25 14:21:29 -07:00
Ozkan Sezer 93471cf78d video/openvr: minor clean-up:
- make all of function pointers static
- make EGLint context_attribs[] static
- comment out unused function pointer ov_wglGetCurrentContext
- remove unused SDL_DisplayMode openvr_dm_default
- move SDL_VideoDisplay openvr_vd_default to OPENVR_VideoInit()
  context and eliminate its C99 initializers
- replace atoi() calls with SDL_atoi()
- replace atof() calls with SDL_atof()
2024-10-25 23:20:24 +03:00
Ryan C. Gordon 344546b4ea cocoa: Make sure GL context destruction happens on the main thread.
Fixes #10900.
2024-10-24 16:27:58 -04:00
Ryan C. Gordon 8d3bec99a7
audio: Make SDL_GetAudioStreamProperties() thread safe. 2024-10-24 14:37:23 -04:00
Frank Praznik 731853077a
Send drop complete events when the drop leaves the window on Cocoa, Wayland, and X11
This is already done on win32, however, other platforms were left in a state of limbo if a drop operation began, then never completed due to the drop leaving the window.
2024-10-24 13:36:24 -04:00
Ryan C. Gordon 4ea26a7771
emscripten: scale mousewheel X coordinates correctly, not just Y coordinates.
Fixes #10454.
2024-10-23 23:35:02 -04:00
Ryan C. Gordon 7108291d0b video: Change SDL_GLattr to SDL_GLAttr. 2024-10-23 18:50:52 -04:00
Frank Praznik 924f719b97
wayland: Get the window content scale from the backend
The window content scale may change independently of the display it is on if scaling or accessibility features are involved, so query it directly from the backend instead of inferring it.
2024-10-23 15:49:26 -04:00
kyle-sylvestre 22bc430bbb Set error using function hresult 2024-10-23 10:53:46 -07:00
Sam Lantinga 6eca02a0e7 evdev: correctly handle composite devices
These can be both mouse and keyboard and should be initialized and exposed to the application as both.
2024-10-23 10:52:50 -07:00
Sam Lantinga ba1412cb9f evdev: fixed devices not being removed on disconnect 2024-10-23 10:52:00 -07:00
Evan Hemsley 423337796c
GPU Vulkan: Use dedicated allocation for download buffers (#11298) 2024-10-23 09:37:06 -07:00
Ivan Epifanov 1f8b9a320c VITA: fix SDL_ShowMessageBox by using different memory type 2024-10-22 12:19:33 -07:00
Anonymous Maarten 0bec18245d android: fix android.content.Context:getCacheDir JNI prototype 2024-10-22 18:03:34 +02:00
Ryan C. Gordon e61f0678ee
x11: Remove the "safety net" error handler.
This is an X11 error catcher that lived for the entire life of the program,
which causes problems in itself, but it also tries to make calls into Xlib,
which would cause further panics.

It's goal was to reset video modes if the app was going down, but it often
failed to do so, and caused potentially avoidable crashes instead.

Fixes #7975.
2024-10-22 10:41:30 -04:00
Sam Lantinga c56af0d975 Removed unused code 2024-10-21 17:26:14 -07:00
Sam Lantinga 35be8bb7f9 Fixed warning C4456: declaration of 'e' hides previous local declaration
This also fixes incorrect interpretation of OPENVR_SetupJoystckBasedOnLoadedActionManifest() return value.
2024-10-21 15:53:47 -07:00
Emmanuele Bassi 8119568805 x11: Remove text-scaling-factor setting checks
The text-scaling-factor setting is not useful, now that we watch the
Xft/DPI and Gdk/WindowScalingFactor XSETTINGS keys; on the contrary, it
is problematic in mixed environments with both the KDE and GNOME
portals, as they end up stepping on each other's toes, and we end up
with the wrong scaling factor value.

Fixes: https://github.com/libsdl-org/SDL/issues/11142
2024-10-21 15:26:22 -07:00
Sam Lantinga 1c51b8dc33 Only set the OpenGL flag if the OpenVR driver is active 2024-10-21 15:22:56 -07:00
Sam Lantinga 82b3325978 Fixed memory leaks if Windows initialization fails 2024-10-21 15:22:56 -07:00
Sam Lantinga d199586683 Fixed memory leaks if OpenVR initialization fails 2024-10-21 15:22:56 -07:00
Sam Lantinga 0aea14cf45 Added logging for additional events 2024-10-21 14:23:29 -07:00
Sam Lantinga 3d47877bb4 Added SDL_EVENT_RENDER_DEVICE_LOST
This is sent when the device is lost and can't be recovered.

Also fixed the vulkan renderer so it returns errors appropriately and will log and break if debug mode is enabled.
2024-10-21 13:28:40 -07:00
Sam Lantinga 26567df878 Don't treat mouse buttons as focus clicks if the window has mouse capture
This fixes the following sequence:
* Press mouse button down
* Alt-tab away from the window
* Alt-tab back to the window
* Release mouse button

Fixes https://github.com/libsdl-org/SDL/issues/7747
2024-10-21 09:46:07 -07:00
Ryan C. Gordon ef758d05c1
render: GetRenderViewportSize shouldn't use scale, just logical presentation.
Fixes #11076.
2024-10-21 11:17:16 -04:00
Sam Lantinga 92520c1d9b Improved D3D12 handling of unrecoverable device loss 2024-10-21 00:38:42 -07:00
Sam Lantinga 315842cf71 Fixed crashes handling D3D11/12 device lost in testsprite
You can test this using "dxcap -forcetdr"
2024-10-21 00:29:18 -07:00
Sam Lantinga e2254b1045 Added color scale info for the GPU renderer TODO item 2024-10-20 18:38:02 -07:00
mausimus a6536a9298 RI_KEY_BREAK indicates key is up 2024-10-20 10:26:07 -07:00
rhett-lee e0321ca5b6
SDL3: SDL_render_gl(render name: opengl) dose not support transparent on Linux/X11 (Bug #11273) (#11274)
SDL3: SDL_render_gl(render name: opengl) dose not support transparent on Linux/X11:

Create SDL window with SDL_WINDOW_TRANSPARENT flag;
Create "opengl" renderer for the window;
The window can't shown with errors:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 130 (MIT-SHM)
Minor opcode of failed request: 3 (X_ShmPutImage)
Bug reason:
SDL_x11window.c:490 : bool X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props)
SDL_x11window.c:566 : vinfo = X11_GL_GetVisual(_this, display, screen, transparent);[XVisualInfo *vinfo]
the X11_GL_GetVisual function returns a vinfo dose not support transparent.

Fix:
SDL_x11opengl.c:637 : XVisualInfo *X11_GL_GetVisual(SDL_VideoDevice *_this, Display *display, int screen, bool transparent)
X11_GL_GetVisual should returns a vinfo support transparent when transparent is true.
2024-10-19 20:21:50 -07:00
Sam Lantinga dcbb2f11a8 Clamp the texture alpha and color modulation values to 0-255 2024-10-19 20:18:57 -07:00
Cameron Cawley 40070d899d Refactor Blit_RGB555_ARGB1555 to be more generic 2024-10-19 11:11:22 -07:00
Ozkan Sezer 3d2c8c510d add GLES3 headers from Khronos for OpenVR video driver. 2024-10-19 10:23:55 -07:00
Sam Lantinga 153f90a725 Revert "Use the correct return type for SDL_GetAndroidJNIEnv()"
This reverts commit 2d3fa03d53.

Different JDK implementations define JNIEnv differently for C++, so we can't provide the definition here.

Fixes:
/usr/lib/jvm/temurin-11-jdk-amd64/include/jni.h:195:17: error: conflicting declaration ‘typedef struct JNIEnv_ JNIEnv’
/home/runner/work/sdlwiki/sdlwiki/.github/../external/SDL3/include/SDL3/SDL_system.h:266:24: note: previous declaration as ‘typedef struct _JNIEnv JNIEnv’
2024-10-19 10:20:50 -07:00
Sam Lantinga ffb1d9e4b4 Removed Blit2101010toN and BlitNto2101010
10-bit RGB formats are typically used with the PQ colorspace, which is handled by SDL_Blit_Slow.

Fixes https://github.com/libsdl-org/SDL/issues/11271
2024-10-19 10:07:53 -07:00
华仔 5c1ccaefae Fixed VULKAN_UpdateViewport judgment. 2024-10-19 09:51:12 -07:00
Frank Praznik 4c2d0c422b
wayland: Remove kde_output_order_v1 support
This protocol is unstable and not intended for clients, and SDL now sorts the display list into a stable order and selects a primary display suitable for games on its own, so it isn't necessary.

Reverts e71e16950a
2024-10-19 11:16:30 -04:00
Ryan C. Gordon b6a6a4a7f8
audio: fix incorrect dynCall in Emscripten audio.
This only seemed to cause problems with `-s ASYNCIFY` on the build command
line, but it was incorrect in general.

Fixes #11258.
2024-10-18 23:53:40 -04:00
Sam Lantinga 07bb8f1c4c openvr: added APIENTRY for OpenGL functions (thanks @cnlohr!) 2024-10-18 16:40:36 -07:00
Sam Lantinga b40ad5428b Fixed assertion at quit when the debug text was the last texture used. 2024-10-18 14:51:40 -07:00
Sam Lantinga 1d23d2c3c2 Renamed SDL_SANDBOX_UNKNOWN to SDL_SANDBOX_UNKNOWN_CONTAINER 2024-10-18 12:45:07 -07:00
Frank Praznik a7da3ad59b x11: Support sorting displays via the priority hint
Store the connector name for displays and use it for sorting them according to priority, if the hint is set.
2024-10-18 13:09:08 -04:00
Frank Praznik 0faf9dc4a4 kmsdrm: Support sorting displays via the priority hint
Use the connector name for displays and sort them according to priority, if the hint is set.
2024-10-18 13:09:08 -04:00
Ozkan Sezer a6e5ab437f video/openvr: Avoid type redefinition errors.
Also, let SDL handle stdint.h and stdbool.h.
2024-10-18 19:21:32 +03:00
Sam Lantinga e81e917c5e Added an OpenVR video driver (thanks @cnlohr!) 2024-10-17 19:38:04 -07:00
Ozkan Sezer 569691797d windows/SDL_systhread.c: fix permissions 2024-10-18 05:00:04 +03:00
Sasha Szpakowski 186c6e5c9d windows: fix race condition with exception-based thread naming. 2024-10-17 18:42:01 -07:00
Sam Lantinga faa404a652 If we get a newline character, treat it as SDLK_RETURN
Fixes https://github.com/libsdl-org/SDL/issues/10679
2024-10-17 18:18:38 -07:00
Sam Lantinga a432abf4cc Make sure that we quit if we get a terminating event
This covers the case where the application didn't handle the quit or terminating event, we still need the main loop to finish.
2024-10-17 17:19:49 -07:00
Sam Lantinga c5e1ae4580 Only free debug_char_texture_atlas if it has been allocated
Fixes https://github.com/libsdl-org/SDL/issues/11254
2024-10-17 17:19:49 -07:00
Sam Lantinga 00f4cb308b Fixed crash if the Vulkan renderer changes swapchain image count 2024-10-17 17:19:49 -07:00
Sam Lantinga 41366f73b2 Don't block in Android USB device open
We might be waiting a long time for a permissions dialog, so let that complete asynchronously. While that's happening, we'll remove the device from the device list so that when we get permission the application sees the device as newly available and can open it again.

Fixes https://github.com/libsdl-org/SDL/issues/6347
2024-10-17 12:02:24 -07:00
Sam Lantinga 60c3eaf5ee Use SDL_GetAndroidJNIEnv() in hid.cpp 2024-10-17 12:02:24 -07:00
Sam Lantinga 2d3fa03d53 Use the correct return type for SDL_GetAndroidJNIEnv()
This prevents application code from having to cast to JNIEnv everywhere.
2024-10-17 12:02:24 -07:00
Sam Lantinga 3d852da806 Requesting Bluetooth permission on Android is now asynchronous
This fixes an ANR at startup if gamepad input comes in while prompting for Bluetooth permissions.

Fixes https://github.com/libsdl-org/SDL/issues/6347
2024-10-17 12:02:24 -07:00
Sam Lantinga be3d961b47 Treat clicking the right pad as a thumbstick click on a Steam Controller 2024-10-17 12:02:24 -07:00
Ivan Epifanov 6da4d94abf VITA: implement camera subsystem 2024-10-17 10:24:17 -07:00
Ivan Epifanov f79f21217b VITA: fix yuv texture update 2024-10-17 07:53:26 -07:00
Ozkan Sezer 4612db21a3 SDL_utils.c: restrict gethostname() usage to non-windows
Reference issue: https://github.com/libsdl-org/SDL/issues/11228.
2024-10-17 12:47:02 +03:00
Sam Lantinga c41b2bb855 SDL_ShouldIgnoreGamepad() should take product IDs rather than a guid.
This lets us early out when scanning for new hardware more quickly.
2024-10-16 16:47:29 -07:00
Sam Lantinga 8a30def5f2 Only use Steam Virtual Gamepads if we're running under Steam
Fixes https://github.com/libsdl-org/SDL/issues/11214
Fixes https://github.com/libsdl-org/SDL/issues/11215
2024-10-16 16:47:29 -07:00
Sam Lantinga 28504f5791 Steam virtual gamepad info isn't available in the macOS sandbox 2024-10-16 16:47:29 -07:00
Sam Lantinga d6981da5a4 Added SDL_GetSandbox()
This adds support for detecting whether you're running in a sandbox on macOS
2024-10-16 16:47:29 -07:00
Sam Lantinga d7b1ba1bfc Added support for the Steam Virtual Gamepad on macOS Sequoia 2024-10-16 16:47:29 -07:00
Sam Lantinga a027ec59ca Make the name of the Steam Deck Controller consistent.
It will be named "Steam Deck Controller" regardless of whether you're running under Steam.
2024-10-16 08:23:29 -07:00
Sylvain 09e3af58b5 Fixed bug #10954: software renderer: examples/renderer/10-geometry missing a triangle
typo when changing return code from int to bool
2024-10-16 16:48:05 +02:00
Ivan Epifanov 860e38a3a2 VITA: fix shader color format 2024-10-16 07:43:14 -07:00
Sam Lantinga cbbad4051b Treat a button press location as an implicit mouse move
This fixes having the incorrect location for mouse button presses on Steam Deck under gamescope. This works around a bug where the mouse motion appears to come at the next button press, and comes from the xwayland-pointer device instead of the xwayland-relative-pointer device which is delivering mouse button events.
2024-10-15 22:30:38 -07:00
Kyle Sylvestre e5fa929245
Report win32 last error string windows_file_open (#11224) 2024-10-15 19:47:06 -07:00
Sam Lantinga 97f1da73da Rename GPU properties for consistency 2024-10-15 15:36:26 -07:00
Caleb Cornett 9af5ffcfbe
Improve support for private platforms (#11220) 2024-10-15 18:02:07 -04:00
Frank Praznik 66d09a1cda
wayland: Adjust primary display selection priority
Portrait displays are typically used as secondaries and almost certainly not what a user wants a game or movie initially becoming full screen on if a landscape display is available. Increase the priority of selecting a landscape display over a portrait display.
2024-10-15 15:59:31 -04:00
Frank Praznik 553fc5fe0e wayland: Expose displays in a deterministic order, and attempt to better handle selecting a primary display.
Wayland can expose displays in any arbitrary order, and doesn't have the native concept of a primary display. However, there are games that presume that the first listed display is the primary, which can lead to problems if that output isn't necessarily the ideal one, as they may use that display to build a resolution list or as the default fullscreen output. This sorts displays by position, then attempts to find the primary display, first by querying the explicit ordering hint, then the GNOME DBus property, then tries to determine the 'best' display according to the criteria that is generally ideal for games and media playback.

The makes the list of displays deterministic, as long as the desktop configuration remains static, with a reasonably appropriate one prioritized as primary, even if there is no explicit way to retrieve the primary display. In the case where a user has a particularly esoteric physical display configuration, the new hint enables explicitly overriding the sorting and selection logic, allowing the entire display order to be customized, if necessary.
2024-10-15 13:52:35 -04:00
Caleb Cornett cdaaabb978 GPU: Fix Metal sampler address mode order 2024-10-15 10:46:04 -04:00
Sam Lantinga afee27a530 Make sure stdio handles are in blocking mode
Standard I/O doesn't work well with non-blocking handles, so make sure any pipes are in blocking mode before launching child processes.

Fixes https://github.com/libsdl-org/SDL/issues/10998
2024-10-14 22:10:49 -07:00
Sam Lantinga bb764e3106 Added support for full range BT.709 YUV conversion
Also added simple colorspace testing to testyuv.
2024-10-14 20:36:46 -07:00
Zack Middleton edb28e79b5 Make SDL_LoadBMP() use true instead of 1 2024-10-14 20:07:03 -07:00
Zack Middleton 51dc978785 Don't overwrite the SDL_IOFromFile() error in SDL_LoadFile() 2024-10-14 20:07:03 -07:00
Zack Middleton fb43dc3097 Set error for NULL SDL_IOStream in SDL_LoadWAV_IO() 2024-10-14 20:07:03 -07:00
cosmonaut 00bb81de76 GPU: Allow size queries on depth formats 2024-10-14 14:28:21 -07:00
cosmonaut 57f2577c65 GPU Vulkan: Fix depth-only framebuffer leak 2024-10-14 10:19:07 -07:00
Ozkan Sezer 9fac4b9f5f SDL_windowsmodes.c: Fix MSVC builds against SDKs older than 10.0.17134.0
workaround the missing DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL enum value
and DISPLAYCONFIG_SDR_WHITE_LEVEL struct.

Fixes: https://github.com/libsdl-org/SDL/issues/11193
Closes:  https://github.com/libsdl-org/SDL/pull/11205
2024-10-14 09:04:25 -07:00
Sam Lantinga f9d490045b Fixed uikit crash when GLES is disabled
Fixes https://github.com/libsdl-org/SDL/issues/11208
2024-10-14 08:58:02 -07:00
Ryan C. Gordon c20918b0fb render: Add SDL_RenderDebugText().
Fixes #11201.
2024-10-14 02:45:33 -04:00
Sam Lantinga 1cc85c912b Check return value of SDL_small_alloc()
Fixes https://github.com/libsdl-org/SDL/issues/8959
2024-10-13 14:07:26 -07:00
Sam Lantinga d7be7fc168 Fixed Cohen-Sutherland out code computation for float line intersection
Fixes https://github.com/libsdl-org/SDL/issues/10866
2024-10-13 13:04:59 -07:00
Sam Lantinga a8ca024495 Added SDL_GetDefaultLogOutputFunction()
Fixes https://github.com/libsdl-org/SDL/issues/10603
Closes https://github.com/libsdl-org/SDL/pull/11106
2024-10-13 12:14:46 -07:00
Sam Lantinga b766c824bd Don't overwrite the SDL_IOFromFile() error in SDL_LoadBMP()
Fixes https://github.com/libsdl-org/SDL/issues/11188
2024-10-13 09:37:44 -07:00
Sam Lantinga a567786762 Added SDL_SetErrorV() 2024-10-13 09:26:25 -07:00
capehill 1a1e2e9892 Set size parameter in SDL_GetClipboardData()
Update size value in case where platform uses GetClipboardText().
This should fix clipboard_testClipboardDataFunctions on those platforms.
2024-10-13 08:59:50 -07:00
Evan Hemsley 82598e5ca9
GPU Vulkan: Fix frame counter timing (#11189) 2024-10-12 22:02:22 -07:00
Anonymous Maarten b641c2a0db Refactor gendynapi.py with the final goal to make it re-usable 2024-10-13 02:52:56 +02:00
Anonymous Maarten 173c168ff4 Default functions are already declared by the first SDL_dynapi_procs.h include 2024-10-13 02:52:56 +02:00
Cameron Cawley fd9e57b71e 3DS: Support simple message boxes 2024-10-12 16:07:52 -07:00
Rusty Moyher 7556c44796
SDL3: Fixed Cocoa_GL_CreateContext() not returning a context on success (#11181) 2024-10-12 14:01:21 -07:00
Cameron Cawley fec006a4f9 Allow for more fine tuning of Duff's device routines 2024-10-12 11:16:46 -07:00
Cameron Cawley aebb64efa1 Remove leftover ARM SIMD code 2024-10-12 11:13:37 -07:00
Daniel Gibson 9a81892447 Old env vars as fallback for SDL_VIDEO_DRIVER + SDL_AUDIO_DRIVER #11115
especially SDL_VIDEODRIVER is commonly used to use the native Wayland
backend, so I think it's a good idea to keep supporting the old name
instead of forcing users to find out that they now have to add an
underscore..
Not sure how popular SDL_AUDIODRIVER is, but with all the audio backends
that exist on Linux alone I'm sure some people use it to work around
sound issues.

Note: Doing this in the SDL_hints implementation instead of the
call-sites of SDL_GetHint(SDL_HINT_VIDEO_DRIVER) etc ensures that
1. Hint priorities work (env var overriding hint set by application with normal
   priority, but not when application used SDL_HINT_OVERRIDE)
2. SDL_ResetHint() (called by user code) respects the fallback
   environment variable
2024-10-12 08:47:02 -07:00
Cameron Cawley 3e57d996fe Reduce the size of the SDL_blit_0 alpha code 2024-10-12 08:29:11 -07:00
rhett-lee 22566506d0 SDL3: opengles2 render not support window with transparent flag on Linux/X11 (#11167) 2024-10-11 21:59:56 -07:00
Sam Lantinga c6c195ff88 Always use WaitForSingleObjectEx() as a fallback in SDL_SYS_DelayNS()
That logic isn't specific to the Visual Studio build environment. Also switched it to use CreateEvent(), which works back to Windows XP.
2024-10-11 21:18:31 -07:00
Sam Lantinga c5904d8710 Improved implementation of SDL_DelayPrecise() (thanks @nightmareci!)
Fixes https://github.com/libsdl-org/SDL/issues/10592
2024-10-11 21:18:31 -07:00
Sam Lantinga 25251a9405 Fixed warning C4723: potential divide by 0 2024-10-11 19:31:22 -07:00
Sam Lantinga 3cd7e22e8b Fixed converting full range YUV to RGB
Updated from https://kdashg.github.io/misc/colors/from-coeffs.html

I'm not sure where the other formulas came from, but they weren't mathematically correct and resulted in slightly incorrect colors.
2024-10-11 18:12:05 -07:00
Evan Hemsley 6ea4a66451
GPU: Add SDL_CalculateGPUTextureFormatSize (#11146)
---------

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2024-10-10 16:34:38 -07:00
Caleb Cornett 3db10a6b2c
GPU: ASTC block size fixes (#11157) 2024-10-10 15:40:21 -07:00
Ryan C. Gordon 90a3a2359b thread: Rewrote generic Condition Variables.
This replaces the internal mutex with a semaphore, so we're only using a
single synchronization primitive to implement this, and cleans up some logic
around wait timeouts.

This now matches the logic of the originally cited work, from BeOS.

Fixes #3639.

(I think.)
2024-10-10 15:03:53 -04:00
Sam Lantinga 73b995fbad Don't assume OpenGL on Android
This prevents Vulkan from initializing by default.

Fixes https://github.com/libsdl-org/SDL/issues/10279
2024-10-10 10:53:31 -07:00
Ozkan Sezer 7ff819141d libm/e_exp.c: fix gcc warning on 32 bit:
src/libm/e_exp.c:105: warning: integer constant is too large for 'long' type
2024-10-10 18:23:20 +03:00
Sam Lantinga 4b7c5f561b Fixed warning: ‘new_item.probe_len’ may be used uninitialized in this function 2024-10-10 08:06:18 -07:00
Sam Lantinga c8f5f6d47a Added SDL_DelayPrecise()
SDL_DelayNS() now passes through to the high precision OS delay function, and SDL_DelayPrecise() tries to busy wait to get as close as possible to the desired wait time.

Fixes https://github.com/libsdl-org/SDL/issues/11141
2024-10-10 08:06:18 -07:00
David Gow 9c322386bf gpu: vulkan: Fix an uninitialised structure in SDL_BlitGPUTexture()
The SDL_GPUColorTargetInfo structure needs to be zeroed, as otherwise we
can end up trying to create a resolve_texture which doesn't exist,
causing a rather difficult-to-debug segfault when calling
SDL_BlitGPUTexture() with a load op of SDL_GPU_LOADOP_CLEAR.
2024-10-10 07:16:02 -07:00
Evan Hemsley da5a1585cd
GPU: Avoid calling SDL_GetWindowSizeInPixels when possible (#11139) 2024-10-09 18:59:07 -07:00
Sam Lantinga 9023a199dd Fixed crash in RLE colorkey blitting
Fixes Maelstrom running over sdl2-compat with SDL3
2024-10-09 12:11:21 -07:00
Sam Lantinga f946f87f30 Don't rely on event.buttonMask being set in touchesEnded
Fixes https://github.com/libsdl-org/SDL/issues/11131
2024-10-09 11:35:39 -07:00
Sam Lantinga ee9b6204cf Updated to version 3.1.5 for development
We should bump the version immediately before and after release so the release version corresponds to a fixed snapshot of code.
2024-10-09 11:02:01 -07:00
Sam Lantinga f8eac30276 Added SDL_StepBackUTF8() 2024-10-09 09:49:10 -07:00
Sam Lantinga 1f08a03794 Switched drag-n-drop logging to trace level
The logging is extremely verbose and covers the entire data exchange process, which is more suited to the trace level.
2024-10-09 07:35:21 -07:00
Daniel Ludwig 5b6342a00d Default SDL_HINT_JOYSTICK_GAMEINPUT to "1" on GDK platforms 2024-10-09 07:30:13 -07:00
Daniel Ludwig acb18e05b5 GPU: fix swapchain buffer size not set on Xbox 2024-10-09 07:30:13 -07:00
Sam Lantinga ff834f7733 Removed the restrict keyword
It doesn't compile with older Visual Studio and I verified on godbolt.org that the way it was used here doesn't impact code generation at all.
2024-10-08 20:48:13 -07:00
Delta 8e6ead2f7b
[GPU] Added ASTC texture format support (#11116) 2024-10-08 18:45:04 -04:00
Ryan C. Gordon 02434cd293
emscripten: Fixes for data addresses above 2gb
This includes both wasm64 and wasm32 when addressing more than 2gb of memory.

Fixes: #9052

(Manually cherry-picked from 3deb07ea395373204462130c1e062bc1f71fe060.)
2024-10-08 17:41:18 -04:00
Ryan C. Gordon cba77834f2
init: Log '<unspecified>' not '(null)' if the app name isn't set.
Reference PR #11103.
2024-10-08 14:30:55 -04:00
Simon McVittie fb8244d6d9 init: Also log the SDL revision here
This includes the version number, unless the developer is doing
something strange with git tags.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-08 14:29:02 -04:00
Simon McVittie c24f7d2453 Log app ID as SYSTEM/INFO during initialization
This is not shown by default, but will be shown when using
SDL_LOGGING=system=info or higher, where it will hopefully nudge app
authors towards initializing this information.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-08 14:29:02 -04:00
Sam Lantinga e7ee92e822 Switched drag-n-drop logging to trace level
The logging is extremely verbose and covers the entire data exchange process, which is more suited to the trace level.
2024-10-08 10:56:27 -07:00
Sam Lantinga 2000ccb541 Allow linear interpolation of the font textures
With the recent changes to logical presentation, this is necessary for the font to look good when scaled.

Fixes https://github.com/libsdl-org/SDL/issues/11123
2024-10-07 21:43:57 -07:00
Sam Lantinga 4627283eca Allow building both Cocoa and dummy dialog implementations
This allows us to remove platformFilters from the Xcode project, which is not supported in Xcode 12.
2024-10-07 18:01:39 -07:00
Sam Lantinga 81b48de3f5 Fixed VID/PID list parsing of SDL_HINT_GAMECONTROLLER_SENSOR_FUSION
Fixes https://github.com/libsdl-org/SDL/issues/11118
2024-10-07 16:14:57 -07:00
Sam Lantinga 5db64300b8 Fixed SDL_GetStringInteger() for values starting with '0' and '1' (thanks @DanielGibson!) 2024-10-07 15:53:38 -07:00
Sam Lantinga 7da728a642 Added support for wired XBox controllers on macOS 15.0 Sequoia
Fixes https://github.com/libsdl-org/SDL/issues/11002
2024-10-07 15:44:42 -07:00
Ryan C. Gordon aa534c3ac3
core: Fixed incorrect comment in core/windows/SDL_windows.h. 2024-10-07 16:55:30 -04:00
rabbit-ecl 6ae5666acf
Check for VK_SUBOPTIMAL_KHR also in vkQueuePresentKHR (#11113)
This is already handled for vkAcquireNextImageKHR.
2024-10-07 13:01:10 -07:00
Sam Lantinga 06bd214af6 Fixed warnings building on Android 2024-10-07 11:11:27 -07:00
Sam Lantinga 65539bc4f7 Make sure trackpad state is updated when button presses are delivered
Fixes https://github.com/libsdl-org/SDL/issues/11085
2024-10-06 14:28:06 -07:00
Sam Lantinga 03b259893a Fixed return value of SDL_AddGamepadMapping()
Fixes https://github.com/libsdl-org/SDL/issues/11095
2024-10-06 14:20:30 -07:00
Jan Sedivy c2b98e21ba macOS: Add hint for smooth SDL_EVENT_MOUSE_WHEEL values 2024-10-06 12:36:42 -07:00
Frank Praznik 2fa8acb084 x11: Refresh the global cursor coordinates when confining the pointer
XGrabPointer can warp the cursor into the window when confining, so set the flag to refresh the global coordinates when queried.
2024-10-06 14:48:24 -04:00
David Fort e00b1fdd67 clipboard: include mime types in SDL_ClipboarUpdate
This patch modifies the clipboard handling so that when we receive an external
clipboard update, the suppported mime types are included in the SDL_ClipboarUpdate
event. The patch also introduces the owner field that allows to know if the update
is because we own the clipboard (internal update) or if it was an external update.
2024-10-05 18:19:10 -07:00
bubbleguuum 2880b40e33 fix pipewire prototype 2024-10-05 18:16:12 -07:00
zshoals 1ca45c5891 Fix typo: DiretMedia->DirectMedia 2024-10-05 00:08:01 -04:00
Sam Lantinga 00385951a1 Use file descriptor I/O for process pipes
Use low level non-blocking I/O for process pipe streams. This may fix issues with data not getting through the pipe occasionally.

Related: https://github.com/libsdl-org/SDL/issues/11006
2024-10-04 12:24:17 -07:00
Sam Lantinga 6c64c62114 Rename SDL_BUTTON() to SDL_BUTTON_MASK()
Fixes https://github.com/libsdl-org/SDL/issues/11056
2024-10-04 09:13:59 -07:00
Sam Lantinga fe2880fcda Rename SDL_SetThreadPriority() to SDL_SetCurrentThreadPriority()
Fixes https://github.com/libsdl-org/SDL/issues/11055
2024-10-04 08:57:03 -07:00
Daniel Ludwig 69196ab30d Change evasive library handle to `SDL_SharedObject*` 2024-10-04 05:18:40 -04:00
Ryan C. Gordon 3a6a3ab64f
gpu: Fix memory leak in Vulkan backend. 2024-10-04 04:46:28 -04:00
Sam Lantinga 43e7ce7dfc Updated to version 3.1.3 for the preview release 2024-10-03 23:01:55 -07:00
Ryan C. Gordon 9a5d5a2839 video: Improve the EGL attribute callbacks.
Now it has access to information it needs and it's clear who is reponsible
for memory management.

Fixes #11039.
2024-10-03 22:52:52 -07:00
Petar Popovic d4143e02d1 Always set checked_monotonic_time when calling CheckMonotonicTime() 2024-10-03 17:11:34 -07:00
Petar Popovic 020fb6889c Removed unnecessary const-qualifiers in src and test files 2024-10-03 17:39:08 -04:00
Petar Popovic b8e8dcaa9a Add void to openbsd function prototypes 2024-10-03 13:55:21 -07:00
Petar Popovic 0e909d2785 Removed redundant condition in src/events/SDL_pen.c 2024-10-03 13:42:18 -07:00
Ryan C. Gordon 191f3ecbbc render: Restore previous policy for converting window/render coordinates.
Before this commit, it would adjust for the logical presentation settings.
Now, it works as it did before the logical presentation render target was
removed: it takes current viewport and scale into account, as well.

Fixes #10978.
2024-10-03 16:31:56 -04:00
Petar Popovic 3246df8bd3 Remove redundant SDL_Vulkan_GetResultString() declaration 2024-10-03 13:29:53 -07:00
Ethan Lee a0de6c4abf Add properties to SDL_IOStreams returned by IOFromMem 2024-10-02 22:09:09 -07:00
Petar Popovic f4cea5e019 Removed const qualifiers from SDL_CreateHashTable() parameter types 2024-10-02 16:29:49 -07:00
Ryan C. Gordon d287feaddf
render: Remove non-pointer args' const qualifiers on SDL_RenderTextureRotated.
Reference Issue #11032.
2024-10-02 15:31:20 -04:00
Ryan C. Gordon 8b4f5f09c1
dynapi: It's a Python script now, not a perl script.
Fixes #11032.
2024-10-02 15:27:47 -04:00
Sam Lantinga 47450425fd Allow iterating just the keys or values in a hashtable 2024-10-02 10:20:00 -07:00
Sam Lantinga d5fe6dd627 Don't use const for non-pointer API parameters 2024-10-02 09:17:31 -04:00
Sam Lantinga eced9f58a9 Added a userdata parameter for EGL attribute callbacks
Fixes https://github.com/libsdl-org/SDL/issues/11013
2024-10-01 11:45:19 -07:00
Sam Lantinga 4fa92d233d Include stdbool.h when using Visual Studio 2017+
Also cleaned up some incorrect return values from bool functions.
2024-10-01 09:57:59 -07:00
Sam Lantinga 3b3c4a79b6 Don't close file descriptors already handled by AddFileDescriptorCloseActions()
Fixes https://github.com/libsdl-org/SDL/issues/10997
2024-10-01 09:32:14 -07:00
Anthony 5f5379dc99
Add `SDL_IsTV()` (#11004)
Moved SDL_IsAndroidTV() out of public API, to match SDL_IsAndroidTablet().

Added SDL_IsTV(), to mirror existing SDL_IsTablet().
2024-10-01 09:20:00 -07:00
Ryan C. Gordon 0b5e01a305 loadso: library handles are now `SDL_SharedObject*` instead of `void*`.
Improved the SDL_loadso.h documentation a little, too.

Fixes #11009.
2024-10-01 12:16:10 -04:00
Sam Lantinga 3234a3b902 Simplified internal SDL_Surface structure 2024-10-01 08:10:04 -07:00
Sam Lantinga 1f3a0d12e6 Made texture size and format public in the API
Also added refcount to textures so they can be retained by application code.
2024-10-01 08:10:04 -07:00
Ryan C. Gordon 5136b30652
render: SDL_ConvertEventToRenderCoordinates() now handles pen events.
Reference Issue #10863.
2024-10-01 10:30:36 -04:00
Ozkan Sezer 13c5d1092f hidapi: update hid_write() for windows from mainstream.
Returns bytes_written if WriteFile returns synchronously
Relevant mainstream discussions:
	https://github.com/libusb/hidapi/pull/697
	https://github.com/libusb/hidapi/issues/695
2024-09-30 19:49:44 -07:00
cosmonaut 3eab599977 just force the barrier on UpdateTexture actually 2024-09-30 19:47:27 -07:00
cosmonaut e17741a6cb Render GPU: Only cycle on update if entire texture is replaced 2024-09-30 19:47:27 -07:00
Sam Lantinga 45ad763de5 Disable backface culling and use a constant rectangle winding order.
This makes it so we don't have to surface the rectangle winding order for applications that want to use the raw geometry API.
2024-09-30 19:12:02 -07:00
cosmonaut fa14b53273 GPU Vulkan: Clear up some swapchain edge cases 2024-09-30 15:10:27 -07:00
David Fort 818d7d892a x11: store all atoms in a specific struct 2024-09-30 11:13:08 -07:00
David Fort 801870c8cf video: cache some more atoms under X11
This patch adds the caching of some atoms used by the clipboard.
2024-09-30 11:13:08 -07:00
Evan Hemsley afdf325fb4
GPU: Add swapchain dimension out params (#11003) 2024-09-30 10:23:19 -07:00
Anonymous Maarten b3388d5753 Haiku does not have fdatasync, but has fsync
https://dev.haiku-os.org/ticket/17378
2024-09-30 15:10:03 +02:00
Sam Lantinga 0b64520997 hashtable: fixed unused-parameter warnings
These show up with -Wextra when dropped into other projects.
2024-09-29 23:56:43 -07:00
Ryan C. Gordon 1787d6ca5c main: SDL_AppQuit() now reports the result value.
Fixes #10994.
2024-09-29 23:24:04 -04:00
Ryan C. Gordon 6a7f8b74f1
filesystem: SDL_GlobDirectory shouldn't strip final '/' if the path is "/".
This is common on Emscripten, where the base directory is "/".
2024-09-29 23:09:04 -04:00
Anonymous Maarten f6055432c8 Fix null-pointer dereference on failing SDL_SYS_CreateProcess 2024-09-30 03:03:33 +02:00
Anonymous Maarten e9bfa5bf6a Mitigate BatBadBut vulnerability 2024-09-30 03:03:33 +02:00
RT2 06e122103c Fix window opacity update 2024-09-29 14:08:09 -07:00
Sam Lantinga c84d825241 Added SDL_HashPointer() and SDL_KeyMatchPointer() 2024-09-29 10:59:18 -07:00
Frank Praznik d0c9c008e1
wayland: Use high-DPI system cursors on non-DPI aware windows
Using an unscaled buffer just results in the compositor scaling up the low-res cursor image for output, resulting in it appearing blurry. Always use the scaled cursor to ensure that it appears sharp and matches the native system look.
2024-09-29 13:27:46 -04:00
Ozkan Sezer 5f304b3a47 Fix builed error after commit 0e45b824e3 due to -Wunused-variable 2024-09-29 15:40:02 +03:00
Sam Lantinga 0e45b824e3 renderer: always update the output pixel size at startup
Fixes https://github.com/libsdl-org/SDL/issues/10990
2024-09-29 05:22:28 -07:00
Sam Lantinga 2825a682f0 Fixed build errors 2024-09-29 04:42:19 -07:00
Andrei Alexeyev ba7b346e52 hashtable: reimplement as open-addressed robin hood hashtable
This is mostly ported from Taisei Project
2024-09-29 04:11:14 -07:00
Evan Hemsley fc242abbd2
GPU: recreate swapchain on window pixel size change event (#10985) 2024-09-28 18:09:56 -07:00
Evan Hemsley 66f6b40c92
Render GPU: Don't call GetWindowSizeInPixels during RenderPreset (#10984) 2024-09-28 18:01:16 -07:00
Sam Lantinga a923771978 Added SDL_murmur3_32() 2024-09-28 17:19:01 -07:00
Sam Lantinga 039148fb0e Updated check for stdbool.h
If you're building in a C99 or newer environment, we'll automatically include stdbool.h.

If you're building in a C89 or C90 environment, we'll assume that stdbool.h isn't available and define bool as an unsigned char. If you have a working stdbool.h and want SDL to use it, you can either include stdbool.h before SDL headers, or define SDL_INCLUDE_STDBOOL_H in your project.

Closes https://github.com/libsdl-org/SDL/pull/10980
2024-09-28 16:55:09 -07:00
Frank Praznik 7ca0e9ede1
wayland: Scale the pointer destination size relative to the theme size
This better matches compositor behavior and avoids slight size jumps when the cursor enters and leaves the window.
2024-09-28 14:32:10 -04:00
Frank Praznik d2094bd0a2
wayland: Don't query the cursor info with DBus if the cursor shape protocol is present
If the cursor shape protocol is supported, the compositor will handle cursor themes and sizes automatically, so querying the properties with DBus serves no purpose as the values are never used.
2024-09-28 12:18:58 -04:00
Ryan C. Gordon 7d21a49c9c filesystem: SDL_EnumerateDirectoryCallback uses an enum now, not an int.
Fixes #10955.
2024-09-28 01:33:40 -04:00
Ryan C. Gordon 55bd9f5311 iostream: flush() should attempt to sync file data to physical media. 2024-09-27 20:20:51 -04:00
Ethan Lee 0852307b58 gpu: Check Vulkan device features for IsDeviceSuitable 2024-09-27 19:58:30 -04:00
cosmonaut fb165a542b GPU Vulkan: add resolve info to framebuffer and render pass lookups 2024-09-27 15:57:57 -07:00
Ryan C. Gordon 4a296f1bde filesystem: Fixed memory leak on Windows. 2024-09-27 18:54:18 -04:00
Ryan C. Gordon 428f2f35be filesystem: SDL_CreateDirectory should make parent directories.
Fixes #10502.
2024-09-27 18:54:18 -04:00
Ryan C. Gordon 94030131de filesystem: Windows SDL_SYS_CreateDirectory should succeed if dir exists. 2024-09-27 18:54:18 -04:00
Sam Lantinga 3f446d8fb5 Minor cleanup 2024-09-27 14:10:46 -07:00
Ozkan Sezer 1088ea55fa SDL_gpu_d3d11.c: define D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD for old toolchains 2024-09-27 23:55:02 +03:00
cosmonaut de40d6bae0 GPU Metal: Set texture to NULL even if AcquireSwapchainTexture fails 2024-09-27 13:49:26 -07:00
David Fort f32e96f5e2 clipboard: add SDL_ClipboardMimeTypes
This function allows to retrieve the available mime types without doing any
synthesizing.
2024-09-27 13:38:40 -07:00
cosmonaut eedd2039f9 GPU: 32-bit component texture formats 2024-09-27 16:26:43 -04:00
Evan Hemsley 05d0656bd6
GPU: Simultaneous compute pass read-write (#10965) 2024-09-27 12:49:37 -07:00
Sam Lantinga d39acc6d1e Fixed warning C4702: unreachable code 2024-09-27 11:19:54 -07:00
Caleb Cornett 5ff6e8d522
GPU: Add enable_depth_clip to RasterizerState (#10964) 2024-09-27 11:18:54 -05:00
Daniel Ludwig e98cf3c870 Fix Xbox builds 2024-09-27 08:10:03 -07:00
Evan Hemsley be401dd1e3
GPU: More robust error reporting (#10958)
---------

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-09-27 00:30:18 -07:00
Sam Lantinga 48e213b4cd Fixed SDL_ShouldQuit() returning false during status transitions
We should wait for the state to stabilize before SDL_ShouldQuit() returns.

For example:
Thread A initializes and increments a use refcount
Thread B skips initializing and increments the use refcount
Thread B starts cleaning up and checks the use refcount
Thread A starts cleaning up, returns because SDL_ShouldQuit() returns false (not initialized), not touching the use refcount
Thread B returns because the use refcount isn't zero

Now we have the state where the refcount is greater than one and both thread A and B have attempted to cleanup.

With this change:
Thread A initializes and increments a use refcount
Thread B skips initializing and increments the use refcount
Thread B starts cleaning up and decrements and checks the use refcount
Thread A starts cleaning up, waits for thread B
Thread B returns because the use refcount isn't zero
Thread A continues and decrements and checks the use refcount, and finishes cleaning up because it has reached 0.
2024-09-26 18:08:58 -07:00
Ryan C. Gordon d8c76d2f34
filesystem: POSIX SDL_SYS_CopyFile shouldn't use a temp file.
Fixes #10957.
2024-09-26 19:34:34 -04:00
Ryan C. Gordon f267ec7681
filesystem: Improve docs, make some promises about overwrites and file caches.
Note that SDL_FlushIO() doesn't make promises about file data sync but that
is intended to be changed in the IOStream code in a later commit.

Fixes #10886.
2024-09-26 19:29:03 -04:00
Sam Lantinga 125e592844 Added SDL_ShouldInit() and SDL_ShouldQuit()
These are handy functions to support thread-safe initialization and shutdown.
2024-09-26 16:26:12 -07:00
Ryan C. Gordon 38f971bac5
filesystem: SDL_SYS_EnumerateDirectory() now returns bool. 2024-09-26 16:35:15 -04:00
Frank Praznik 671a33c2f7 wayland: Raise all touches on a cancel event 2024-09-26 14:45:10 -04:00
Petar Popovic 457d0edeaf Remove some extra semicolons 2024-09-26 20:01:56 +03:00
Sam Lantinga 345d9bfe19 A zero source rect is valid for blitting
A zero sized source rect draws pixels sourced from a 0x0 region on the source surface.

Fixes https://github.com/libsdl-org/SDL/issues/8580
2024-09-25 22:36:55 -07:00
Sam Lantinga 1aea43846e Don't use BlitARGBto555PixelAlpha() for SDL_PIXELFORMAT_ARGB1555
This didn't properly take into account destination alpha.

Fixes https://github.com/libsdl-org/SDL/issues/8401
2024-09-25 21:54:05 -07:00
Sam Lantinga d9a7da4fac Optimized SDL_HasEvent() and SDL_HasEvents()
Also document the counting behavior of SDL_PEEKEVENT.

Fixes https://github.com/libsdl-org/SDL/issues/6209
2024-09-25 21:20:00 -07:00
Ryan C. Gordon 3abb213083
opengl: Fixed SDL_RENDERCMD_SETDRAWCOLOR code checking the wrong variable. 2024-09-25 23:14:32 -04:00
Ryan C. Gordon 961cd51611
opengl: Removed a FIXME (this is documented as not-thread-safe now. 2024-09-25 23:14:32 -04:00
Anonymous Maarten 76f28ea120 Fix stdlib usage 2024-09-25 23:59:35 +02:00
Ryan C. Gordon 4c48ff51f8 render: SDL_RenderPresent now behaves when a render target is currently set.
It'll temporarily unbind it, draw letterboxing if necessary, present, and
then rebind the previous render target.
2024-09-25 16:26:36 -04:00
Ryan C. Gordon 7a6a0becb8 render: Fixed a FIXME for SDL_SetRenderViewport with a negative size. 2024-09-25 16:26:36 -04:00
Ryan C. Gordon 54459def69 render: Remove the logical presentation render target.
Now we render directly to the window, scaling as appropriate. This fixes some
concerns the render target introduced, like the quality of the final scaled
output, how to step outside of the logical size temporarily to draw some
things sharply at the native resolution, and loss of sub-pixel precision.

Fixes #8736.
2024-09-25 16:26:36 -04:00
Ryan C. Gordon bf7a48cdcc render/gpu: Change some memcpy calls to SDL_memcpy. 2024-09-25 16:26:36 -04:00
cosmonaut 925e47a077 GPU: Fix backwards LogError and SetError calls 2024-09-25 12:47:40 -07:00
cosmonaut 557c6dfb18 GPU: call SDL_SetError where appropriate 2024-09-25 10:47:14 -07:00
Cameron Gutman 6ec8b1a173 Throttle tickle reports to PS4/PS5 controllers
UpdateDevice() can be called at an arbitrary rate, so we need to
pace ourselves to avoid filling up the rumble queue with these.
2024-09-25 07:20:35 -07:00
Anthony 53bf2baac3 Change JNI calls to comply with recent Boolean changes
Android OpenURL and Toast methods return Booleans now, so let's use the correct interface.
2024-09-24 14:45:24 -07:00
Frank Praznik ad3a4c677b
wayland: Clean up cursor scaling
Handle named and custom cursor scaling in a cleaner manner, and account for edge cases where named cursor sizes may not exactly match the required size.
2024-09-24 11:46:56 -04:00
Cameron Gutman 57418475ce kmsdrm: Keep fd around if we can drop master
Modern kernels (v5.8+) allow non-root usage of drmDropMaster(), so
we can hold on to our fd after dropping master on it. This fixes
populating drm_fd in the KMSDRM SysWMinfo when using Vulkan.

Also add a missing error check for open() while we're here
2024-09-24 12:55:02 +03:00
Cameron Gutman 13f88df190 kmsdrm: Fix KMSDRM_Vulkan_CreateSurface() return value 2024-09-23 23:33:15 -05:00
Cameron Gutman 8f55f48337 kmsdrm: Move property initialization a bit further down
KMSDRM_GBMInit() must be called first to set drm_fd and gbm_dev.
2024-09-23 23:00:14 -05:00
Petar Popovic 004ac40226 Fix warning: no function prototype 2024-09-23 10:03:18 -07:00
Ethan Lee 4a3faf20ac gpu: Replace high-level logs with SetError 2024-09-23 10:57:10 -04:00
mausimus 0685b96469 GPU: fix build when SDL_GPU_DISABLED is set 2024-09-23 08:09:17 -04:00
Caleb Cornett 97d1056e16
GPU: MSAA fixes (#10917) 2024-09-21 17:38:10 -05:00
Evan Hemsley 89c6bc5f50
Prefer Vulkan even on Windows (#10912) 2024-09-20 13:42:15 -07:00
Evan Hemsley 980b4ff6db
GPU: Vulkan descriptor management rewrite (#10910) 2024-09-20 12:55:39 -07:00
Frank Praznik fcb8a2c016
wayland: Fix animated cursor timing
Adjust the frame timing so it will still advance if the frame callback fires faster than the frame duration.
2024-09-20 14:19:28 -04:00
Sam Lantinga ea2e2e451d Better fix for initializing Android environment variables 2024-09-20 11:09:48 -07:00
Sam Lantinga 095fb5f522 Fixed infinite recursion at startup on Android 2024-09-20 10:56:02 -07:00
T3hD0gg 594edb6bd2 Add Thrustmaster TMX VID & PID to wheel device list. 2024-09-18 22:19:54 -07:00
Sam Lantinga 34c6011360 Fixed Windows build 2024-09-18 14:55:51 -07:00
Sam Lantinga d29a0e3f31 Fixed warning: no previous prototype for function 2024-09-18 14:34:14 -07:00
Sam Lantinga 398dff7c25 Added support for the HORI licensed Steam Controller 2024-09-18 14:08:32 -07:00
Sam Lantinga 481203c074 Fixed Xcode warnings 2024-09-18 13:20:53 -07:00
Sam Lantinga 95c3ee77c1 Removed testing code 2024-09-18 11:12:06 -07:00
Simon McVittie 23f855a970 render: Integrate fix-shaders.sh into build-shaders.sh
By writing the fxc and dxc output to a temporary file and then
converting that temporary file to the desired filename, we avoid
the incompatible semantics of sed -i on GNU systems (sed -i does not
create a backup filename, and does not take an argument unless it is
"bundled") and macOS (sed -i requires an argument, possibly empty).

Resolves: https://github.com/libsdl-org/SDL/issues/10878
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-18 10:38:59 -07:00
Sam Lantinga d658ef6627 Don't guess about the size of an int, assert it! 2024-09-18 10:37:11 -07:00
Sam Lantinga a90ad3b0e2 Removed SDL_bool in favor of plain bool
We require stdbool.h in the build environment, so we might as well use the plain bool type.

If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
2024-09-18 08:32:30 -07:00
Sam Lantinga 407ccadfd7 Added copyright header to edid.h 2024-09-18 08:18:26 -07:00
Sam Lantinga bd04459cde Fix typos (thanks @qndel!)
Fix typos in comments and in one case in a returned error ("insuffient -> insufficient" fb273eb)
codespell src/ *.cpp *.h *.hpp --ignore-words-list unknwn,thid,algebric,statics,pixelX,pEvents,caf,ptd,parms,pEvent,parm,TextureRS,TE,HDA,LOD,datas,UE,xwindows,IIF
cd src; git checkout \
    events/imKStoUCS.* \
    hidapi \
    joystick/controller_type.c \
    joystick/controller_type.h \
    joystick/hidapi/steam/controller_constants.h \
    joystick/hidapi/steam/controller_structs.h \
    libm \
    stdlib/SDL_malloc.c \
    stdlib/SDL_qsort.c \
    stdlib/SDL_strtokr.c \
    video/khronos \
    video/x11/edid.h \
    video/x11/edid-parse.c \
    video/x11/xsettings-client.* \
    video/yuv2rgb
2024-09-18 08:18:26 -07:00
Sam Lantinga 03ae792df3 Fixed the recording field in audio device events
Fixes https://github.com/libsdl-org/SDL/issues/10885
2024-09-17 11:36:55 -07:00
Sam Lantinga c68e9e157c Fixed typo 2024-09-17 10:59:28 -07:00
Sam Lantinga bc9780299c Don't define backends if SDL_GPU_DISABLED is set 2024-09-17 09:40:29 -07:00
Sam Lantinga 807b8a9d4d Allow initializing hints and properties from any thread 2024-09-17 08:53:27 -07:00
Sam Lantinga d0edf68774 Added Uint32 versions of the atomic functions 2024-09-17 08:53:27 -07:00
Sam Lantinga 8d223b3037 Renamed atomic functions to match SDL 3.0 naming convention
This will also allow us to cleanly add atomic operations for other types in the future.
2024-09-17 08:53:27 -07:00
Sam Lantinga f3e419596b Removed SDL_INIT_TIMER
This is no longer necessary before calling SDL_AddTimer()
2024-09-17 08:53:27 -07:00
Sam Lantinga 9275c533ca Added thread-safe initialization/cleanup support
Also went through and removed inappropriate uses of spinlocks.

Fixes https://github.com/libsdl-org/SDL/issues/10872
2024-09-17 08:53:27 -07:00
Sam Lantinga 7edd43c276 Don't define render_drivers if SDL_RENDER_DISABLED is set
Fixes https://github.com/libsdl-org/SDL/issues/10861
2024-09-17 08:46:05 -07:00
Sam Lantinga 98cd8b34a7 Close the other file descriptors after redirection has taken place
Fixes https://github.com/libsdl-org/SDL/issues/10868
2024-09-17 07:46:48 -07:00
Simon McVittie 4b3058d58d render: Don't try to rebuild D3D11, D3D12, Metal shaders without spirv-cross
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-17 07:43:37 -07:00
Simon McVittie 13500bbf50 render: Fix detection of fxc, dxc in build-shaders.sh
We want `$USE_FXC` to default to the result of evaluating the variable
`$HAVE_FXC`, not the literal string `HAVE_FXC`, and the same for dxc.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-17 07:43:37 -07:00
Green Sky 11129761e7 v4l2: return success if the device is ready 2024-09-17 07:41:43 -07:00
Simon McVittie ab9c68d9ff pipewire: Always destroy hotplug loop during deinitialization
We always need to destroy the hotplug loop and its associated resources
(if created) before we can deinitialize and unload the Pipewire library.

In the happy path where everything worked correctly, this means we will
call hotplug_loop_destroy() twice (once from PIPEWIRE_DeinitializeStart()
and a second time from PIPEWIRE_Deinitialize()), but that's OK, because
it's idempotent and so will do nothing the second time.

In error-handling code paths, this avoids needing to remember to call
hotplug_loop_destroy() explicitly, which should make it easier to avoid
bugs like #10787.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-09-17 07:35:42 -07:00
Sam Lantinga 231ea07617 Added SDL_LogTrace() 2024-09-17 02:04:54 -07:00
Sam Lantinga 6180da00e1 Skip a lock/unlock when logging known categories 2024-09-17 02:04:54 -07:00
Caleb Cornett c499f79fe9 GPU: Fix multisample texture usage validation 2024-09-16 17:55:27 -05:00
Sam Lantinga 1bbc897e48 Updated documentation for bool return type
Also updated the test CRC functions to return bool.
2024-09-16 13:12:15 -07:00
Sam Lantinga dc639956ba Improve logging performance and make log priorities thread-safe
Fixes https://github.com/libsdl-org/SDL/issues/9679
2024-09-16 13:09:17 -07:00
Caleb Cornett 9416917353
GPU: Rework MSAA (#10859) 2024-09-16 12:19:09 -05:00
Sam Lantinga 0f85fdefc8 Fixed warning: "SDL_VIDEO_RENDER_D3D12" is not defined, evaluates to 0 2024-09-16 07:40:00 -07:00
Caleb Cornett 4f722d372a
GPU: Metal vertex buffer indices should grow upward (#10837) 2024-09-15 20:17:43 -05:00
Sam Lantinga 5b5b1a8926 Fixed cleaning up dependent subsystems if initialization fails 2024-09-15 11:40:31 -07:00
Sam Lantinga 97d40b9218 Removed SDL_CleanupEnvironment() 2024-09-15 10:00:21 -07:00
Sam Lantinga 28b94c4758 Re-added SDL_getenv() as a thread-safe getenv() implementation 2024-09-15 09:37:04 -07:00
Sam Lantinga 718845a33d Fixed warning C4701: potentially uninitialized local variable 'startup_info' used 2024-09-15 09:21:04 -07:00
Sam Lantinga 19243092c6 Renamed SDL_GpuGraphicsPipelineTargetInfo to SDL_GPUGraphicsPipelineTargetInfo
Fixes https://github.com/libsdl-org/SDL/issues/10855
2024-09-15 07:46:26 -07:00
Sam Lantinga 604d0c519e If posix_spawn() is available, so is sigaction 2024-09-14 22:54:18 -07:00
Sam Lantinga ec5d280c90 Make sure we ignore SIGPIPE so we don't crash if we write when the pipe is closed 2024-09-14 22:15:18 -07:00
Sam Lantinga 34b2f4ffca Use non-blocking pipes for process I/O on Windows
Fixes https://github.com/libsdl-org/SDL/issues/10846
2024-09-14 21:16:35 -07:00
Anonymous Maarten dd07cc8991 SDL_Process: WAIT_TIMEOUT means the process has not exited yet 2024-09-14 21:16:29 -07:00
Carl Åstholm 1f3fd65c4c cpuinfo: Rename SDL_GetCPUCount to SDL_GetNumLogicalCPUCores
This was the only API that broke the "GetNumThings" convention
used elsewhere, so renaming it helps with consistency.
Adding "logical cores" to the name also makes it a bit
more immediately obvious what the count actually represents.
2024-09-14 19:33:30 -07:00
Sam Lantinga dcb2a8c2fe Use CreateProcessW() to handle non-ASCII file paths and arguments 2024-09-14 12:27:22 -07:00
Sam Lantinga e97f636590 SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER is an SDL_Environment pointer 2024-09-14 12:27:22 -07:00
Sam Lantinga 56fc4b790c Reduce strcmp() calls in hashtable lookup 2024-09-14 11:46:40 -07:00
Sam Lantinga e673479449 Removed SDL_WriteProcess()
This had the unfortunate side-effect of blocking if you tried to write too much. Instead you can use SDL_GetProcessInput() and handle SDL_IO_STATUS_NOT_READY as needed.

Fixes https://github.com/libsdl-org/SDL/issues/10834
2024-09-14 11:15:50 -07:00
Ozkan Sezer a833ee2e63 SDL_gpu.c: fixed build when SDL_GPU_DISABLED is defined. 2024-09-14 20:40:56 +03:00
ritalat f6f49de134 Add convenience functions to get process IOStreams 2024-09-14 10:33:29 -07:00
Sam Lantinga 7ff015ceae Close file descriptors not used by the child process 2024-09-14 10:29:02 -07:00
Sam Lantinga fed0149172 Switched wayland messageboxes to use the new process API 2024-09-14 10:29:02 -07:00
Sam Lantinga aa7357a14d SDL_CreateEnvironment() fills the environment with a non-zero parameter 2024-09-14 10:29:02 -07:00
Sam Lantinga 76c469910e Added SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN 2024-09-14 10:29:02 -07:00
Sam Lantinga 44c6cfda05 Switched zenity dialogs to use the new process API 2024-09-14 10:29:02 -07:00
Semphriss 27862907c6 Update src/process/windows/SDL_windowsprocess.c
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-09-13 22:15:56 -07:00
Semphriss 82b33a7d3f Update src/process/windows/SDL_windowsprocess.c
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-09-13 22:15:56 -07:00
Semphris 3cf54675bb Windows process: escape backslashes before quotes 2024-09-13 22:15:56 -07:00
Sam Lantinga 90e01040c5 Added thread-safe environment functions
Also marked the existing functions as unsafe, as they can cause crashes if used in multi-threaded applications.

As a bonus, since the new functions are hashtable based, hint environment lookups are much faster.
2024-09-13 22:14:54 -07:00
Ethan Lee 16ff7503b7 gpu: Update GPU support queries to better match naming conventions 2024-09-13 23:08:44 -04:00
Semphris 9eea8234e6 Add SDL_Process subsystem 2024-09-13 15:19:32 -07:00
Sam Lantinga 6c83491116 Added SDL_FlushIO()
Also added SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER and refactored the internal API to be able to create SDL_IOStream objects from native file handles.
2024-09-13 15:19:32 -07:00
Carl Åstholm eb199176e6 stdlib: Conditionally undef some SDL_strtox tests
Some test cases have implementation-defined results,
so we should only test these when we know SDL's own
implementations of the functions are used.
2024-09-13 12:30:58 -07:00
Carl Åstholm 59ec034412 stdlib: Use macros to define SDL_strtox tests 2024-09-13 12:30:58 -07:00
Carl Åstholm 8092e35287 stdlib: Improve SDL_strtod
- Handle leading whitespace
- Handle positive sign
- Parse integer part as unsigned long long
- Handle signed zero (this also applies to printf)
2024-09-13 12:30:58 -07:00
Carl Åstholm 56a48763cd stdlib: Bring SDL_wcstol in line with SDL_strtol 2024-09-13 12:30:58 -07:00
Carl Åstholm 61bc856b04 stdlib: Use new parser for scanf %p specifier 2024-09-13 12:30:58 -07:00
Carl Åstholm e109aa09aa stdlib: Rewrite SDL_strto(ll?|ul) impl 2024-09-13 12:30:58 -07:00
Carl Åstholm fb82772fb3 stdlib: Rewrite SDL_strtoull impl 2024-09-13 12:30:58 -07:00
Carl Åstholm 88d3cb4f90 Remove unnecessary include from SDL_pen_c.h 2024-09-13 12:30:58 -07:00
Carl Åstholm fd53b3e112 stdlib: Rewrite SDL_wcstol impl
SDL_wcstol should now fully adhere to the libc spec.
2024-09-13 12:30:58 -07:00
Anonymous Maarten ee65176eec SDL_test: add SDLTest_LogEscapedString 2024-09-13 20:52:32 +02:00
Anonymous Maarten 6a305e1532 SDL_test: fix SDLTest_CommonQuit with NULL state 2024-09-13 20:52:32 +02:00
Ethan Lee 0160e9eac6 gpu: Add SDL_QueryGPUSupport 2024-09-13 13:42:07 -04:00
Ethan Lee 96e147b2b9 gpu: Rework driver name queries, add GetGPUShaderFormats 2024-09-13 12:29:40 -04:00
Frank Praznik 6d92de5d3a
wayland: Ensure that a NULL internal structure isn't dereferenced when destroying a window
In some cases, such as when recreating a window during renderer initialization, a failure can leave the window in a state where the internal structure has already been freed, but the higher level window object needs to be destroyed separately. Check that the internal handle is valid before attempting to access any data during destruction.

Allows for graceful failure instead of a crash during cleanup if renderer creation fails.
2024-09-13 11:38:48 -04:00
Frank Praznik 9d9721cd4c
wayland: Fix some incorrect buffer scale calculations
Use doubles and apply an offset to account for rounding errors due to Wayland scale increments being in units of 1/120. This fixes the backbuffer size calculations with certain combinations of size/scale values, and future-proofs the Wayland backend, as 32-bit floats become increasingly error-prone with larger dimensions and/or scale factors.

The conversion formula is now point->pixel->point round trip safe as well.
2024-09-13 11:18:12 -04:00
Caleb Cornett 94436a938d GPU: Remove unused and incorrect D16 format checks from Vulkan driver 2024-09-13 10:16:02 -05:00
Caleb Cornett 5771b502f8
GPU: Fix D3D11/D3D12 vertex strides for multiple vertex buffers (#10818) 2024-09-13 09:57:55 -05:00
Ethan Lee 371cfaf8fe gpu: Implement support for SDL_GPU_DISABLED 2024-09-13 10:32:12 -04:00
Caleb Cornett a45a2caf49
GPU: Rename VertexBinding to VertexBufferDescription (#10811) 2024-09-12 18:02:39 -05:00
poleonek 446ee3e7c5
Fix bug with SDL_ShowMessageBox not working with wayland (#10810) 2024-09-12 15:12:17 -07:00
Ryan C. Gordon b7dc30ca24
pulseaudio: Hotplug thread fixes.
This used a tiny stack, which apparently upsets Blender for various
technical reasons. Instead, just use the default stack size, which should
give it plenty of space to work.

If the thread failed to create, we would then wait on a semaphore that would
never trigger, so don't do that anymore!

Fixes #10806.
2024-09-12 17:44:14 -04:00
Ethan Lee c36982d45c vulkan: Avoid redundant commands for dynamic states 2024-09-12 16:51:32 -04:00
Evan Hemsley 66489f91bb
GPU: Cube Arrays (#10800)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-09-12 13:41:46 -07:00
Ethan Lee 9ea0a837ae vulkan: Use a spinlock instead of a mutex for descriptor pools 2024-09-12 15:23:37 -04:00
Caleb Cornett ddd5723e2e
GPU: Remove pitch parameters from indirect draw calls (#10803) 2024-09-11 23:30:14 -07:00
hwsmm 3d7e8c9bb7 Add missing SDL_WPRINTF_VARARG_FUNCV in gendynapi.py 2024-09-11 21:12:26 -07:00
Petar Popovic d03c7cdf17 Removing extra semicolons 2024-09-11 19:45:22 -07:00
Petar Popovic fd2a266549 Adding void to empty function prototype parenthesis 2024-09-11 19:44:52 -07:00
Sam Lantinga 4d135fb696 Fixed color scale when rendering to an sRGB render target 2024-09-11 14:23:58 -07:00
Sam Lantinga 86e393b523 Clarify that INPUTTYPE_UNSPECIFIED is correct for RGB textures 2024-09-11 14:23:58 -07:00
Sam Lantinga 92255d36d4 We already have functions for converting between sRGB and linear space 2024-09-11 14:23:58 -07:00
Sam Lantinga 667a3e40e9 Use the correct namespace for structures
Otherwise the debugger may use the wrong structure definition at runtime.
2024-09-11 14:23:58 -07:00
Sam Lantinga 37c9fb490e Changed enums to use XXX_COUNT for the count or number of values
Fixes https://github.com/libsdl-org/SDL/issues/10763
2024-09-11 09:32:17 -07:00
Andrei Alexeyev 64f12bea4a
GPU: Remove unnecessary texture format swizzles in Vulkan (#10693) 2024-09-11 09:01:06 -07:00
Sam Lantinga 4123023d3e Renamed sdlgpu to gpu 2024-09-11 08:34:51 -07:00
Sam Lantinga c77e51c084 Use SDL_unsetenv() 2024-09-11 07:42:17 -07:00
cosmonaut 3166f91282 GPU: Defer setting blend state on D3D11 2024-09-11 00:27:36 -07:00
Evan Hemsley 2b8a349b26
Add SDL_BindGPUComputeSamplers (#10778)
---------

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
2024-09-10 19:20:14 -07:00
Petar Popovic 323b60abf1 SDL_test_harness.c: Fix warning -Wcast-function-type-strict 2024-09-10 18:22:54 -07:00
Evan Hemsley 0b6f993dea
GPU: Zero-init handling (#10786) 2024-09-10 18:17:08 -07:00
Sam Lantinga b8dbc7086d Disable GameInput mouse and keyboard support
GameInput currently has a bug with keys stuck on focus change, and crashes on initialization on some systems, so we'll disable it until these issues are fixed.
2024-09-10 15:29:52 -07:00
Sam Lantinga 76ce83801a Removed pipewire client version check
@smcv may have found the root cause of the pipewire thread crash, so removing the pipewire client version check to re-enable use of pipewire in older container runtimes.
2024-09-10 13:05:48 -07:00
Simon McVittie 9c8c6da476 pipewire: If hotplug initialization fails, clean up any partial success
hotplug_loop_init() calls pw_context_new(), which creates a thread
internally (for the "data loop"). It also creates a thread of its own,
the `hotplug_loop`.

Both of these threads are running code from libpipewire, so before we
can allow the Pipewire library to be unloaded, we need to destroy
the context with pw_context_destroy() and destroy the `hotplug_loop`
with pw_thread_loop_destroy().

Resolves: https://github.com/libsdl-org/SDL/issues/10787
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-09-10 13:04:16 -07:00
Andrei Alexeyev 1e9ff723ad GPU: fix SDL_GetGPUSwapchainTextureFormat error return value 2024-09-10 08:36:57 -07:00
Sam Lantinga 4eb4370500 SDL_strtoll(), SDL_strtoull(), SDL_lltoa(), and SDL_ulltoa() use long long values 2024-09-09 15:46:26 -07:00
Sam Lantinga 6fc6e3dc7e Use SDL_bool where appropriate in SDL events
This involved changing button state from Uint8 to SDL_bool, and made SDL_PRESSED and SDL_RELEASED unnecessary.

Fixes https://github.com/libsdl-org/SDL/issues/10069
2024-09-09 14:00:19 -07:00
Carl Åstholm d6caf2abe7 Remove SDL_RESTRICT in favor of doc comments 2024-09-09 13:51:16 -07:00
Simon McVittie 7713a7eec7 x11vulkan: Use the correct SONAME of libX11-xcb.so.1 on Linux, etc.
On most Unix platforms supported by SDL, the canonical name used to load
a library at runtime includes its ABI major version, and the name
without a version is not guaranteed to exist on non-developer systems.
libX11-xcb.so.1 is correct on Linux, and probably on other Unix
platforms like FreeBSD.

A notable exception is OpenBSD, which apparently does not use
ABI-suffixed names, so continue to use libX11-xcb.so there.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-09-09 12:27:54 -07:00
cosmonaut d3091b9538 Remove SDL_GPUDepthStencilValue struct 2024-09-09 10:55:05 -07:00
Sam Lantinga 80e541d1fc Fixed calling SDL_utf8strlcpy() with dst_bytes of 0 2024-09-09 10:42:25 -07:00
Evan Hemsley 668e2f82d2
Add load op and clear color to SDL_BlitGPUTexture (#10767) 2024-09-09 10:19:52 -07:00
Simon McVittie 4728325044 pipewire: Give hotplug threads a more indicative name
When debugging crash reports, it's helpful to know which thread is
associated with which external library.

Linux limits the length of a thread name to 15 bytes (not including the
zero-termination), so abbreviate Pipewire to "pw" and hotplug to "plug"
to fit the desired information into the allowed space.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-09-09 11:22:05 -04:00
Petar Popovic a57f6c4af3 Fix additional calloc-transposed-args warnings 2024-09-08 19:28:11 -07:00
Petar Popovic d2ef15d8e6 Fix warnings: calloc-transposed-args 2024-09-08 19:28:11 -07:00
Petar Popovic aa6a0be7a8 Fix warning: redefinition of typedef 'SDLTest_TestSuiteRunner' 2024-09-08 15:36:51 -07:00
Petar Popovic 257385277d SDL_realloc() with size 0 now always defaults to size 1 2024-09-08 06:39:37 -07:00
Anonymous Maarten 4c0cb94b96 vulkan: VULKAN_CreateTexture returns a boolean
Fixes regression introduced by 9ff3446f03
VK_SUCCESS == 0, where failure needs to return false (0).
2024-09-08 13:14:18 +02:00
Anonymous Maarten 3eb49ac862 vulken: VULKAN_CreateTexture returns a boolean
Fixes regression introduced by 9ff3446f03
VK_SUCCESS == 0, where success needs to return true (1).
2024-09-08 12:42:55 +02:00
cosmonaut 1a13acac09 Always blit to the swapchain in GPU_RenderPresent
Fixes #10744
2024-09-07 08:43:02 -07:00
Evan Hemsley 68a9991ec9
GPU: Document structs (#10742) 2024-09-07 08:29:14 -07:00
Sam Lantinga cf9613fe63 The GPU log category ate one of the SDL reserved categories 2024-09-07 07:57:29 -07:00
Daniel Ludwig 1849205733 Fix GDK builds after renames done in #10730 2024-09-07 11:50:40 +03:00
Daniel Ludwig 0a44ea1b0b Amend use of non-standard compiler syntax 2024-09-07 11:50:40 +03:00
Sam Lantinga 1d59be67fc Fixed crash if PIPEWIRE_PREFERRED_Init() fails and then pipewire is used anyway
The symbols were unloaded, but not reloaded because pipewire_initialized was still true.
2024-09-06 17:26:45 -07:00
Caleb Cornett 9730f62e8c
GPU: Rename struct members and parameters for SDL3 naming conventions (#10730)
---------

Co-authored-by: Evan Hemsley <2342303+thatcosmonaut@users.noreply.github.com>
2024-09-06 16:38:23 -07:00
Timothee Besset e21f70c593 pipewire : check minimum client library version early 2024-09-06 14:52:46 -07:00
Sam Lantinga 4c8357a37d Clarified why the WINDOWS driver is lower than the RAWINPUT driver 2024-09-06 11:27:51 -07:00
Sam Lantinga 66b4c080c0 Clarified why the WGI driver is lower than the WINDOWS driver 2024-09-06 11:25:57 -07:00
Sam Lantinga 8f46cb771c SDL_XINPUT_Enabled() returns false until XInput DLL is successfully loaded
We make sure we initialize XInput first, so that anything checking whether it's enabled gets a valid result based on whether we were able to load it or not.
2024-09-06 11:21:06 -07:00
Ryan C. Gordon ac08dde1b2 windows: Clean out things that should be using `defined(SDL_PLATFORM_WINDOWS)`. 2024-09-06 13:28:39 -04:00
Ryan C. Gordon 154452a726 winrt: Removed WinRT/Windows Phone/UWP support.
Fixes #10724.
2024-09-06 13:28:39 -04:00
Sam Lantinga 6d7c211faf Fixed race condition at startup that could cause a crash in the XInput driver 2024-09-06 10:15:16 -07:00
Sam Lantinga 1381cc8554 Add a step to fix generated shader code 2024-09-06 09:09:01 -07:00
Sam Lantinga 104642ffe7 Sorted API symbols 2024-09-06 08:57:40 -07:00
Sam Lantinga 4c382aafcd Fixed building on Raspberry Pi 2024-09-06 08:54:05 -07:00
Anonymous Maarten 360bc667a8 SDL_Log: restore SDL2's SDL_LogCategory order 2024-09-06 17:40:59 +02:00
Anonymous Maarten db96ddca34 SDL_test: use SDLCALL calling convention
This is needed when using a pre-built static SDL3_test library.
2024-09-06 14:19:05 +02:00
Sam Lantinga 379aea5c2d Fixed warnings building with Visual Studio 2024-09-05 20:24:30 -07:00
Sam Lantinga 8edb901724 Fixed crashes in Metal renderer due to ARC releasing references on random memory in newly allocated structs 2024-09-05 19:48:33 -07:00
Sam Lantinga 702ed83f72 Initialize interface structures so they can be extended in the future
We guarantee that we will only add to the end of these interfaces, and any new fields will be optional.
2024-09-05 19:16:00 -07:00
Anonymous Maarten 102b3b480b SDL_test: move argument parsing into SDL_test 2024-09-06 03:06:40 +02:00
Anonymous Maarten 09af4a8086 SDL_test: make argument parsing extendable 2024-09-06 03:06:40 +02:00
Anonymous Maarten 396dd16471 SDL_test: Remove unused common_usage_* static char pointers 2024-09-06 03:06:40 +02:00
Anonymous Maarten 872608b8af Don't allocate in SDLTest_GenerateRunSeed 2024-09-06 03:06:40 +02:00
Anonymous Maarten 2f4b2df595 SDL_test: pass data pointer to unit tests 2024-09-06 03:06:40 +02:00
Anonymous Maarten baa1a5e2f4 Add SDL_strpbrk 2024-09-06 01:35:43 +02:00
Anonymous Maarten 55934bc85e include: add SDL_RESTRICT for restricted pointer aliasing 2024-09-06 01:35:43 +02:00
Caleb Cornett 2d4eb29c37
Add SDL_SetGPUBlendConstants, SDL_SetGPUStencilReference (#10704) 2024-09-05 17:41:23 -05:00
Ozkan Sezer f494658f9c SDL_gpu.c: remove BOM. 2024-09-05 22:39:02 +03:00
Ozkan Sezer cb2919ac55 [GPU] MinGW build fixes:
- CreateEventEx() is guarded by _WIN32_WINNT >= 0x0600:
  In SDL_gpu_d3d12.c, include core/windows/SDL_windows.h
  that defines _WIN32_WINNT properly to account for that
- DXGIInfoQueue stuff is not available in all toolchains
  such as mingw-w64 version 8.0.3
- SDL_gpu_d3d11.c: _WIN32 is always defined by MinGW, as
  is the case for all windows-targeting compilers, so it
  doesn't guarantee absence of DXGIInfoQueue stuff:
  rely on __IDXGIInfoQueue_INTERFACE_DEFINED__, as it is
  done elsewhere.

Fixes: https://github.com/libsdl-org/SDL/issues/10705 .
2024-09-05 22:39:02 +03:00
Frank Praznik a46e7027ce video: Allow setting the parents of toplevel windows
Allow setting a parent/child relationship on toplevel windows, which allows raising sets of windows together, and allows child windows to always float above their parents.

Modal windows are now set by setting the parent, then toggling modal status, as the previous interface duplicated functionality now handled by SDL_SetWindowParent().
2024-09-05 15:22:23 -04:00
Sam Lantinga 387774ab8a Build config flags are either defined or undefined, never 0
This is for consistency with CMake build configuration

Also added SDL_VIDEO_RENDER_GPU to the non-CMake build configurations
2024-09-05 09:52:40 -07:00
David Gow e3fd581aca GPU: vulkan: Respect swapchain minImageCount
The default value of MAX_FRAMES_IN_FLIGHT (3) may be less than the
minImageCount returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() on
some setups. For example, the Intel IVB Vulkan driver on Wayland returns
a minImageCount of 4, resulting in the following validation warning:

VUID-VkSwapchainCreateInfoKHR-presentMode-02839(ERROR / SPEC): msgNum: -76493605 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-presentMode-02839 ] | MessageID = 0xfb70ccdb | vkCreateSwapchainKHR(): pCreateInfo->minImageCount 3, which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = 4, maxImageCount = 0). The Vulkan spec states: If presentMode is not VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR nor VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR, then minImageCount must be greater than or equal to the value returned in the minImageCount member of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-presentMode-02839)
    Objects: 0

Use the minimum image count in that case, as it's as close as we'll get
to our preferred value. Note also that, unlike maxImageCount,
minImageCount is never 0 (the spec states it is always at least 1), so
we don't need a similar check to see if it applies.

Signed-off-by: David Gow <david@ingeniumdigital.com>
2024-09-05 08:10:18 -07:00
Sylvain 41810c823d Compilation without vulkan: SDL_GPU_VULKAN is always defined for some plateform (at android, macos), test against 0 or 1 2024-09-05 05:36:21 -07:00
Quinn X. J. f61d4db39a GPU: `colorAttachmentDescriptions` should be `const`
The `colorAttachmentDescriptions` field of `SDL_GPUGraphicsPipelineAttachmentInfo` should be marked `const`,
similarly to the `vertexBindings` and `vertexAttributes` fields of `SDL_GPUVertexInputState`.
2024-09-05 05:22:52 -07:00
Sam Lantinga 20d0a1a3d1 Added a defensive check against XINPUTGETCAPABILITIES being NULL
This should never happen, but it does, possibly due to a data segment overwrite elsewhere.
2024-09-04 16:30:27 -07:00
Sam Lantinga abd2ac5992 Set the desired channel count when opening audio on Android 2024-09-04 13:59:48 -07:00
Sam Lantinga e2c9a0a427 Updated Android audio log messages 2024-09-04 13:59:48 -07:00
Evan Hemsley 1788be8547
GPU: Add const to some function parameters (#10694) 2024-09-04 13:53:41 -07:00
Sam Lantinga c9387bcca5 pipewire: spa_list_is_empty() returns bool 2024-09-03 13:45:00 -07:00
Sam Lantinga 0fd275e16e pulseaudio: fixed cleanup if couldn't connect to pulseaudio server 2024-09-03 13:34:19 -07:00
Sam Lantinga a56315cd48 Fixed return value failing to load pulseaudio functions 2024-09-03 13:24:27 -07:00
Sam Lantinga 7ca676aeed Use ASCII characters in SDL source and headers
Fixes https://github.com/libsdl-org/SDL/issues/10636
2024-09-03 12:52:27 -07:00
Daniel Ludwig b1b4a9cd1b
GDK build: PFN_D3D12_XBOX_CREATE_DEVICE not defined for Xbox One (#10690) 2024-09-03 08:09:00 -05:00
Sam Lantinga 73898a0a64 Renamed NDA platform constants to "PRIVATE" 2024-09-02 21:00:34 -07:00
Sam Lantinga 35dadda327 Fixed build warnings 2024-09-02 17:17:48 -07:00
Sam Lantinga eacf119923 Renamed SDL_size_add_overflow() and SDL_size_mul_overflow() 2024-09-02 17:17:48 -07:00
Andrei Alexeyev fb7245fb93
GPU: Add support for more texture formats (#10641) 2024-09-02 19:14:48 -05:00
Caleb Cornett f405def691
Change GPU flag enums to defines (#10681) 2024-09-02 15:19:43 -07:00
Sam Lantinga d501f6db07 Make newer DRM and GBM functions optional
Fixes https://github.com/libsdl-org/SDL/issues/10675
2024-09-02 10:37:50 -07:00
Sam Lantinga 8371114009 Fixed error: multiple storage classes in declaration specifiers 2024-09-02 09:50:19 -07:00
Sam Lantinga 93423c1c46 spin_acquire_lock() takes a volatile pointer parameter 2024-09-02 09:50:19 -07:00
Sam Lantinga 01fa9cad80 Fixed error: conflicting types for 'getpagesize' 2024-09-02 09:50:19 -07:00
Sam Lantinga 8b0798a3da Fixed error: variable 'nfences' set but not used 2024-09-02 09:50:19 -07:00
Sam Lantinga b5700ccc02 Updated dlmalloc to version 2.8.6
From https://gee.cs.oswego.edu/pub/misc/malloc-2.8.6.c
2024-09-02 09:50:19 -07:00
Davis Gallinghouse deb313dd99 GPU: Compile Metal shader source from NSString
Using the @() syntax to construct an NSString assumes the parenthesized
pointer is null-terminated, but the Metal shader source included in
render/sdlgpu/shaders/metal.h is not null-terminated.

Quoting the clang documentation on Objective-C literals:

    When the type of the parenthesized expression is (char *) or (const
    char *), the result of the boxed expression is a pointer to an
    NSString object containing equivalent character data, which is
    assumed to be ‘\0’-terminated and UTF-8 encoded.

Because the @() syntax assumes null-termination, it may read garbage
data after the shader source (up to the next null byte), which can then
cause the Metal shader compiler to fail. To prevent this, instead of
using the @() boxing syntax, we explicitly construct an NSString using
the string length passed by the caller.
2024-09-02 07:20:36 -07:00
Sam Lantinga df501040fd Fixed random seed not affecting SDLTest_RandomIntegerInRange() 2024-09-01 14:05:27 -07:00
Zero 2c0ffdc6d5
GPU: Pass the new window size when resizing the swapchain for d3d12 (#10665) 2024-09-01 08:48:29 -07:00
Andrei Alexeyev d4b8072614
GPU: Fix and generalize BytesPerRow() and BytesPerImage() (#10663)
These functions had special cases for a few BC formats, but all
block-compressed formats should need the same logic. Furthermore they
weren't handling the sRGB variants of those formats.
2024-08-31 23:07:38 -07:00
coffeechriph b15d79a35a Fix texture_rgba_frag for metal in SDL_shaders_gpu.c 2024-08-31 20:09:11 -07:00
Anonymous Maarten c11b58ead7 Increase maximum line length of SDLTest_LogAllocations 2024-09-01 02:19:39 +02:00
Sam Lantinga b17ca32d8c Changed GPU driver names to match renderer driver names
Fixes https://github.com/libsdl-org/SDL/issues/10650
2024-08-31 10:06:27 -07:00
Sam Lantinga 51a0b58f75 GPU logging should be quiet by default 2024-08-31 09:52:21 -07:00
Sam Lantinga 6c30a0f60b Added scaleMode validation to SDL_SetTextureScaleMode() 2024-08-31 09:43:02 -07:00
Anonymous Maarten 63e58e5d66 SDL_Log: always use WriteFile/WriteConsole on Windows
OutputDebugString and fprintf(stderr) (of mslibc) both output
to the debug window of Visual Studio.
In other debuggers (e.g. RAD), this does not happen.

To avoid double output, this commit always uses WriteFile/WriteConsole.
2024-08-31 17:48:57 +02:00
Anonymous Maarten 8ffc1c2705 SDL_Log: don't rely on printf to forward stderr to the debug stream
This partially reverts 125ce71379
2024-08-31 17:48:57 +02:00
Sam Lantinga f827c1322c Renamed SDL_Del* to SDL_Remove* 2024-08-31 07:46:28 -07:00
Sam Lantinga cf1d8e2dfd Renamed SDL_AtomicSetPtr() and SDL_AtomicGetPtr()
Fixes https://github.com/libsdl-org/SDL/issues/10601
2024-08-31 07:46:28 -07:00
Jan Sedivy 00708b976a GPU Metal: Fix uninitialized memory 2024-08-31 07:29:32 -07:00
Sam Lantinga 2010a22f44 Removed unneeded separate return statement. 2024-08-31 07:26:13 -07:00
Sam Lantinga 4759a97c09 Fixed return value from D3D12_UpdateVertexBuffer()
Fixes https://github.com/libsdl-org/SDL/issues/10649
2024-08-31 07:26:13 -07:00
Anonymous Maarten 31a5f3b833 Fix C4090: 'function': different 'const' qualifiers 2024-08-31 06:49:33 -07:00
Frank Praznik 5d5a685a80 wayland: Add support for setting window icons via the xdg-toplevel-icon-v1 protocol 2024-08-31 09:38:43 -04:00
Anonymous Maarten ea0ab2647a SDL_test: print no procname when SDL_TRACKMEM_SYMBOL_NAMES is false
On ci, by default this variable is set to a false value.
By adding [sdl-ci-trackmem] to the commit message,
it will become true.
2024-08-31 13:16:51 +02:00
Anonymous Maarten 384afa378c SDL_test: fix proc names on older libunwind
Older libunwind does not have unw_get_proc_name_by_ip.
Instead, use unw_get_proc_name.

Reference: 4c00433b69
2024-08-31 13:16:51 +02:00
Andrei Alexeyev 0e08d15cca
GPU: Fix unhandled R16G16_UNORM in SDL_GPUTextureFormatTexelBlockSize() (#10638) 2024-08-30 17:05:17 -07:00
Sam Lantinga f13dc502c6 Sort exported functions 2024-08-30 15:45:30 -07:00
Evan Hemsley 12ecdb9dde
GPU: Rename some awkwardly named functions (#10642) 2024-08-30 15:31:10 -07:00
Sam Lantinga bef07023d6 Fixed memory leak if the GPU renderer can't be initialized
DestroyRenderer needs to be set before we return false from GPU_CreateRenderer()
2024-08-30 14:49:49 -07:00
cosmonaut 906044569d GPU D3D12: Fix command buffer leak 2024-08-30 10:46:41 -07:00
Sam Lantinga b602c449e5 Remove SDL_SCALEMODE_BEST
Fixes https://github.com/libsdl-org/SDL/issues/10619
2024-08-30 10:30:14 -07:00
Evan Hemsley 4bbf0d45fd
GPU D3D12: Fix teardown and leaks on device creation failure (#10639) 2024-08-30 10:24:02 -07:00
Sam Lantinga 40d85109ac Fixed crash when using the dummy video driver
The higher level code will clean up the renderer if initialization fails.
2024-08-30 07:16:47 -07:00
Sam Lantinga 580a496391 Adjust rounding when calculating resampled output frames
Fixes https://github.com/libsdl-org/sdl2-compat/issues/95
2024-08-30 07:16:47 -07:00
Anonymous Maarten 88fe52df7b SDL_test: add --gpu option 2024-08-30 13:43:38 +02:00
Andrei Alexeyev d1a2c57fb9
GPU: Fix memory leak in VULKAN_CreateDevice (#10631) 2024-08-29 22:15:08 -07:00
Sam Lantinga 16fb8e54cb Fixed the colorspace for YUV textures using native RGB representations
Fixes https://github.com/libsdl-org/SDL/issues/10624
2024-08-29 20:55:09 -07:00
Sam Lantinga efc98062af Fixed warning C4310: cast truncates constant value 2024-08-29 19:31:23 -07:00
Sam Lantinga 5518aca054 Use stdbool internally in SDL 2024-08-29 18:54:05 -07:00
Sam Lantinga dfcabc3db8 Fixed drawing debug text 2024-08-29 18:21:48 -07:00
Sam Lantinga 683e5b8d52 Removed Unicode BOM 2024-08-29 17:33:52 -07:00
Sam Lantinga 858589919a Temporarily use the GPU renderer by default so we get testing feedback 2024-08-29 17:33:52 -07:00
Sam Lantinga b356c65005 Sort exported symbols 2024-08-29 17:33:52 -07:00
Sam Lantinga 62f6e6b701 Removed the preferLowPower parameter from SDL_CreateGPUDevice() 2024-08-29 17:33:52 -07:00
Sam Lantinga b8e7ef27f3 Renamed GPU device creation properties 2024-08-29 17:33:52 -07:00
Sam Lantinga d70578b9aa Renamed Gpu to GPU 2024-08-29 17:33:52 -07:00
cosmonaut 2e7d5bb429 Add the SDL_GPU API
Project Lead: Evan Hemsley <evan@moonside.games>

Co-designer, Metal Port, Console Ports:

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>

Production, QA, Debug:

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>

SDL_Render Driver, Bugfixes:

Co-authored-by: Andrei Alexeyev <akari@taisei-project.org>

Additional D3D12 Programming, Bugfixes:

Co-authored-by: Bart van der Werf <bluelive@gmail.com>

Bugfixes and Feedback:

Co-authored-by: Zakary Strange <zakarystrange@gmail.com>
Co-authored-by: meyraud705 <meyraud705@gmail.com>
Co-authored-by: Joshua T. Fisher <playmer@gmail.com>
Co-authored-by: Topi Ritala <ritalat@fastmail.com>
Co-authored-by: David Gow <david@ingeniumdigital.com>

Original API Proposal:

Co-authored-by: Ryan C. Gordon <icculus@icculus.org>
2024-08-29 15:57:29 -07:00
Mārtiņš Možeiko d9b3b9ad91 Add neon SIMD alpha blending blitter 2024-08-28 21:37:55 -07:00
Ethan Lee 9ab140fad8 offscreen: Fix bogus surface pointer assignment 2024-08-28 21:31:24 -04:00
Sam Lantinga 1a007ab88d Fixed SDL_GetDisplayIndex() 2024-08-28 16:30:21 -07:00
Sam Lantinga 7055001d85 Fixed SDL_GetPrimaryDisplay() 2024-08-28 15:59:13 -07:00
Sam Lantinga 0cdb4833d5 Removed unnecessary inclusion of stdint.h 2024-08-28 15:54:56 -07:00
Sam Lantinga 37b4aac3ac Removed unnecessary inclusion of stdbool.h 2024-08-28 13:58:03 -07:00
Sam Lantinga 91eabf1b4d Fixed SDL_EGL_ChooseConfig() 2024-08-28 13:37:00 -07:00
Sam Lantinga 3bf7b4ff31 Fixed SDL_EGL_LoadLibrary() 2024-08-28 13:21:02 -07:00
Mārtiņš Možeiko 8d65942b9c Faster sse4 and avx2 SIMD blitters 2024-08-28 10:40:44 -07:00
Sam Lantinga c4b35488c2 Fixed warning C6385: Reading invalid data from 'one_blitkey'. 2024-08-28 10:40:14 -07:00
Sam Lantinga abd8ea09de Fixed warning C6001: Using uninitialized memory 'devices'. 2024-08-28 10:34:34 -07:00
Sam Lantinga ace6920d44 Fixed returning -1 in a function returning bool 2024-08-27 22:35:09 -07:00
Ryan C. Gordon 5dc5b4b83c
pthread: Fixed logic bug in SDL_WaitConditionTimeoutNS due to boolization work. 2024-08-27 17:00:47 -04:00
Sam Lantinga 47926d7bd0 Added a cleanup function for virtual joysticks 2024-08-27 10:31:46 -07:00
Sam Lantinga 00c409cff8 Additional cleanup exposed by building with a C++ compiler 2024-08-27 10:31:46 -07:00
Sam Lantinga f08ac438ed Use stdbool for SDL_bool
This helps the compiler warn people when they're doing something like "if (SDL_Init(0) < 0)"
2024-08-27 10:31:46 -07:00
Sam Lantinga 9ff3446f03 Use SDL_bool instead an int return code in the SDL API
Most SDL functions used to indicate success or failure using an int return code. These functions have been changed to return SDL_bool.

Here is a coccinelle patch to change code that previously compared the return value to 0 and changes it to a boolean test:
@ bool_return_type  @
identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat)$";
@@
(
  func(
  ...
  )
- == 0
|
- func(
+ !func(
  ...
  )
- < 0
|
- func(
+ !func(
  ...
  )
- != 0
|
- func(
+ !func(
  ...
  )
- == -1
)
2024-08-27 10:31:46 -07:00
Caleb Cornett d9a5ed75b9 GDK: Xbox should have input focus by default 2024-08-25 22:12:02 -04:00
Ryan C. Gordon d118af53a1
dummyaudio: single-threaded Emscripten support.
On Emscripten without pthreads, this would fail because SDL can't spin the
audio device thread, and the dummy backend didn't manage a thread itself.

With this patch, we use setInterval to fire the usual audio thread iterators
between iterations of the Emscripten mainloop on the main thread.

Fixes #10573.
2024-08-25 15:23:21 -04:00
Ozkan Sezer 845212388e RAWINPUT_JoystickOpen: add missing SDL_stack_free() calls.
Fixes https://github.com/libsdl-org/SDL/issues/10574.
2024-08-25 11:05:40 +03:00
Francisco Javier Trujillo Mata aa527dd0c2 Allow MessageBox to work without window 2024-08-23 11:52:19 -07:00
Sam Lantinga fa2c9c46c5 Default SDL_HINT_JOYSTICK_GAMEINPUT to SDL_FALSE
This was causing crashes in IGameInput_RegisterSystemButtonCallback(), presumably on older systems with runtimes using a different function signature. We'll just disable it for now until the GameInput runtime has stabilized and we can tell when it's safe to use.
2024-08-23 11:34:15 -07:00
Anonymous Maarten c298d2024a Include SDL_build_config.h without a 'build_config/' prefix 2024-08-23 00:51:35 +00:00
Sam Lantinga 3e60fb4223 VULKAN_UpdateVertexBuffer() should return true if there's nothing to do 2024-08-22 13:30:02 -07:00
Sam Lantinga 8f546bb3c9 Use C99 bool internally in SDL 2024-08-22 13:30:02 -07:00
Sam Lantinga 6501e90018 Use C++ style comments consistently in SDL source code
Implemented using this script:

find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
    core/linux/SDL_evdev_kbd_default_keymap.h \
    events/imKStoUCS.* \
    hidapi \
    joystick/controller_type.c \
    joystick/controller_type.h \
    joystick/hidapi/steam/controller_constants.h \
    joystick/hidapi/steam/controller_structs.h \
    joystick/SDL_gamepad_db.h \
    libm \
    render/*/*Shader*.h \
    render/vitagxm/SDL_render_vita_gxm_shaders.h \
    render/metal/SDL_shaders_metal_*.h \
    stdlib/SDL_malloc.c \
    stdlib/SDL_qsort.c \
    stdlib/SDL_strtokr.c \
    test/ \
    video/directx/SDL_d3d12_xbox_cmacros.h \
    video/directx/d3d12.h \
    video/directx/d3d12sdklayers.h \
    video/khronos \
    video/x11/edid-parse.c \
    video/x11/xsettings-client.* \
    video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 13:30:02 -07:00
Sam Lantinga 037541a0e0 Check standard error code return values as < 0 instead of == -1 2024-08-22 09:04:30 -07:00
Anonymous Maarten 46d9066a69 Fix warnings shown when making SDL_bool a typedef of bool 2024-08-22 16:03:39 +00:00
Anonymous Maarten 29ca5b5dcd SDLTest_CompareMemory: print header 2024-08-20 16:04:58 +00:00
Sam Lantinga 61b024766a Fixed crash when quitting after a joystick has been disconnected on Android
Fixes https://github.com/libsdl-org/SDL/issues/10567
2024-08-20 07:26:09 -07:00
Ryan C. Gordon 423d6ec15a
emscripten: Make sure SDL_malloc and friends are marked KEEPALIVE.
Reference PR #9937.
2024-08-19 23:50:52 -04:00
Sam Lantinga e75175129f Added support for the Retro-bit Controller in PS3 mode
Fixes https://github.com/libsdl-org/SDL/issues/10557
2024-08-19 16:40:50 -07:00
Jan Engelhardt 92c4734666 Resolve build failures in pipewire code
g++-13 complains:

```
SDL_pipewire.c:129:42: warning: assignment to "struct pw_main_loop *
(*)(struct pw_main_loop *)" from incompatible pointer type "struct
pw_main_loop * (*)(const struct spa_dict *)"
[-Wincompatible-pointer-types]
 129 | #define SDL_PIPEWIRE_SYM(x) PIPEWIRE_##x = x
SDL_pipewire.c:148:5: note: in expansion of macro "SDL_PIPEWIRE_SYM"
 148 |     SDL_PIPEWIRE_SYM(pw_main_loop_new);
```

g++-14 complains:

```
SDL_pipewire.c:129:42: error: assignment to "struct pw_main_loop *
(*)(const struct pw_main_loop *)" from incompatible pointer type
"struct pw_main_loop * (*)(const struct spa_dict *)"
[-Wincompatible-pointer-types]
```
2024-08-19 14:26:08 -07:00
Ryan C. Gordon 405693175d
camera: Fixed Emscripten support. 2024-08-19 14:15:47 -04:00
Ryan C. Gordon 9c5bd98a0f
assert: Added SDL_HINT_ASSERT.
Same environment variable, but now accessible as a formal SDL hint.

Reference PR #10171.
2024-08-18 20:53:55 -04:00
Sam Lantinga 59ac561062 PSP: Throw SDL_EVENT_QUIT event upon exit (thanks @sharkwouter!)
Closes https://github.com/libsdl-org/SDL/pull/10565
2024-08-18 08:25:44 -07:00
ds-sloth 7d78835f87
SDL_iostream.c: stdio_seek - skip API call for SEEK_CUR with 0 offset
Fixes #10556.
2024-08-16 17:13:49 -04:00
Sam Lantinga 438a214420 Changed main callback return values to an enumeration
Fixes https://github.com/libsdl-org/SDL/issues/10515
2024-08-16 11:16:05 -07:00
Sam Lantinga 83adcb9d38 Added SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER
This is undocumented since the individual flags are separate window creation properties, but it's useful to have a shared definition for this, which is used internally and for migrating code from SDL2.
2024-08-15 13:33:06 -07:00
Sam Lantinga d7b027a241 Namespace the object creation properties
Fixes https://github.com/libsdl-org/SDL/issues/10543
2024-08-15 12:56:04 -07:00
Sam Lantinga 8e99ec34bb Use drmModeAddFB() if drmModeAddFB2WithModifiers() fails
Fixes https://github.com/libsdl-org/SDL/issues/10276
2024-08-15 11:51:46 -07:00
Sam Lantinga 41f1c83caa If scaling fails, fall back to the closest image available in SDL_GetSurfaceImage() 2024-08-15 07:38:43 -07:00
Kaktus514 3586df3151 Prefer downscaling in SDL_GetSurfaceImage.
This implements the ideas described in  #10536
2024-08-15 07:28:31 -07:00
Anonymous Maarten 612b41c451 camera: use cdevice SDL_Event union member 2024-08-15 09:20:34 -04:00
Sam Lantinga efdcfef4b9 Fixed Android build warnings 2024-08-13 10:52:50 -07:00
Ilya Mizus ce98550cbb
Fixed secondary screens on KMSDRM (#10535)
* Removed window movement to left top corner that breaks secondary screens on KMSDRM
2024-08-13 07:15:12 -07:00
Frank Praznik 76b35ae76f
wayland: Minor code-style cleanups 2024-08-13 09:56:03 -04:00
Sam Lantinga 375f303d97 Improved color accuracy blitting floating point surfaces to 8-bit indexed surfaces 2024-08-12 11:50:32 -07:00
Dragon-Baroque e87647c351 Support SDL_EVENT_DROP_TEXT in Wayland
src/video/wayland/SDL_waylanddatamanager.c
    Log data + primary_selection _offer_receive
  src/video/wayland/SDL_waylandevents.c + SDL_waylanddatamanager.h
    Log data + primary_selection events
    Split FILE vs TEXT events : booleans has_mime_ text + file
    Handle text/plain;charset=utf-8 data offer
2024-08-12 14:16:38 -04:00
Sam Lantinga 755e201aa5 Improved color accuracy blitting to 8-bit indexed surfaces
Fixes https://github.com/libsdl-org/SDL/issues/10519
2024-08-12 09:22:59 -07:00
Ryan C. Gordon 67e0156346
pen: Fixed a comment about Web APIs.
(Emscripten has nothing to do with this limitation, as this is what the
Javascript Pointer Events API offers.)
2024-08-12 00:58:27 -04:00
Ryan C. Gordon b975babfa5
pen: Emscripten support!
Reference Issue #10516.
2024-08-11 18:00:13 -04:00
Ryan C. Gordon bec701dd04
pen: Add support for tangential pressure axis. 2024-08-11 18:00:13 -04:00
Mathieu Eyraud 5de3d1e9cc Fix error handling of SDL_AddHintCallback 2024-08-11 06:59:10 -07:00
Mathieu Eyraud 45bfa8e5e7 Fix xsettings list copy
If there is only 1 element in the list or memory allocation fails on the 2nd iteration then new->next is uninitialised.
2024-08-11 06:58:03 -07:00
Mathieu Eyraud dcc3dd4c7c Remove stray return statement 2024-08-11 06:57:01 -07:00
Sam Lantinga 15a19bd69f Convert bitmap surface to RGBA for scaling
Scaling bitmaps isn't currently supported, so we convert to RGBA for now.
2024-08-10 16:43:27 -07:00
Ozkan Sezer f93920a4f1 video, x11: fix linkage if SDL_VIDEO_DRIVER_X11_XINPUT2 isn't defined. 2024-08-10 15:55:00 +03:00
Ryan C. Gordon b4ca15b654 pen: Added Cocoa backend. 2024-08-09 22:09:23 -04:00
Ryan C. Gordon a9d70dbacb pen: Rework public API.
This changes the API in various ways, and updates the backends for this.

Overall, this is a massive simplification of the API, as most future backends
can't support the previously-offered API.

This also removes the testautomation pen code (not only did these interfaces
change completely, it also did something no other test did: mock the internal
API), and replaces testpen.c with a different implementation (the existing
code was fine, it was just easier to start from scratch than update it).
2024-08-09 22:09:23 -04:00
Sam Lantinga 2b853121fe Allow environment hint overrides before hints are initialized
Fixes https://github.com/libsdl-org/SDL/issues/10514
2024-08-09 13:26:49 -07:00
Sam Lantinga c2085dad8f Added SDL_HINT_JOYSTICK_GAMEINPUT 2024-08-09 09:56:47 -07:00
Sam Lantinga 0acf8343bb Fixed crash if pipewire doesn't detect any devices and doesn't end up being used.
Fixes https://github.com/libsdl-org/SDL/issues/10511
2024-08-09 08:08:32 -07:00
KaJe e1571d704d Add Cammus C12 VID & PID to wheel device list.
Add Cammus C12 in the SDL wheel list to enable wheel detection for them.
2024-08-09 06:48:14 -07:00
Sam Lantinga 4cc3410dce Added SDL_GetAudioFormatName()
Fixes https://github.com/libsdl-org/SDL/issues/10489
2024-08-08 15:05:37 -07:00
Sam Lantinga 74504e0965 cocoa: removed relative mode handling on focus change
This is now being done at a higher level, so we don't want to duplicate it here.

Fixes the mouse cursor staying hidden if you enable relative mode, alt-tab away and then alt-tab back.
2024-08-08 13:26:50 -07:00
Frank Praznik ae8065e1ec Use more stringent criteria for entering warp emulation mode
Require more than one warp to the window center within a certain timespan (currently 30ms, but can be tweaked) to better avoid erroneously entering warp emulation mode.

This also correctly resets the warp emulation mode activation if the window loses and regains focus.
2024-08-08 10:56:20 -07:00
Sam Lantinga 1a57ea7fba kmsdrm: free the connector when looking for available devices
Fixes https://github.com/libsdl-org/SDL/issues/10499
2024-08-08 09:28:45 -07:00
Anonymous Maarten 5cd6923298 Assert a valid window pointer instead of dismissing an invalid pointer
Throwing an assertion and breaking the program should allow developers
to catch wrong usage of the API faster.

Follow-up of 9493e6974f
2024-08-08 10:11:39 +00:00
Anonymous Maarten 125ce71379 SDL_Log: avoid sending text to the debug stream twice
When debugging a GUI application in Visual Studio,
text printed with fprintf(stderr) will also be sent to the debug stream.

When buiding SDL with SDL_LIBC=ON, this patch makes logging skip
OutputDebugString and rely on fprintf(stderr) to send the text to
the debugger.
2024-08-08 10:11:39 +00:00
Sylvain bd7d4a3752
Add comment about randomOrder and random seed 2024-08-08 10:21:42 +02:00
Sam Lantinga b5b868044f Include GameInput.h as gameinput.h for compatibility with non-MSVC toolchains 2024-08-07 17:57:33 -07:00
Sam Lantinga 4c3f9159e9 Allow building with older versions of GameInput.h 2024-08-07 17:57:33 -07:00
Sam Lantinga 889a788913 Fixed build warnings 2024-08-07 17:57:33 -07:00
Sam Lantinga a38cd7a067 Added checks for GameInput.h to the build system 2024-08-07 17:57:33 -07:00
Sam Lantinga ae076bdc2a Take the joystick lock when processing GameInput device callbacks 2024-08-07 17:57:33 -07:00
Sam Lantinga 28ef6bcc38 Use the correct timestamp from the GameInput controller reading 2024-08-07 17:57:33 -07:00
Sam Lantinga 5cab979f21 Added support for the Guide and Share buttons on GameInput controllers 2024-08-07 17:57:33 -07:00
Sam Lantinga 3ec19b2a89 Removed duplicate call to SDL_AssertJoysticksLocked() 2024-08-07 17:57:33 -07:00
Sam Lantinga 9493e6974f Validate window pointer before sending events for it
If there are bugs it's possible that the window pointer is invalid. Double check it before sending the application events and potentially dereferencing it.

This showed up in https://github.com/libsdl-org/SDL/issues/10494 as a window getting mouse focus as it was being destroyed and then crashing later when mouse focus was set to a different window.
2024-08-07 12:28:10 -07:00
Sam Lantinga 91d97a367e Fixed crash when the current mouse capture window is destroyed
Fixes https://github.com/libsdl-org/SDL/issues/10494
2024-08-07 12:28:10 -07:00
Sam Lantinga a7e425497b Added a FIXME to lock the joystick list and update the GameInput joystick support 2024-08-07 12:19:09 -07:00
Sam Lantinga 001dbc5da8 Added support for raw mouse and keyboard using GameInput on Windows
Fixes https://github.com/libsdl-org/SDL/issues/10442
2024-08-07 12:19:09 -07:00
Sam Lantinga 8fdca9c691 Clear intermediate errors if we successfully create a window. 2024-08-07 12:17:52 -07:00
Sylvain 2428d906f1
Remove extra ';' 2024-08-07 19:14:09 +02:00
Anonymous Maarten 7b97fd3b44 SDLDropTarget_Drop: use SDL_strlen instead of strlen 2024-08-07 11:50:22 +02:00
Sylvain a57c566988 Add internal SDL_UpdateTextureFromSurface(), making SDL_CreateTextureFromSurface() lighter 2024-08-07 10:42:47 +02:00
Sylvain 20a6193eaa Run test suites and test cases in non-linear order (see libsdl-org#9303) 2024-08-07 10:25:30 +02:00
Sam Lantinga fe5dcf79be Reset log prefixes on SDL_Quit() 2024-08-06 13:55:40 -07:00
Ethan Lee 15bfef57cd d3d12: Generate Xbox C macros, adjust SDL_Render files accordingly 2024-08-06 16:05:10 -04:00
hsnovel 83d1d1c053 add failsafe for querying cache line size on linux 2024-08-06 10:26:09 -07:00
Anonymous Maarten 0fa2049fef
Document iconv functions + add testautomation (#10131)
* stdinc: document SDL_iconv* functions
* iconv: add automation tests
* iconv: don't potentially crash on invalid inputs
2024-08-06 10:12:25 -07:00
Frank Praznik 0e37bc7c3f
wayland: Bail out if a null cached cursor is returned 2024-08-06 11:17:13 -04:00
Frank Praznik 10abe1a75b
wayland: Free the scaled cursor surface if SHM allocation fails 2024-08-06 11:15:15 -04:00
Sam Lantinga 627cb8acd0 SDL_EventFilter functions now return SDL_bool 2024-08-06 07:59:45 -07:00
Sam Lantinga 57f9c6f7bb Renamed SDL_Get/SetRelativeMouseMode to SDL_Get/SetWindowRelativeMouseMode()
Fixes https://github.com/libsdl-org/SDL/issues/10041
2024-08-06 07:59:45 -07:00
Frank Praznik e612ce511b wayland: Add support for high-DPI custom cursors
Add a cursor caching system and viewport support, to allow for high-DPI, fractionally-scaled, custom cursors.
2024-08-06 10:55:13 -04:00
Dragon-Baroque ca127106ee Add MIME targets to SDL_EVENT_DROP_TEXT in X11
src/video/x11/SDL_x11events.c
    Add Text targets "text/plain;charset=utf-8",
      "UTF8_STRING", "TEXT" to "text/plain".
2024-08-06 05:49:38 -07:00
Sam Lantinga 44927fe5e3 Added detail about why a file couldn't be opened (thanks mgerhardy!)
Fixes https://github.com/libsdl-org/SDL/issues/10484

(cherry picked from commit 1512013320)
2024-08-06 05:48:26 -07:00
Sam Lantinga a1998d106d Putting the simple back into Simple DirectMedia Layer 2024-08-05 21:20:26 -07:00
Sam Lantinga 725b95dc84 Fixed SDL_GetDefaultScancodeFromKey() 2024-08-05 19:46:45 -07:00
Sam Lantinga afec46dbee Re-added SDL_GetScancodeFromKey() 2024-08-05 19:46:45 -07:00
Sam Lantinga 4f7c0e7c46 Fixed key names for non-latin keyboard layouts 2024-08-05 19:46:45 -07:00
Sam Lantinga ac7df9d01f Removed acquire/release of keymaps, which isn't needed internally. 2024-08-05 19:46:45 -07:00
Sam Lantinga a13c993e40 Removed keymaps from the API
This is unnecessary complication for applications. We can always add it again later if we find that it's really useful.
2024-08-05 19:46:45 -07:00
Sam Lantinga c298a3749b Expose the keymap separately from the event keycode
This adds functions to query the keymap:
* SDL_GetCurrentKeymap()
* SDL_GetKeymapKeycode()
* SDL_GetKeymapScancode()
* SDL_ReleaseKeymap()

and these are distinct from the function to query the event keycode associated with a scancode, which might be affected by SDL_HINT_KEYCODE_OPTIONS.

Also added an SDL_bool parameter to SDL_GetKeyName() and SDL_GetKeyFromName() to enable upper case handling of the name.
2024-08-05 17:02:25 -07:00
Sam Lantinga d68d32e12c Revert "Removing a timer that isn't running is a success."
This reverts commit 795499a529.

This breaks compatibility with SDL2 and there isn't a compelling reason to make this change.
2024-08-05 10:39:33 -07:00
Sam Lantinga 4073c4910e Enable KEYCODE_OPTION_LATIN_LETTERS by default
It turns out that the non-Latin keyboards (Russian, Thai, Greek, etc.) are almost all QWERTY layout plus native language labels. Feedback from users is that they expect to see the ASCII keycodes and key names when using those keyboards, so we'll enable this option by default.
2024-08-05 10:00:02 -07:00
Sam Lantinga d7256a77db The KEYCODE_OPTION_LATIN_LETTERS uses the full QWERTY layout
This makes sure we use ']' instead of 'ъ' for the ']' key on the Russian keyboard layout, for example.
2024-08-05 10:00:02 -07:00
Sam Lantinga eac8e858d5 Fixed key names for Thai keyboards
Using the shifted versions of keys for the key names doesn't make any sense on the Thai keyboard. Thai keyboards are QWERTY plus Thai characters, so let's use the ASCII key names.
2024-08-05 10:00:02 -07:00
Sam Lantinga b7aca89466 Fixed key names when KEYCODE_OPTION_LATIN_LETTERS is enabled 2024-08-05 10:00:02 -07:00
Sam Lantinga a82f19f690 Use the shifted version of the letter as the key name
SDL_Keycode is defined as the unshifted key on the keyboard, but the key name is defined as the letter printed on that key, which is usually the shifted capital letter.

Fixes https://github.com/libsdl-org/SDL/issues/5836
2024-08-05 10:00:02 -07:00
Sam Lantinga 6161c437c7 Added SDL_SetLogPriorityPrefix()
SDL_Log() no longer prints a log prefix by default for SDL_LOG_PRIORITY_INFO and below. The log prefixes can be customized with SDL_SetLogPriorityPrefix().
2024-08-05 09:02:50 -07:00
Ryan C. Gordon 074dd8c35f
hints: Change hints to be backed by Properties, add documentation. (#9892)
This makes the subsystem thread-safe, more performant, and cleans up the code a little.

Also removed SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, since setting this hint programmatically initializes properties, which creates a lock, so we can't check hints while creating locks. The slim reader-writer locks have been the default for ages and are solid, so we'll just use those when available.
2024-08-05 09:02:28 -07:00
Sam Lantinga 746b8eb14b Added SDL_HINT_MUTE_CONSOLE_KEYBOARD 2024-08-05 08:54:10 -07:00
Sam Lantinga afde1cc9c2 Added SDL_HINT_EVDEV_DEVICES 2024-08-05 08:54:10 -07:00
Sam Lantinga 6f399c3beb Note that SDL_HAPTIC_GAIN_MAX should remain an environment variable. 2024-08-05 08:54:10 -07:00
Sam Lantinga 0da346f129 Added SDL_HINT_HIDAPI_LIBUSB, SDL_HINT_HIDAPI_LIBUSB_WHITELIST, and SDL_HINT_HIDAPI_UDEV 2024-08-05 08:54:10 -07:00
Sam Lantinga 8a5b9559dc Removed the SDL_VIDEO_NGAGE_SAVE_FRAMES environment variable
Display updating is now implemented, presumably we don't need to be able to dump frames for debugging.
2024-08-05 08:54:10 -07:00
Sam Lantinga d9f9e9e764 Added SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES and SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES 2024-08-05 08:54:10 -07:00
Sam Lantinga f370e1a645 Removed the SDL_ALTIVEC_BLIT_FEATURES environment variable.
This code has long since been tested, and none of the developers have an Altivec CPU.
2024-08-05 08:54:10 -07:00
Sam Lantinga 95adcc522f Allow SDL hints to override OpenGL extension availability 2024-08-05 08:54:10 -07:00
Sam Lantinga a97dadf779 Added hints to replace environment variables on the PlayStation Vita 2024-08-05 08:54:10 -07:00
Sam Lantinga 3669d1e76a Added SDL_HINT_VULKAN_DISPLAY 2024-08-05 08:54:10 -07:00
Sam Lantinga 997df06320 Added SDL_HINT_X11_XCB_LIBRARY 2024-08-05 08:54:10 -07:00
Sam Lantinga 175f28f59f Added SDL_HINT_VIDEO_X11_NODIRECTCOLOR 2024-08-05 08:54:10 -07:00
Sam Lantinga 8cde570ad9 Added SDL_HINT_VIDEO_X11_VISUALID 2024-08-05 08:54:10 -07:00
Sam Lantinga 05f870f20d Added SDL_HINT_OPENGL_LIBRARY and SDL_HINT_VULKAN_LIBRARY 2024-08-05 08:54:10 -07:00
Sam Lantinga c9b2bfa7c1 Added SDL_HINT_AUDIO_DISK_INPUT_FILE, SDL_HINT_AUDIO_DISK_OUTPUT_FILE, and SDL_HINT_AUDIO_DISK_TIMESCALE 2024-08-05 08:54:10 -07:00
Sam Lantinga e1ee0e748d Added SDL_HINT_WAVE_CHUNK_LIMIT 2024-08-05 08:54:10 -07:00
Sam Lantinga a4dc130d7e Removed the SDL_PATH_DSP environment variable from the NetBSD and OSS audio driver
The AUDIODEV environment variable is no longer used by other audio drivers, and can be used exclusively to specify the DSP audio device.
2024-08-05 08:54:10 -07:00
Sam Lantinga f3fcc41a4e Removed the AUDIODEV environment variable from the sndio audio driver
The sndio documentation says that the AUDIODEVICE environment variable is used when the device is opened with SIO_DEVANY.
2024-08-05 08:54:10 -07:00
Sam Lantinga ff0e42c51c Removed the SDL_AUDIO_ALSA_DEBUG environment variable
The debug info is available if you set SDL_HINT_LOGGING to "audio=debug"
2024-08-05 08:54:10 -07:00
Sam Lantinga f05cd85048 Added SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE 2024-08-05 08:54:10 -07:00
Sam Lantinga 71574ac985 Added SDL_HINT_AUDIO_DUMMY_TIMESCALE 2024-08-05 08:54:10 -07:00
Sam Lantinga 5aa1a48ac3 Added SDL_HINT_AUDIO_FREQUENCY, SDL_HINT_AUDIO_CHANNELS, and SDL_HINT_AUDIO_FORMAT 2024-08-05 08:54:10 -07:00
hwsmm 4f343f96b4 Fix name discrepancy in Android JNI 2024-08-05 05:46:39 -07:00
Anonymous Maarten e631fdfbd2 gdk: show dialog when xgameruntime.dll is not installed 2024-08-05 09:18:21 +00:00
Sam Lantinga 881e2bc344 Fixed build 2024-08-04 20:34:10 -07:00
Sam Lantinga f59d66f4b1 Implemented left-justification in SDL_PrintString()
Fixes https://github.com/libsdl-org/SDL/issues/10310
2024-08-04 20:04:58 -07:00
Sam Lantinga 795499a529 Removing a timer that isn't running is a success. 2024-08-04 20:00:13 -07:00
Ethan Lee 4bea89e945 Xbox buildfixes 2024-08-04 15:54:22 -04:00
Sam Lantinga 66cb2153cc Handle Colemak swapping of CapsLock and Backspace
Fixes https://github.com/libsdl-org/SDL/issues/7853
2024-08-04 10:30:19 -07:00
Sam Lantinga c709385856 Enable events for external X11 windows
Fixes https://github.com/libsdl-org/SDL/issues/3825
Fixes https://github.com/libsdl-org/SDL/issues/5142
Fixes https://github.com/libsdl-org/SDL/issues/9503
2024-08-04 09:07:19 -07:00
Sam Lantinga ef6521aee7 testnative: print events with --info event 2024-08-04 09:07:19 -07:00
Sam Lantinga 6f6f4fbfd3 Updated X11 event debugging 2024-08-04 09:07:19 -07:00
Frank Praznik ca2c9f680b video: Support multiple video driver entries having the same name string
Allow multiple bootstrap entries for a single video driver with the same name, which internally allows preferential and fallback init conditions while hiding the implementation details from applications (e.g. applications will just see "wayland", regardless of whether it's using the preferred or fallback driver list entry).

If a driver is requested, all instances of it in the list will be tried before reporting failure, and client applications programmatically enumerating the video drivers will be presented with a deduplicated list of entries.
2024-08-03 06:55:24 -07:00
Joshua Ashton ab916a959e video: Only prefer Wayland if fifo-v1 and commit-timing-v1 are available
Wayland has a myriad of unresolved problems regarding surface suspension
blocking forever in QueuePresent/SwapBuffers when occludedand the FIFO
(vsync) implementation being fundamentally broken leading to reduced
GPU-bound performance and 'barcoding' frametimes due to swapchain
starvation.

There are two protocols used to solve these two problems together --
fifo-v1 and commit-timing-v1, which implement the commit queue on the
compositor side, and a timestamp that frames are intended to be
displayed for/discarded respectfully.

To avoid severe performance regressions for developers targeting SDL3,
only pick Wayland as the default backend when these two protocols are
supported -- otherwise fallback to X11/XWayland.

We do this by having two VideoBootStraps, one which is tests the
preferred case, "wayland_preferred" (ie. if fifo-v1 + commit-timing-v1
are available init time), and the fallback, which is just "wayland",
the same name as before, which does no such tests.
Thus, forcing with SDL_VIDEO_DRIVER=wayland will go onto the fallback
option, and pick Wayland always, as usual, so there is no behaviour
change.

In the case that X11/XWayland is not available (ie. no DISPLAY), we will
still fallback to using Wayland without these protocols available.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2024-08-03 06:55:24 -07:00
Susko3 e3cf20e1cc
Remove `createSDLMainRunnable()` in favour of `main()` to fix multiple issues when providing custom main/runnable code (#10434)
This allows managed applications (eg. Java, C#) to override main() to their liking.
2024-08-03 06:34:38 -07:00
Sam Lantinga 2c0fcf27e8 Don't use alloca() in a loop, we might overflow the stack. 2024-08-02 21:38:29 -07:00
Sam Lantinga f7c8d66ccb Use the convenience function SDL_GetWindowFromEvent() 2024-08-02 20:36:35 -07:00
Sam Lantinga 8d748d64e8 Fixed compiler warning building for macOS 2024-08-02 20:27:33 -07:00
Anonymous Maarten f57c597c60 Added SDL_GetWindowFromEvent 2024-08-03 02:37:11 +00:00
Sam Lantinga 79f4de9f7e Use SDL_PROP_APP_METADATA_IDENTIFIER_STRING for the app ID 2024-08-02 19:36:31 -07:00
Sam Lantinga cea71fbfcc SDL_cocoakeyboard: Fix errant semicolons in sendPendingKey and clearPendingKey definitions
- These are ignored by Clang but produce a warning: "semicolon before method body is ignored"
2024-08-02 18:55:30 -07:00
Sam Lantinga 2c1d40a9eb Added an error message when SDL_GetWindowFromID() fails 2024-08-02 18:43:24 -07:00