Commit Graph

11462 Commits

Author SHA1 Message Date
Semphris 43b54b3d72 Fix Windows dialog folder titles
Same fix as in cf946e32ba, which was not done for the folder implementation.
2025-01-19 08:19:40 -08:00
Ryan C. Gordon 32965b4bf1
pen: Send virtual mouse motion without a button press when a pen is hovering.
Fixes #11470.
2025-01-18 21:51:03 -05:00
Ryan C. Gordon 5da9d4ecc2 cocoa: Slightly better display hotplugging detection.
Fixes #12016.
2025-01-18 17:02:37 -05:00
Semphris 19f42094bb Fix Windows fie dialog args freeing 2025-01-18 13:53:56 -08:00
Semphris 721fc7de0b Correct spacing of pointers ('a* b;' -> 'a *b;') 2025-01-18 13:53:56 -08:00
Semphris cd269730eb Fix Windows dialog memory management 2025-01-18 13:53:56 -08:00
Sam Lantinga 049a8f0e52 Use SDL_calloc() instead of SDL_malloc()
This automatically initializes memory to zero so you don't have uninitialized memory bugs
2025-01-18 13:41:23 -08:00
Semphris 354d2c390c Initialize invalid parent_{tray,entry} to NULL
The API states that the related functions must return NULL if the function
called (get the parent tray, or get the parent entry) is invalid for this
menu. Initialising the fields to NULL makes that API correct for Windows.
2025-01-18 16:17:16 -05:00
Semphris b79ada6aa5 Windows trays: Fix ParentEntry & Enabling
The test/testtray program would crash on Windows when adding any item and then removing it, because a submenu's parent_entry field was not set.

Additionally, I noticed that some extraneous code copied from the {G,S}etTrayEntryChecked made {G,S}etTrayEntryEnabled work only for checkboxes, which is not the desired behavior.

Both issues were fixed in this commit.
2025-01-18 16:17:16 -05:00
Sam Lantinga ba95c54f99 macOS: get the correct display name on macOS 10.15+ 2025-01-18 09:42:37 -08:00
Frank Praznik 42e0fb10f8
wayland: Set the mouse state before calling the hit test callback
Update the mouse state before entering the hit test, in case the global state is queried, or the system menu opened, while in the client hit testing callback.
2025-01-18 12:10:25 -05:00
Sam Lantinga cd0db8d35e Added Linux evdev mappings for the Wireless HORIPAD For Steam 2025-01-18 08:09:25 -08:00
Ryan C. Gordon 1d7a681e4d
Revert "emscripten: resizable windows take whole page, resize with browser window."
This reverts commit d317fc9c08.

This has some issues, we'll revisit it for 3.4.0.

Reference Issue #11949.
2025-01-18 10:15:43 -05:00
Sam Lantinga c7d1fd90ea Added support for the 8BitDo Ultimate 2C Wireless in Bluetooth mode
Closes https://github.com/libsdl-org/SDL/pull/11415
2025-01-18 07:06:46 -08:00
Sam Lantinga 923123a527 emscripten: Let SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT accept "#none"
This is used to say "don't even try to listen for keypresses," for apps that
are managing this outside of SDL.

Fixes #10292.
2025-01-18 06:19:27 -08:00
Sam Lantinga c603a9c94a Moved flag documentation 2025-01-18 06:16:10 -08:00
Sam Lantinga 90b7174a7d Respect the SDL_BORDERLESS_RESIZABLE_STYLE hint, but default it to true. 2025-01-18 06:07:06 -08:00
Ryan C. Gordon 6a72d32d41
emscripten: Let SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT accept "".
This is used to say "don't even try to listen for keypresses," for apps that
are managing this outside of SDL.

Fixes #10292.
2025-01-18 08:43:55 -05:00
Ryan C. Gordon f3a39074b0
windows: use WS_THICKFRAME style on borderless windows.
This is apparently necessary in newer Windows releases (Windows 10 and later?)
to allow hit-testing to resize the window.

Fixes #8406.
2025-01-18 08:38:49 -05:00
Ryan C. Gordon 010f27dc70
storage: enumerate and glob on storage can accept a NULL path.
This will be treated as the root of the storage tree.
2025-01-17 20:11:50 -05:00
Ryan C. Gordon a6a8598b98
storage: deal with paths with Windows '\\' path separators appended.
Reference Issue #11986.
2025-01-17 20:11:50 -05:00
Sam Lantinga 7c6adc1ca7 gpu renderer: removed unused sampler slots
There used to be 3 scale modes, now there are only 2.
2025-01-17 16:31:40 -08:00
Ryan C. Gordon d317fc9c08
emscripten: resizable windows take whole page, resize with browser window.
This also implements the SetWindowResizable interface, so this can be now
toggled after window creation, too.

Fixes #11949.
2025-01-17 17:59:28 -05:00
Sam Lantinga 59ea078ee2 x11: check to see if displays moved when connected/disconnected
Fixes https://github.com/libsdl-org/SDL/issues/9738
2025-01-17 13:14:16 -08:00
Frank Praznik 1848ce680b win32: Use the window coordinates to get the monitor when de-minimizing a maximized window
MonitorFromWindow can fail if called on a window being de-minimized, so fall back to using the monitor from the last window coordinates if initial retrieval fails.
2025-01-17 15:46:18 -05:00
Sam Lantinga 656c519cca Fixed warning C6313: Incorrect operator. Use an equality test to check for zero-valued flags. 2025-01-17 12:08:58 -08:00
ROllerozxa cdc5483cf9 Vita: Fix off-by-one error for synthetic mouse events 2025-01-16 11:58:01 -08:00
Sam Lantinga eb168e410c Updated to version 3.1.11 for development 2025-01-16 11:41:28 -08:00
Frank Praznik b96bb152c2
wayland: Don't redundantly set the border state when showing a window
They are now set before the initial configure.
2025-01-16 13:54:39 -05:00
Frank Praznik 5a564a718d
wayland: Add a dummy function for the libdecor dismiss popup callback
This was never added, and we've been lucky that it's never called as libdecor doesn't check the function pointer for null before doing so.
2025-01-16 13:48:16 -05:00
Frank Praznik 9f6eeb1095
wayland: Set the border state before the initial configure
This allows the toplevel bounds to be set correctly on borderless windows.
2025-01-16 13:40:31 -05:00
Ethan Lee 326ce9bb8d gpu: D3D12 buildfix for Xbox 2025-01-16 12:19:59 -05:00
Ethan Lee c95b842b30 video: Xbox does not use CreateIconFromSurface 2025-01-16 12:19:46 -05:00
Frank Praznik 7ee2ab3830
wayland: Fix return value check from int-to-bool conversion 2025-01-16 11:52:16 -05:00
Sam Lantinga 1dd8fadca2 Updated to version 3.1.10 for the release candidate 2025-01-16 08:33:18 -08:00
Ryan C. Gordon 3ffb1a8cbd storage: generic title storage allows override paths without '/' appended.
Fixes #11299.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon 874c07f8de storage: Don't allow "." and ".." paths, enforce '/' dir separators.
Also clarify what characters are valid for Storage paths in the category docs.

Fixes #11079.
Fixes #11370.
Fixes #11369.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon eb793dede7 filesystem: SDL_GetCurrentDirectory() should add a path separator at the end. 2025-01-16 08:19:28 -05:00
Ryan C. Gordon 87e1b0eb89 filesystem: SDL_EnumerateDirectory() gives dirs with path seperators appended.
Fixes #11065.
Fixes #11427.
2025-01-16 08:19:28 -05:00
Ramez Ragaa e98ee9bb04 Adjust testgl.c to test gl_release_behavior 2025-01-16 08:19:05 -05:00
Ryan C. Gordon 3424ec948c video: SDL_GL_GetAttribute gets correct SDL_GL_CONTEXT_RELEASE_BEHAVIOR value.
Original patch was from @ramezgerges (thanks!).

Fixes #11697.
2025-01-16 08:19:05 -05:00
Ryan C. Gordon 4d63a2b882 io: Renamed src/file to src/io
Fixes #11980.
2025-01-16 08:18:40 -05:00
Sam Lantinga ea642fe9ff
cocoa: clear mouse focus based on NSEventTypeMouseExited events (#11991)
We can't directly set the mouse focus since we may get spammed by entered/exited events,
but we can process the current focus later in the mouseMoved handler in line with the
mouse motion event sequence.

Fixes https://github.com/libsdl-org/SDL/issues/8188
2025-01-15 23:34:20 -08:00
Sam Lantinga 2c7b7d1d33 Keep the lifecycle observer active while there are windows active
Fixes https://github.com/libsdl-org/SDL/issues/11627
2025-01-15 17:10:49 -08:00
cosmonaut 355f69ebfe GPU: Ensure thread safety of Vulkan resource creation 2025-01-15 13:45:43 -08:00
Frank Praznik c9d602307c cocoa: Only process hit tests on left clicks
Otherwise, right-click events over drag areas will be eaten.
2025-01-15 15:44:01 -05:00
Frank Praznik dd0bdc2561 win32: Pass through non-left mouse button presses when over draggable areas
Returning anything other an HTCLIENT result will cause windows to eat the button press, so ensure that non-left presses are passed through to the client over draggable areas.
2025-01-15 15:44:01 -05:00
Ryan C. Gordon 84d35587ee
filesystem: SDL_SYS_EnumerateDirectory inexplicably takes the same arg twice. 2025-01-15 14:09:33 -05:00
Sam Lantinga fc9b2478d8 windows: don't set focus click pending if SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH is set
Fixes https://github.com/libsdl-org/SDL/issues/11976
2025-01-15 10:54:12 -08:00
Sam Lantinga 18d21b36fe windows: use the initial rect to anchor fixed aspect ratio resizing
Fixes https://github.com/libsdl-org/SDL/issues/11688
2025-01-15 10:33:22 -08:00
Sam Lantinga 1995471927 cocoa: fixed resizing windows with fixed aspect ratio
The existing algorithm works well for min-max ratios, but didn't allow edge expansion of fixed aspect ratio windows. Use NSWindow setContentAspectRatio instead.
2025-01-15 10:05:34 -08:00
Sam Lantinga 67382e9c83 Fixed detection of function keys on Emscripten
Fixes https://github.com/libsdl-org/SDL/issues/11973
2025-01-15 08:07:38 -08:00
Sam Lantinga 23410debf7 SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs 2025-01-15 00:01:06 -08:00
Petar Popovic 8ce176b59a SDL_GetMouseNameForID(): Set an error message for invalid mouse IDs. 2025-01-14 23:59:49 -08:00
Sam Lantinga 51fa076fdc Don't send normal keyboard events if no application window has focus
This can happen if all the windows shown have the SDL_WINDOW_NOT_FOCUSABLE flag. We'll still accept modifier state changes though, so you can do Control-click actions.
2025-01-14 23:44:43 -08:00
Sam Lantinga a446381ea9 Tooltips and unfocusable windows can't become main windows 2025-01-14 23:44:43 -08:00
Ryan C. Gordon ebb24eedc8 mouse: Clean up virtual touch devices as appropriate. 2025-01-15 02:19:59 -05:00
Ryan C. Gordon dabc93a631 pen: Send virtual mouse and touch events for pen input.
Fixes #11948.
2025-01-15 02:19:59 -05:00
ImThour 169c8d5140 Fix incorrect hotspot calculation for cursor positioning
Corrected the calculation of the vertical hotspot position in the `GetCachedCursor` function.

Changed the variable from `data->hot_x` to `data->hot_y` to ensure the correct vertical position of the cursor's hotspot is used when scaling.
2025-01-14 22:37:24 -08:00
Sam Lantinga 8e9c44bc3b Fixed accidental removal of optional delegate interface check
Fixes https://github.com/libsdl-org/SDL/issues/11970
2025-01-14 22:35:13 -08:00
Sam Lantinga 4dd585fb62 coreaudio: convert MPEG channel layout to WAVE channel layout 2025-01-14 22:26:16 -08:00
Sam Lantinga 81e57147f8 Child windows shouldn't take focus if the parent window is in relative mouse mode
Fixes https://github.com/libsdl-org/SDL/issues/11807 on Windows
2025-01-14 21:27:06 -08:00
Sam Lantinga 1ab61635a9 Use SDL_Log() for keyboard debugging. 2025-01-14 19:05:07 -08:00
Sam Lantinga 0eaa6197c5 Removed unnecessary __builtin_available check 2025-01-14 17:00:30 -08:00
Sam Lantinga ffe194c52e Fixed build when SDL_JOYSTICK_MFI isn't enabled 2025-01-14 17:00:30 -08:00
Sam Lantinga 49dd24e195 Fixed potentially overlapping memcpy() to use memmove() 2025-01-14 14:31:20 -08:00
Green Sky 191a6417d5 events: use SDL_memmove instead of SDL_memcpy for overlapping memory 2025-01-14 14:20:32 -08:00
Ryan C. Gordon 9e60a8994f
audio: Allow streams to change the device-side channels maps.
Fixes #11881.
2025-01-14 16:42:53 -05:00
Sam Lantinga 5ca735b40f Only use WAVE surround sound channel layouts on macOS 10.15+ 2025-01-14 12:03:07 -08:00
Sam Lantinga cdde6dd7bb Bumped deployment requirements for Apple platforms
We require at least Xcode 12.2 and macOS SDK 11 to build. We support deploying to macOS 10.13, iOS 11.0, and tvOS 11.0.

This cleans up the code significantly
2025-01-14 12:03:07 -08:00
cosmonaut 4294c06836 GPU: Check texture format support in pipeline creation 2025-01-14 10:16:20 -08:00
Scrooge86x 0aa319e4f9 Added support for custom tray icon on Windows via SDL hints.
SDL_CreateTray now respects SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL
and SDL_HINT_WINDOWS_INTRESOURCE_ICON hints and uses the specified icon
as the tray icon.
2025-01-13 18:35:49 -08:00
cosmonaut d590e1f122 GPU: Align D3D12 clear properties to naming convention 2025-01-13 17:38:21 -08:00
Evan Hemsley fb6df93384
GPU: Add name properties to resources (#11946) 2025-01-13 17:29:08 -08:00
Ryan C. Gordon 3766a39409
emscripten: double the audio buffer size.
Some systems seem to not keep up with the smaller buffer.

Reference Issue #11930.
2025-01-13 16:26:18 -05:00
Ryan C. Gordon 4bddf521dd
emscripten: Override emscripten's fullscreen button with SDL's implementation.
Fixes #6798.
Fixes #7913.
Fixes #9044.
2025-01-13 14:17:36 -05:00
Sam Lantinga e5a4f09363 Call SDL_UDEV_Quit() if we don't end up using it 2025-01-13 10:22:10 -08:00
Frank Praznik b4562c0243 cocoa: Add a hint to control menu visibility in fullscreen spaces windows
Adds SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY to control whether or not the menu can be accessed when the cursor is moved to the top of the screen when a window is in fullscreen spaces mode.

The three values are true, false, and 'auto' (default), with auto resulting in a hidden menu if fullscreen was toggled programmatically, and the menu being accessible if fullscreen was toggled via the button on the window title bar, so the user has an easy way back out of fullscreen if the client app/game doesn't have a readily available option to toggle it.
2025-01-13 12:37:16 -05:00
Sam Lantinga 611f132fd0 Don't use a hint callback for SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY
This was originally intended to make sure that nativeAllowRecreateActivity() could be called from another thread safely, but the hint system is now thread-safe, so we don't need to use a callback here.

Fixes https://github.com/libsdl-org/SDL/issues/11938
2025-01-13 07:49:09 -08:00
Ryan C. Gordon 307e6f2ca6
emscripten: simulate mouse autocapture.
This is just enough to delay MOUSE_LEAVE events until a drag ending outside
the canvas is released, and make sure the MOUSE_UP event has the canvas's
SDL_WindowID, which it wouldn't when mouse focus is was lost by this point.

Fixes #10033.
2025-01-13 02:39:39 -05:00
Ethan Lee 3df0767e34 gpu: Initialize Metal stencil format even if stencil test is disabled 2025-01-12 13:05:27 -08:00
Sam Lantinga 21cc1878f1 Reset enhanced mode state when closing a controller
Fixes https://github.com/libsdl-org/SDL/issues/11912
2025-01-12 10:45:54 -08:00
expikr 9a83fa026d apply multiplier scale after system scale 2025-01-12 08:24:41 -08:00
Sam Lantinga 551510c0eb SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE can be combined with SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE 2025-01-12 08:05:51 -08:00
Ryan C. Gordon f0af6c348a
emscripten: Add SDL_EVENT_DISPLAY_ORIENTATION support.
Reference Issue #11389.
2025-01-12 02:23:00 -05:00
Ryan C. Gordon 3ad9c38a46
emscripten: Don't set OpenGL swap intervals until first PumpEvents.
Any requested swap interval will be saved and set on the first PumpEvents.
Once PumpEvents has been called at least once, swap intervals are set
immediately.

This assumes that events won't be pumped until after an Emscripten main loop
has been defined, and so prevents a warning on the javascript console:

"emscripten_set_main_loop_timing: Cannot set timing mode for main loop since
a main loop does not exist! Call emscripten_set_main_loop first to set one
up."

Fixes #9969.
2025-01-11 15:19:09 -05:00
Ryan C. Gordon 82125ec1d8
x11: Be more aggressive about finding _any_ usable messagebox font.
Fixes #4800.
Fixes #11910.
2025-01-11 00:35:39 -05:00
Sam Lantinga 4231848791 Revert "Separate android initialization from Activity (#11891)"
This reverts commit d14c93c4b1.

This is a major breaking change for activities that inherit SDLActivity
2025-01-10 15:27:08 -08:00
Xander d14c93c4b1
Separate android initialization from Activity (#11891) 2025-01-10 15:05:58 -08:00
Sam Lantinga 042898995c Added SDL_ClickTrayEntry()
Also removed the app delegate from the tray code on Cocoa and folded that into SDL3AppDelegate.

Fixes https://github.com/libsdl-org/SDL/issues/11906
2025-01-10 12:55:50 -08:00
Ryan C. Gordon fb0f6a1196 cocoa: Display mode changes set Desktop display mode, not current. 2025-01-10 15:35:43 -05:00
Ryan C. Gordon 38176bfe9a cocoa: Implemented display hotplugging support.
Fixes #7764.
2025-01-10 13:25:34 -05:00
Frank Praznik 0e2ca934b5
events: Remove unused function declaration 2025-01-10 11:23:54 -05:00
Sam Lantinga 715897aea7 Added support for displaying XIM composition strings
Fixes https://github.com/libsdl-org/SDL/issues/6437
2025-01-10 03:26:42 -08:00
Sam Lantinga a8a65b6fca Use XIM for IME input on X11
Tested with fcitx5 and ibus on Xorg and Xwayland
* Used US English with dead keys and verified that ` followed by a results in à
* Used Hangul to enter Korean and got text in the expected order
* Used the mozc IM to enter Japanese and was able to generate candidates and so forth

Fixes https://github.com/libsdl-org/SDL/issues/3907
Fixes https://github.com/libsdl-org/SDL/issues/6164
Fixes https://github.com/libsdl-org/SDL/issues/11894
2025-01-10 03:26:42 -08:00
Ethan Lee 90aff306c1 gpu: Show a debug error when pipelines are not given the right shader stages 2025-01-09 20:17:21 -05:00
Frank Praznik 6b776a9989 keyboard: Add some SDL keycodes for common Xkb keys
Add SDL keycodes for keys found commonly found in the default Xkb layout, such as left tab and compose, and keys frequently used for custom modifiers such as Meta, Hyper, and Level5 Shift.

As these keys aren't Unicode code points and don't have associated scancodes (at least on modern keyboards), they are placed in the new extended key code space, with bit 30 set as a flag.
2025-01-09 17:26:41 -05:00
Frank Praznik e5966bbdb1 x11: Add support for Mod3 and more esoteric Xkb configurations
Adds support for Mod3, which is usually Level 5 shift, as well as not altering the functionality of the more esoteric modifier keys, such as meta and hyper.

Also use the system modifier state instead of setting them based on key presses, which may be incorrect due to remapping, or toggled in some other manner.
2025-01-09 17:26:41 -05:00
Frank Praznik 73ee99978d wayland: Add support for Mod3 and more esoteric Xkb configurations
Adds support for Mod3, which is usually Level 5 shift, but can vary, as well as not altering the functionality of the more esoteric modifier keys, such as meta and hyper.
2025-01-09 17:26:41 -05:00
Anonymous Maarten a78104a47f Disable long long support in the headers with SDL_NOLONGLONG
Some older toolchains don't support 'long long'.
2025-01-09 16:04:14 -05:00
Ethan Lee 6cdde10edb gpu: Metal depth write should behave like Vulkan/D3D12 2025-01-09 15:28:26 -05:00
Ethan Lee 7acf78ba92 storage: Trim the title storage root from enumerated paths 2025-01-09 13:50:52 -05:00
Frank Praznik 037cd25a22 win32: Use the pending size during NCCALCSIZE
Non-resizable windows still need to apply the pending size, as they can be resized programmatically.

Fixes programmatically resizing windows without the WS_THICKFRAME style.
2025-01-09 12:27:05 -05:00
Cameron Cawley e8916b2608 pipewire: Use byte order pixel format aliases 2025-01-09 09:52:30 -05:00
Ryan C. Gordon 3f7f632e14
audio: Added SDL_AudioDeviceStreamPaused.
We had the other two wrapper functions to pause and resume, and forgot query.
2025-01-09 01:36:57 -05:00
Ryan C. Gordon 4bb3c2a1c7
render: Some cleanups.
Mostly setting NULL pointers to a local struct instead of copying non-NULL
pointers' contents into the local struct.
2025-01-08 14:59:28 -05:00
Ryan C. Gordon 61bdbacdae
render: SDL_RenderTextureTiled shouldn't try to drop draw calls, either. 2025-01-08 14:59:28 -05:00
Ryan C. Gordon f044a3d6ca
Revert "render: GetRenderViewportSize shouldn't use scale, just logical presentation."
This reverts commit ef758d05c1.

Turns out the bug in #11076 was that we were dropping texture draws
incorrectly, not that scale shouldn't be applied here. The dropped draw calls
were fixed in bf85320947, and this revert is
making the renderer consistent again.
2025-01-08 14:59:27 -05:00
Ryan C. Gordon fa7a529912
render: GetRenderViewportSize shouldn't scale viewport dimensions.
These are already scaled for the logical presentation (unless using the pixel
dimensions instead; we still scale those here).

Fixes #11704.
2025-01-08 14:59:27 -05:00
Ryan C. Gordon bf85320947
render: Don't try to drop draws outside of the viewport.
It didn't take scale into account, and the backends would need to do clipping
anyhow, so let the system figure that out for us at the lower level.

Fixes #11318.
2025-01-08 11:55:10 -05:00
Simon McVittie ef1fdf11bd tray: Create tray icons for libappindicator securely
If we write directly to filenames in /tmp, we're subject to
time-of-check/time-of-use symlink attacks on most systems (although
recent Linux kernels mitigate these by default). We can avoid these
attacks by securely creating a directory owned by our own uid,
and doing all our file I/O in that directory. Other uids cannot create
symbolic links in that directory, so we are protected from symlink
attacks.

This does not protect us from an attacker that is running with the same
uid, but if such an attacker exists, then we have already lost.

Resolves: https://github.com/libsdl-org/SDL/issues/11887
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-08 07:26:02 -08:00
Sam Lantinga e6bb50a710 Updated to version 3.1.9 for development 2025-01-07 17:51:00 -08:00
Sam Lantinga 22422f7748 Fixed ABI compatibility with 3.1.6 2025-01-07 17:32:59 -08:00
Sam Lantinga d7b10d05b1 Updated to version 3.1.8 for the preview release 2025-01-07 17:04:05 -08:00
Simon McVittie 4290fc8bda tray: Load GTK and libappindicator by versioned names, except on OpenBSD
We are expecting a specific ABI (we can see that from the declarations
listed in this file) and the whole point of SONAME versioning is to
say that the library conforms to a specific ABI. If the SONAME is not
the one we expect, then calling its functions is likely to crash.

As usual, an exception to this is that OpenBSD does not use SONAME
versioning.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-07 14:02:01 -08:00
Simon McVittie 6b38d250aa tray: Don't try to use GTK 2 versions of libappindicator
We use GTK 3 functions in this file, so we cannot load a libappindicator
whose SONAME indicates that it is using GTK 2.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-07 14:02:01 -08:00
Simon McVittie bba066c44c tray: Don't call g_object_unref(NULL)
g_object_unref() only accepts valid object instances.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-07 14:01:08 -08:00
Ryan C. Gordon 6934c910b3
opengl: use GL_UNSIGNED_BYTE instead of GL_UNSIGNED_INT_8_8_8_8_REV.
This seems to be significantly more efficient on some modern platforms, but if
this turns out to be a widespread disaster, we can revert it.
2025-01-07 16:08:56 -05:00
Ryan C. Gordon 0180ca541e
windows: Catch WM_POINTERCAPTURECHANGED events.
Fixes #11844.
2025-01-07 10:22:15 -05:00
Ozkan Sezer 8ec576ddab tray, windows: fix logic error from commit 1167cf54e1 2025-01-07 10:15:40 +03:00
Sam Lantinga 748f0b3201 Improved Steam Controller detection on iOS 2025-01-06 17:16:23 -08:00
Frank Praznik ba1a980535
wayland: Only apply the toplevel bounds when initially mapping the window
The size shouldn't be clamped to the bounds after the window is mapped, or an explicitly requested user size may be overwritten.
2025-01-06 17:07:16 -05:00
Frank Praznik 28389f1c38 wayland: Apply toplevel bounds to windows
Apply the supplied xdg-toplevel bounds to resizable windows during initial mapping. Libdecor functionality will have to be added separately, as the functionality needs to be added to the library first.
2025-01-06 16:06:03 -05:00
Sam Lantinga ef52a4d4df Fixed warning C4389: '==': signed/unsigned mismatch 2025-01-06 12:03:45 -08:00
Sam Lantinga 8d8649b33f Fixed error: returning 'SDL_TrayEntry **' from a function with incompatible return type 'const SDL_TrayEntry **' 2025-01-06 11:35:54 -08:00
Sam Lantinga 1167cf54e1 Fixed warning C4706: assignment within conditional expression 2025-01-06 11:30:28 -08:00
Sam Lantinga 8a9b7ae8d1 Switched nEntries to int, to avoid signed/unsigned comparison warnings
Also standardized memory allocation calls to match SDL style
2025-01-06 11:29:28 -08:00
Sam Lantinga fb4ec07119 Fixed warning C4701: potentially uninitialized local variable 'previous_context' used 2025-01-06 11:18:45 -08:00
Ryan C. Gordon 1f54b228ff
video: Convert some EGL environment variables to SDL hints.
Fixes #10479.
2025-01-06 11:15:26 -05:00
Sam Lantinga 7c9f6c6313 Remove debug logging 2025-01-05 20:06:50 -08:00
Ryan C. Gordon d16f76e3d4 wasapi: Don't crash/hang if transitioning to/from a Remote Desktop Connection.
Fixes #9673.
2025-01-05 21:53:35 -05:00
Frank Praznik 2b375d9704 wayland: Don't enable the text-input protocol when using Fcitx
Otherwise, key repeat will be broken. Enabling it under Wayland isn't recommended anyway.
2025-01-05 17:53:58 -05:00
David Gow 0ae57f1d90 tray: unix: Shutdown the GTK thread when not in use
When using the libappindicator/gtk/unix Tray backend, the background
thread which calls gtk_main() is never destroyed. This means that we
detect a leaked thread as SDL_Quit().

Instead, tell gtk to shut down its main loop when no tray icons are
active. This fixes the issue here: SDL notices no leak, and repeatedly
creating / destroying tray icons seems to work fine.

Signed-off-by: David Gow <david@ingeniumdigital.com>
2025-01-05 02:51:12 -08:00
Ryan C. Gordon 181995b44f
stdlib: Reworked SDL_vswprintf to be more efficient and return correct values.
Fixes #11729.
2025-01-04 21:55:07 -05:00
Erik Soma 8509041a09 video: Fix SDL_GL_GetAttribute depth/stencil size when 0 2025-01-04 18:57:48 -05:00
Ryan C. Gordon 344e394bf4
camera: Favor v4l2 over pipewire, for now.
Reference Issue #11473.
Reference Issue #9776.
Reference Issue #11819.
Reference Issue #9989.
Reference Issue #10842.
2025-01-04 16:11:57 -05:00
Semphris b6dc44b133 Support dark theme for tray menus on Windows 2025-01-04 11:04:21 -08:00
Semphris 7673b84f52 Make SDL_GetTrayEntires() NULL-terminated 2025-01-04 10:56:19 -08:00
Katelyn Gadd a58bc3eaf4
[GPU] Fix crash in nvidia user-mode win32 driver when game window is minimized during swapchain resize (#11848) 2025-01-04 10:25:08 -08:00
Susko3 0a5d2f3da2 Handle pen eraser button as a second button 2025-01-04 05:27:06 -05:00
Anonymous Maarten efba42a67b tests: avoid undefined signed overflow 2025-01-04 01:06:29 +01:00
Sam Lantinga 156b3b4a8c Fixed language detection on iOS
On iOS you might see traditional Chinese on a US phone as: "zh-Hans_US"
2025-01-03 15:27:08 -08:00
Frank Praznik 5579010b6a wayland: Adjust the scaled popup position even if the dimensions didn't change
Otherwise, the unscaled position will be sent.
2025-01-03 17:17:16 -05:00
Ryan C. Gordon 2d37903323 pen: implement pen support for Windows.
Fixes #10516.
2025-01-03 12:58:49 -05:00
Sam Lantinga ef21ccf080 Create a separate metal shader for NV12 textures
Also unify the color output function so it works with the various combinations of input and output colorspaces.

Fixes https://github.com/libsdl-org/SDL/issues/11727
2025-01-03 09:30:47 -08:00
Sam Lantinga 49663bfb58 Make Windows dialogs DPI aware
Fixes https://github.com/libsdl-org/SDL/issues/4775
Fixes https://github.com/libsdl-org/SDL/issues/9691
2025-01-03 09:25:10 -08:00
Sam Lantinga efc390d7e2 Don't log SDL errors by default
There are many recoverable errors that may happen internally and can be safely ignored if the public API doesn't return an error code. Seeing them causes lots of developer anxiety and they generally aren't helpful.

Fixes https://github.com/libsdl-org/SDL/issues/11813
2025-01-02 17:32:10 -08:00
Sam Lantinga 2c0a8363a5 Added SDL_HINT_JOYSTICK_ENHANCED_REPORTS
This hint defaults on, enabling advanced controller features.

This replaces SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE and SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, and is supported by PlayStation and Nintendo Switch controllers.

Fixes https://github.com/libsdl-org/SDL/issues/10086
2025-01-02 17:18:09 -08:00
Sam Lantinga ecf8dd054d Show the display content scale in SDLTest_CommonDrawWindowInfo() 2025-01-02 10:58:15 -08:00
Sam Lantinga 4797970bfa Enable SDL_HINT_JOYSTICK_THREAD by default
If you're not using SDL for video you won't get raw input messages without this hint, and this is tripping up enough people it makes sense to have this enabled by default. There isn't much downside to this, other than having another thread processing Xbox controller input.

Fixes https://github.com/libsdl-org/SDL/issues/10576
2025-01-02 10:25:18 -08:00
Sam Lantinga 6b4b9b5f2b Improved XInput controller detection
Sometimes we'll get a Windows.Gaming.Input callback before the raw input device is even in the list, so try some other methods to better detect XInput devices.
2025-01-02 10:25:18 -08:00
Frank Praznik 8ea4b326b3 video: Fix focus when non-focused popup windows are hidden
Fix focus issues when a popup that is the child of a window that does not currently have keyboard focus is hidden or destroyed.
2025-01-02 13:24:24 -05:00
Katelyn Gadd 67ea67f191 Fix mip generation for 2x1 textures on D3D12 2025-01-02 13:17:06 -05:00
Erik Soma c6b5c21aaf clipboard: Ensure SDL_ClearClipboardData clears data even when no data has been set 2025-01-02 07:23:27 -08:00
Anonymous Maarten b713e7581b stdlib: fix SDL_strtol of "0" with base 0
SDL_strtol("0") skipped the "0" octal prefix
and returned a failure because the remainder of the string was empty.
2025-01-02 01:15:28 +01:00
Ozkan Sezer 54752f8d1c SDL_malloc.c: replace FORCEINLINE usage with SDL_FORCE_INLINE 2025-01-02 01:15:28 +01:00
Anonymous Maarten 3842384a38 dynapi: trigger a breakpoint on a fatal error when SDL is built in debug mode 2025-01-02 01:15:28 +01:00
Anonymous Maarten 6cf6b160cd SDL_hashtable: don't use assert from libc
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2025-01-02 01:15:28 +01:00
Anonymous Maarten 62bc2c4c92 SDL_malloc: don't define FORCEINLINE
The FORCEINLINE macro is also used by Windows SDK headers.
When it is an empty macro, FORCEINLINE-d functions will
get global visibility error and cause duplicate symbol link errors.

HRESULT_FROM_WIN32 is such a function.
2025-01-02 01:15:28 +01:00
Anonymous Maarten 4fbf59ac3a Implement __chkstk for arm64
Lifted from a previously built SDL3.dll
2025-01-02 01:15:28 +01:00
Anonymous Maarten 578ac0ef52 SDL_malloc: disable malloc stats
This avoids bringing in stdio.
2025-01-02 01:15:28 +01:00
Sam Lantinga 02e85a153f Use the expected plane size when capturing Android camera frames
On the Samsung Galaxy A52 the camera plane size is (pitch * (h - 1) + w) instead of (pitch * h). This led to us copying off the end of the plane when uploading the texture, so we pad out to our expected size.
2025-01-01 15:58:27 -08:00
Sam Lantinga 0281071243 Lock joysticks when they are connected/disconnected on emscripten
Fixes https://github.com/libsdl-org/SDL/issues/11499
2025-01-01 13:51:47 -08:00
Frank Praznik 2b1d809b21 video: Fix positioning and focusing popups parented to child toplevel windows
Find the toplevel parent window, not the absolute highest toplevel window in the hierarchy, when positioning and adjusting the focus of popup windows.

Fixes a leftover case from when toplevel windows couldn't be parented to other toplevels.
2025-01-01 14:40:29 -05:00
Sam Lantinga f2074d7af3 Updated copyright for 2025 2025-01-01 07:45:52 -08:00
Sam Lantinga 54d4e48539 Get the initial clipboard state at startup 2024-12-31 19:27:11 -08:00
Sam Lantinga 6575b8157b Synchronize clipboard mime types with external clipboard updates
Fixes https://github.com/libsdl-org/SDL/issues/8338
Fixes https://github.com/libsdl-org/SDL/issues/9587
2024-12-31 19:27:11 -08:00
Sam Lantinga 30a22d3fed Allow a NULL size parameter to retrieve null terminated text 2024-12-31 19:27:11 -08:00
Sam Lantinga d666c2d189 Use a consistent error message when video isn't initialized 2024-12-31 19:27:11 -08:00
Sam Lantinga 196e2c6662 Fixed crash if num_mime_types is NULL 2024-12-31 19:27:11 -08:00
Sam Lantinga b902b0527b Renamed n_mime_types to num_mime_types 2024-12-31 19:27:11 -08:00
Sam Lantinga a767952617 Fixed spacing 2024-12-31 19:27:11 -08:00
Sam Lantinga 54c555e394 Send supported mime types for external clipboard contents on Windows 2024-12-31 19:27:11 -08:00
Sam Lantinga 8b155708ff Fixed clipboard memory leak on shutdown 2024-12-31 19:27:11 -08:00
Frank Praznik 1d417ab27f win32: Set the WS_THICKFRAME style on popup windows
Without it, programmatically resizing the window seems to fail. As popup windows are implicitly borderless, calculations taking the frame size into account need to be avoided.
2024-12-31 18:29:59 -05:00
Frank Praznik 643281d022 Revert "win32: Use the size in the WINDOWPOS data while handling popup windows in the WM_WINDOWPOSCHANGED message"
This reverts commit 4f0a056b95.
2024-12-31 18:29:59 -05:00
Frank Praznik dd83908109 keyboard: Check for both caps lock and shift when looking up a keycode by name 2024-12-31 15:17:32 -05:00
Frank Praznik df97ccf283
win32: Return 0 from WM_WINDOWPOSCHANGING if a resize is expected
This was accidentally removed while deleting some associated dead code.
2024-12-31 14:02:44 -05:00
Frank Praznik 4f0a056b95 win32: Use the size in the WINDOWPOS data while handling popup windows in the WM_WINDOWPOSCHANGED message
GetClientRect() returns old, incorrect size data for popup windows when called while processing the WM_WINDOWPOSCHANGED message, so use the WINDOWPOS data instead.

Popups can't be maximized or fullscreen, so no need to worry about a move event resizing them.
2024-12-31 13:33:11 -05:00
Ethan Lee 3cd3c9317e storage: Add error messages when ReadIO/WriteIO lengths mismatch 2024-12-31 12:34:12 -05:00
Ryan C. Gordon fa9c3331d5 main: Adjust how SDL_HINT_MAIN_CALLBACK_RATE works.
Now (only in the generic backend, where it is implemented), this hint is
always respected. Previously it would only be used if no windows were created,
to help reduce CPU load on things like loopwave.

Since it's always used now, the default has changed from 60 (Hz) to 0 (run as
fast as possible). Things like loopwave should still likely force this way
lower than the previous default (and already do: loopwave explicitly sets it
to 5).

The hint can now also be set to "waitevent" which will cause SDL_AppIterate
to only be called after new events have arrived, for apps that are entirely
driven by input and want to consume (almost) no power or CPU time until then.

Fixes #11093.
Fixes #11387.
2024-12-31 08:19:38 -08:00
Végh Márton 0be5b8070d Update SDL_asyncio.c 2024-12-30 23:29:21 -08:00
Sam Lantinga 1c04ebe423 Renamed SDL_ASYNCIO_CANCELLED to SDL_ASYNCIO_CANCELED 2024-12-30 19:13:02 -08:00
Sam Lantinga d4d5faedab Added SDL_EVENT_FINGER_CANCELED
Fixes https://github.com/libsdl-org/SDL/issues/10528
2024-12-30 19:13:02 -08:00
Sam Lantinga 8704ab8422 Wait for a display resize event before sending orientation changes
Fixes https://github.com/libsdl-org/SDL/issues/9585
2024-12-30 15:49:10 -08:00
Sam Lantinga 60deaf5f0f Send display mode change events when the orientation changes 2024-12-30 15:24:38 -08:00
Sam Lantinga e91c37f4dd Added support for inset handling on Android 15 2024-12-30 12:23:00 -08:00
Petar Popovic 5f25691c85 Fix C23 empty initializer warning. 2024-12-29 18:17:24 -08:00
Frank Praznik 8cc4735d74
wayland: Don't override the min/max values when scaling to the screen
The point/pixel conversion functions should return zero when passed zero, or the min/max calculations can break.
2024-12-29 18:01:13 -05:00
Semphris 2d91f096ca Remove libc function from Windows tray 2024-12-30 01:20:12 +03:00
Sam Lantinga 0410328b15 Fixed warning: ordered comparison of pointer with integer zero 2024-12-29 12:05:34 -08:00
Sam Lantinga 6e1177ac03 Include tray function prototypes 2024-12-29 08:15:30 -08:00
Ryan C. Gordon 0ad3a18937 uikit: reworked Apple Pencil code.
This manages axes correctly across events, sorts out the math to convert from
Apple's data to what SDL expects, and a few other tweaks and corrections.
2024-12-28 15:36:02 -05:00
Ryan C. Gordon f6143da617 uikit: Patched to compile, added to Xcode project. 2024-12-28 15:36:02 -05:00
Salman Alshamrani 774e38d073 uikit: Initial Apple Pencil support.
Reference Issue #9911.
Reference Issue #10516.
2024-12-28 15:36:02 -05:00
Frank Praznik 5acd7fe208 wayland: Prevent popup configure events from overwriting the current size with old data
Don't apply the supplied dimensions if they haven't changed from the last configuration event, or a newer size set programmatically can be overwritten by old data.

This check is already being done for toplevel windows, but was never added to the popup configure event.
2024-12-28 14:23:30 -05:00
Ramez Ragaa cf439d5c63 Fix dib-to-bmp logic in SDL_windowsclipboard.c
This addresses the issue #11762 by reading the biCompression field to
determine the correct size of the color table, and consequently the
correct bih_size value.
2024-12-28 08:31:52 -08:00
Ozkan Sezer ec8a780ad4 tray, unix: fix -Wformat warnings
src/tray/unix/SDL_tray.c: In function 'get_tmp_filename':
src/tray/unix/SDL_tray.c:345: warning: format '%ld' expects type 'long int', but argument 2 has type 'size_t'
src/tray/unix/SDL_tray.c: In function 'get_appindicator_id':
src/tray/unix/SDL_tray.c:361: warning: format '%ld' expects type 'long int', but argument 3 has type 'unsigned int'
2024-12-28 18:37:56 +03:00
Carl Åstholm 49153ebfc4 audio: Add NULL check to SDL_UnbindAudioStreams 2024-12-28 00:10:58 -05:00
Carl Åstholm 1b99467c71 audio: Make SDL_Bind/UnbindAudioStreams take const arrays 2024-12-28 00:10:58 -05:00
Lucas Murray cc24518c41 render: Update GPU backend to use the new present workflow 2024-12-27 17:11:55 -08:00
Frank Praznik bc448fa445 win32: Use the nearest monitor size for calculating maximized window dimensions
Default to using the nearest monitor, instead of null, as a null monitor can be sent when restoring from minimized, which results in the restored, maximized window being the wrong size.
2024-12-27 18:17:55 -05:00
Frank Praznik 599b4ef254 win32: Fix maximizing borderless windows
Even if a borderless window doesn't have resizable borders set, the WS_MAXIMIZEBOX property needs to be set on the window, or maximizing it will make it fullscreen and cover the taskbar, instead of only filling the usable desktop space, as is usually expected from a maximized window. This style property needs to be retained until the window is no longer maximized, even if the resize flag is toggled off, or restoring from minimized can fail.
2024-12-27 18:17:55 -05:00
Frank Praznik 1c52e290a3 video: Don't overwrite pending size values when setting the window min/max 2024-12-27 18:08:26 -05:00
Sam Lantinga 9a4d29699d Don't use connection state from the Nintendo Switch Pro report
This isn't reliable for third party controllers like the 8BitDo Pro 2.

Fixes https://github.com/libsdl-org/SDL/issues/10862
2024-12-27 13:58:49 -08:00
Sam Lantinga 22f6eed1d9 Use the NVIDIA Shield home button as the guide button 2024-12-27 12:42:06 -08:00
Sam Lantinga c148837546 Added a Bluetooth mapping for the NVIDIA Shield Controller on Linux 2024-12-27 12:18:08 -08:00
Sam Lantinga 82a1e9f6df Fixed the guide button for the NVIDIA Shield Controller on Linux
This works with firmware v1.25 and v1.35
2024-12-27 12:17:51 -08:00
Frank Praznik ba5cf2b152 x11: Don't overwrite popup window coordinates when changing the size 2024-12-27 12:58:53 -05:00
Frank Praznik 567b828e18 wayland: Use the proper popup coordinates if the position is set while the window is hidden 2024-12-27 12:58:53 -05:00
Semphris 0461180e25 SDL_EVENT_QUIT when no window nor tray
SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE will not fire if there are active tray icons. This impacts only applications that create tray icons, and that at least one icon outlives the last visible top-level window. SDL_EVENT_QUIT will fire when the last active tray is destroyed if there are no active windows.
2024-12-27 09:22:27 -08:00
Blaž Tomažič e9290eeedf Use `pthread_setname_np` also on Android
Set thread name on Android the same way as we do on Linux.

Acording to Bionic source code this function is available since 2013 [1] and
hase the same signature.

[1] 2a1bb4e646

(cherry picked from commit e79b0ce2e4)
2024-12-27 08:07:47 -08:00
Ozkan Sezer 578509c326 windows/SDL_tray.c, video/windows/SDL_surface_utils.h: use SDL_windows.h 2024-12-27 12:28:02 +03:00
Ozkan Sezer 05932e05da tray, windows: replace ZeroMemory() with SDL_zero() 2024-12-27 12:05:00 +03:00
hwsmm e2323c1367 Refactor Android input handling and add pen support 2024-12-26 23:50:11 -05:00
hwsmm f5fbdf7ed5 Make onNativePen available for Android 2024-12-26 23:50:11 -05:00
hwsmm a5e8fc21b2 Add SDL_androidpen 2024-12-26 23:50:11 -05:00
hwsmm 80c39f2ff4 Expose SDL_GetPenStatus for Android pen buttons 2024-12-26 23:50:11 -05:00
Ryan C. Gordon e3c99e3bd3
misc: Fixed typo in iOS error message.
(cherry picked from commit 96b4535cc7)
2024-12-26 23:37:16 -05:00
Sam Lantinga 1413bfb185 Don't overwrite non-CRC gamepad mapping with a new mapping that specifies a CRC
Fixes https://github.com/libsdl-org/SDL/issues/11723
2024-12-26 20:18:26 -08:00
Ozkan Sezer cd1bb6247b video/windows/SDL_surface_utils.c: replace ZeroMemory() with SDL_zero() 2024-12-27 06:03:37 +03:00
Ozkan Sezer 50fbae9302 tray, windows: define NOTIFYICON_VERSION_4 and NIF_SHOWTIP, if missing. 2024-12-27 05:30:50 +03:00
Ryan C. Gordon 7bbe6025be misc: Make SDL_OpenURL work with VisionOS, tvOS, etc. 2024-12-26 16:50:52 -08:00
Ryan C. Gordon ffed1c50c0 misc: Fix SDL_OpenURL on newer iOS releases.
Apparently as of iOS 18.2, the deprecated API we were using just refuses to
work at all.

Fixes #11728.
2024-12-26 16:50:52 -08:00
Frank Praznik 1a6e139dde win32: Only recalculate the position on show for popup windows
Regular child windows aren't positioned relative to the parent.
2024-12-26 18:18:46 -05:00
Frank Praznik cf220ea4f1 win32: Fix popup positioning 2024-12-26 17:12:14 -05:00
Ozkan Sezer 17ef0c1237 SDL_video.c: replace strlcpy with memcpy in SDL_ShowMessageBox() 2024-12-27 00:01:56 +03:00
Sam Lantinga eb1be89e70 Cleaned up thread state handling and added thread object validation 2024-12-26 10:26:08 -08:00
Salman Alshamrani eadc64973a Reset text field content on text input stop 2024-12-26 10:03:34 -08:00
Lucas Murray b2c2a483e8 GPU: Rename HDR10_ST2048 to HDR10_ST2084 2024-12-26 09:47:13 -08:00
Moritz ca4f5dd40d Added SDL_GetThreadState 2024-12-25 13:15:18 -08:00
lunasorcery b7dac5072b correct termination of windows openfiledialog filters 2024-12-25 11:42:32 -08:00
Sam Lantinga b2178857dc Corrected CoreAudio surround sound channel layouts
Fixes https://github.com/libsdl-org/SDL/issues/11709
2024-12-24 15:03:25 -08:00
expikr f40a530fd9 subclass the builtin system message class instead 2024-12-24 12:06:47 -08:00
Semphris cf946e32ba Fix memory management for Windows dialog title 2024-12-24 12:06:05 -08:00
Sam Lantinga 76920a230f Fixed Xcode build 2024-12-24 10:49:58 -08:00
Semphriss 01b9b0edb7
Add system tray support (#10873) 2024-12-24 10:36:39 -08:00
Caleb Cornett a27c139b12 GPU: Explicitly check Metal hardware support on device creation 2024-12-24 12:36:52 -05:00
Sam Lantinga 8653a5821b Fixed mingw64 Windows build 2024-12-24 08:58:08 -08:00
Sam Lantinga 60dce94583 Fixed building with older Windows SDKs 2024-12-24 08:26:05 -08:00
L zard c2508d5d99 Fix various `#if defined`s 2024-12-24 07:19:38 -08:00
L zard f2b7495adc SDL_camera_pipewire: use `SDL_CAMERA_DRIVER_PIPEWIRE_DYNAMIC` 2024-12-24 07:19:38 -08:00
Sam Lantinga 483e79bf82 Fixed mouse click count for relative mode and multiple mice
We'll track the click count separately for each input source, and the click distance is calculated using a point on an infinite plane that is pushed around by mouse motion deltas, unclamped by the window edge.
2024-12-23 19:00:14 -08:00
Sam Lantinga 024e5da6fb Mouse events only get a mouse ID in relative mode 2024-12-23 17:12:50 -08:00
evertonse 8a0f649363 windows: fix BITMAPINFOHEADER values when getting bitmap from Clipboard 2024-12-23 17:00:47 -08:00
L zard af2dbbcb53 Merge SDL_wasapi_win32 into SDL_wasapi 2024-12-23 16:54:52 -08:00
Sam Lantinga 5a2eb60389 Only save the pending flags we will restore when hiding a window
Fixes https://github.com/libsdl-org/SDL/issues/11564
2024-12-23 16:53:54 -08:00
Sam Lantinga 969f03d9f0 Added SDL_PROP_RENDERER_GPU_DEVICE_POINTER
Fixes https://github.com/libsdl-org/SDL/issues/11600
2024-12-23 16:51:43 -08:00
Sam Lantinga 3a1810f9a9 Fixed the Linux mapping for the NVIDIA Controller v1.03 2024-12-23 15:43:17 -08:00
Sam Lantinga 49610fd1e8 Leave mouse relative mode when losing focus
Fixes https://github.com/libsdl-org/SDL/issues/7892
2024-12-23 15:23:11 -08:00
Caleb Cornett 62124e2c28
GPU: Enable Metal validation in debug mode (#11691) 2024-12-23 18:08:14 -05:00
Sam Lantinga 37b87f79fb Fixed Bluetooth Steam Controller detection on iOS and Android 2024-12-23 12:55:25 -08:00
Sam Lantinga 9a43c08146 Allow rendering during the modal resize loop on macOS
Fixes https://github.com/libsdl-org/SDL/issues/11508
2024-12-23 11:46:35 -08:00
Sam Lantinga 225c0e2ad9 Removed unused function declaration 2024-12-23 11:21:00 -08:00
Sam Lantinga 4add7e2005 Round the window size values when using fixed aspect ratio
This won't get you pixel perfect values, since the exact ratio won't necessarily be whole pixel values, but it will be closer, and matches the logic in the other branch.
2024-12-23 09:03:38 -08:00
Anonymous Maarten f8d8bf8066 SDL_GetNumAllocations returns -1 when allocation counting is disabled 2024-12-22 12:20:04 -08:00
Anonymous Maarten a33144fbc9 SDL_test: disable memory tracking if SDL does not count allocations 2024-12-22 12:20:04 -08:00
Sam Lantinga 2e4dc9c109 Disable tracking memory allocation counts by default
Fixes https://github.com/libsdl-org/SDL/issues/11099
2024-12-22 12:20:04 -08:00
Caleb Cornett c080bb8417 GPU: Fix non-triangle D3D12 primitive topology types 2024-12-21 22:38:40 -05:00
Sam Lantinga 33442701ca Use the monitor as the client rect for maximized borderless windows
Fixes https://github.com/libsdl-org/SDL/issues/9588
2024-12-21 09:19:03 -08:00
Sam Lantinga 7e298f50fe Make windows resizable if we're about to maximize them programmatically 2024-12-21 09:19:03 -08:00
Sam Lantinga 34974d4d2b Don't remove the resizable style for borderless windows
The application may have intended the window to be borderless and resizable
2024-12-21 09:19:03 -08:00
Sam Lantinga cadeec9cc9 SDL_SoftStretch() doesn't handle large pixel formats
Fixes https://github.com/libsdl-org/SDL/issues/11534
2024-12-21 09:19:03 -08:00
Sam Lantinga f37eef948c Removed raw mouse events
It's too close the 3.2.0 release for an API change like this.

If/when we re-add these, some things for consideration:
* What use cases does this enable that aren't currently possible?
* What cross-platform API guarantees do we make about the availability of these events? e.g. do we try to simulate them where raw input isn't actually available?
* How is this different from the existing relative mode, and how do we clearly explain when you want these events vs wanting relative mode?

Notes from @expikr:
First observation: the reason I originally passed denominators instead of multipliers was because some rational values cannot be exactly represented by floats (e.g 1/120) so instead let the end-developer decide how to do the dividing themselves. It was the reason why it was using split values with an integer numerator to begin with, instead of having both as floats or even just normalize it in advance.

On the other hand, passing them as multipliers might have hypothetical uses for dynamically passing end-user controlled scaling in a transparent manner without coupling? (Though in that case why not just do that as additional fields appended to `motion` structs in an API-compatible layout?)

So it’s somewhat of a philosophical judgement of what this API of optional availability do we intend for it to present itself as:
- should it be a bit-perfect escape hatch with the absolute minimally-denominal abstraction over platform details just enough to be able to serve the full information (á la HIDPIAPI),
- or a renewed ergonomic API for splitting relative motion from cursor motion (in light of The Great Warping Purge) so that it is unburdened by legacy RelativeMode state machines, in which case it would be more appropriate to just call it `RELATIVE` instead of `RAW` and should be added alongside another new event purely for cursor events?

This alternate API stream was conceived in the context of preserving compatibility of the existing RelativeMode state machine by adding an escape hatch. So given the same context, my taste leans towards the former designation.

However, as The Great Warping Purge has made it potentially viable to do so, if I were allowed to break ABI by nuking the RelativeMode state machine entirely, I would prefer the latter designation unified as one of three separate components split from the old state machine, each independently controlled by platform-dependent availability without any state switching of a leaky melting pot:
- cursor visibility controls (if platform has cursor)
- cursor motion events (if platform has cursor)
- relative motion events (if the platform reports hardware motion)
2024-12-21 05:18:42 -08:00
Sam Lantinga d07bb0e679 Removed raw key events
They weren't adding any value over the existing keyboard events
2024-12-21 05:18:42 -08:00
Sam Lantinga c44fa5bb07 Updated raw input events to match SDL style
Also added raw keyboard events, and implemented raw input events on iOS, OpenBSD console, Linux console, and X11
2024-12-21 05:18:42 -08:00
Ethan Lee 7e8576fd19 gpu: Xbox fixes for swapchain presentation 2024-12-20 14:56:33 -05:00
Ethan Lee 5d9ccb6296 gpu: Add explicit casts to D3D12 staging descriptor changes 2024-12-20 00:56:48 -05:00
Ethan Lee e992522cb2 Xbox buildfixes for WarpCursor jitter fix, dark mode 2024-12-20 00:55:54 -05:00
Frank Praznik 3ce68f80bc
wayland: Clean up the relative pointer if the seat capability is removed
Also use wl_pointer_release, when available, instead of destroy.
2024-12-19 14:33:06 -05:00
Frank Praznik 7c8171da92
wayland: Handle the relative pointer manager appearing after the seat has been initialized 2024-12-19 14:26:51 -05:00
Frank Praznik 8c849ecc6c
wayland: Add support for the MOUSE_RAW_* events
Mouse button numbers are passed through directly, and axis values are passed through as the raw, 32-bit, wl_fixed_t 24.8 fixed-point values, which need to be divided by the denominator to convert to int/float.
2024-12-19 14:10:09 -05:00
Frank Praznik fce922b66c
wayland: Add support for the SDL_MOUSE_RELATIVE_SYSTEM_SCALE hint
The relative pointer protocol sends both the accelerated and unaccelerated deltas, so select between them based on the hint value.
2024-12-19 14:10:08 -05:00
Sam Lantinga e08f34c3be Removed SDL_HINT_MOUSE_RELATIVE_MODE_WARP
This complicated mouse handling and is a rarely tested path. Real relative mode is much better performance and higher precision.
2024-12-19 10:33:02 -08:00
Sam Lantinga 6e0df0af24 Reduce the possibility of SDL_LockMutex getting called on a destroyed mutex after SDL_StopEventLoop 2024-12-19 09:32:31 -08:00
expikr 5c0f8dc179
add alternate raw mouse motion events with windows implementation (#10042) 2024-12-18 17:29:27 -08:00
expikr 345cab1e36
streamline cursor clipping logic on windows (#11237)
This commit does the following:
- add logic in the `WM_MOUSEMOVE` case of the Window to conditionally call `WIN_UpdateClipCursor` upon receiving cursor motion if SDL is expecting the mouse to be clipped in some way (Fixes #7890)
- remove Windows-specific periodic refresh of cursor clipping and its `SDL_HINT_MOUSE_RELATIVE_CLIP_INTERVAL` hint (superceded by the above bullet point)
- streamline the processing logic within `WIN_UpdateClipCursor` for better readability of each branch, and avoid calling the Platform API until it is absolutely necessary.
- move `relative_mouse_center` field from Windows-specific per-window `SDL_WindowData` to the global `SDL_Mouse` struct, and the corresponding hint callbacks to `SDL_mouse.c` instead of `SDL_windowswindow.c`
2024-12-18 17:25:06 -08:00
Marcin Serwin 35a9d156a6 render: convert tmotion vectors to render basis
When using `SDL_ConvertEventToRenderCoordinates` with
`SDL_EVENT_FINGER_MOTION` events it converts `x` and `y` coordinates but
does not convert the the `dx` and the `dy` unlike `xrel` and `yrel` of
mouse motion events. This is means that these are rather useless after
conversion. This change unifies this behavior between touch and mouse
motion events.
2024-12-18 17:17:14 -08:00
pixelsuft‮ 3739749404
Improve Win32 darkmode and fix title bar's context menu (#11543)
Use hidden uxtheme.dll and user32.dll functions for darkmode instead of using DwmSetWindowAttribute.
Fixes context menu on title bar.
2024-12-18 17:11:31 -08:00
Frank Praznik 3001c61de0 x11: Use the master pointer device for absolute motion
Slave pointer devices can seemingly lag behind the master for some reason, so use the master pointer coordinates for absolute motion.

Master events are now only filtered out on the pen path.
2024-12-18 18:21:22 -05:00
Sam Lantinga 835b6e0c1a Enable high refresh rates on iOS
Fixes https://github.com/libsdl-org/SDL/issues/7518
2024-12-18 14:36:30 -08:00
Ryan C. Gordon 4d4a2786bb render: Updates to format-string versions of SDL_RenderDebugText.
- Removes SDL_RenderDebugTextV
- Changes SDL_RenderDebugTextF to SDL_RenderDebugTextFormat and tweaks it to
  work in a world without SDL_RenderDebugTextV.
- Tweaked rendering position of formatted text in the example program.
2024-12-18 10:40:31 -05:00
williamistGitHub 1d0e28a5b3 Add SDL_RenderDebugTextF & SDL_RenderDebugTextV
This should make it easier to quickly put important numbers and such on
the screen without having to format them into a string manually.
2024-12-18 10:40:31 -05:00
Evan Hemsley 0fbcd0d586
GPU: Optimize usage of D3D12 staging descriptors (#11657) 2024-12-17 22:22:22 -08:00
Semphris 684098fac3 Fix possible bug with Windows dialogs
The Windows implementation of dialogs use the Win32 API, which expects the file filters to have null bytes as separator, and two null bytes at the end of the filter list. To help with string manipulation, the internal code uses 0x01 bytes instead of null bytes, and converts all 0x01 bytes into null bytes at the last moment. If someone decides to put two consecutive 0x01 bytes in their filter names, the code might mistakenly pick them up and convert them to null bytes, leading to Windows failing to pick up later filters. In practice, this is probably not so bad, since it requires someone to have control over file filters already, and allows at most ignoring the following file filters. It is also unlikely to happen by accident since 0x01 is not printable. This commit fixes that by replacing all the 0x01 bytes with the space character.
2024-12-17 20:50:39 -08:00
Semphris bc9c86bcc2 Dialog: Add suffix to filters all the time
For some obscure reason I can't remember, I had made it so the suffix would be added only if the filter list was empty. That isn't the expected behavior and caused a mishandling of memory on Windows, which requires a two-null-bytes suffix.
2024-12-17 20:50:39 -08:00
Frank Praznik eda0261c4e video: Drop size and position requests for windows in a fixed size/position state
It is not uncommon for clients to redundantly set the window size and position, either as a holdover from an SDL 1 port, when this was required, due to any window state change triggering a universal update function that sets all window state, even if unnecessary (e.g. always calling SDL_SetWindowSize(), even if the window is fullscreen), or due to the use of compatability layers. Historically, these clients expect that their behavior won't override the base window state, which is an assumption that the windowing changes in SDL 3 broke by caching size and position changes that can't be applied immediately.

This change drops size and position requests when the window is in the maximized and fullscreen states (fullscreen-desktop windows will be repositioned, but the non-fullscreen floating position will not be overwritten), which is behavior more in line with existing client assumptions, and should ease the porting process, as well as prevent annoying bugs when older software is run via sdl2-compat.

In the process of making these changes, pending window state has been moved to separate variables in the SDL_Window struct, as this fixes bugs regarding fullscreen display selection and centering windows immediately after resize on asynchronous platforms, which had issues due to pending state possibly being overwritten.
2024-12-17 10:45:40 -05:00
Ozkan Sezer 6fa6297441 fix typo from commit b84f150d06 2024-12-17 11:15:56 +03:00
Ozkan Sezer b84f150d06 fix macOS builds with hidapi disabled
Fixes: https://github.com/libsdl-org/SDL/issues/11647 .
2024-12-17 11:11:56 +03:00
Sam Lantinga 080b3002c6 Fixed building with an older Windows SDK 2024-12-16 22:33:31 -08:00
Ryan C. Gordon d0d1414836 messagebox: Copy title and message up front, to protect SDL_GetError() strings.
It's possible (likely!) someone could just pass a pointer returned by
SDL_GetError for one of these strings, but the message box code has to do a
ton of complicated stuff that might _also_ call SDL_SetError, so you could
end up with the string having different contents by the time you display it.

Just make a copy of the strings unconditionally at the start, so they're safe
no matter where they came from.

Fixes #10932.
2024-12-16 21:58:05 -05:00
Ryan C. Gordon 0bb42cb023 alsa: a few more minor formatting tweaks. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon 483ceb5355 alsa: Reenable SDL's internal channel map support when ALSA can't swizzle. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon 35360ec4d7 alsa: Use more hints for opening default devices. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon 576f13ac7c alsa: Put debug logging back into correct category and logging level. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon ff96c59df4 alsa: Add back in code to guess the correct ALSA device prefix. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon b108b54c6a alsa: Bring up to current SDL coding conventions and standards, other tweaks. 2024-12-16 12:19:48 -05:00
Ryan C. Gordon 639855b7e5 alsa: Remove direct calls to memset 2024-12-16 12:19:48 -05:00
Ryan C. Gordon a4a1dff219 alsa: remove `loop` macro 2024-12-16 12:19:48 -05:00
Ryan C. Gordon b9c062c858 alsa: Pulled in latest changes from @sylware 2024-12-16 12:19:48 -05:00
Sam Lantinga 76e7bc4c04 Added support for ALSA dmix audio output (thanks @sylware!)
Fixes https://github.com/libsdl-org/SDL/issues/8577
2024-12-16 12:19:48 -05:00
Frank Praznik eb3fc0684c wayland: Don't close an externally owned display on init failure 2024-12-15 10:51:51 -05:00
L zard 6cc9ce183d SDL_internal: remove `#undef SDL_LEAN_AND_MEAN`
I am confused by the "You have to manually edit this file" comment. Does it mean that it is expected to manually remove the previous `#define SDL_LEAN_AND_MEAN 0` ?
In any case I put this part of the change in a separate commit so that it can easily be reverted.
2024-12-14 09:22:29 -08:00
L zard 8b6d3c88cf Fix `#ifdef`s to have config flags either defined as 1 or undefined
See 387774ab8a
2024-12-14 09:22:29 -08:00
Frank Praznik 313d522f39 wayland: Only require fifo-v1 for Wayland by default
Some compositors may not implement commit-timing-v1 in addition to fifo-v1, at least not immediately, and Mesa doesn't require commit-timing for FIFO behavior. The fifo-v1 protocol alone is enough for the desired behavior.

Only check for fifo-v1 to enable Wayland by default.
2024-12-13 18:40:34 -05:00
Ryan C. Gordon ac2edad809
audio: Simplify and unify audio stream format updating when devices change.
This used to do different things for recording streams in different parts of
the codebase, not to mention two separate codepaths through
UpdateAudioStreamFormatsPhysical in any case. My hope is this should kill off
a few corner case bugs...for example, this one:

Fixes #8402.
2024-12-13 14:59:16 -05:00
Ethan Lee 9628549c7c Xbox buildfixes 2024-12-13 11:34:39 -05:00
Ryan C. Gordon 80b9986418
audio: Fixed potential NULL dereference.
This could happen if you call SDL_BindAudioStreams() when the subsystem isn't
initialized, and possibly in other corner cases.

Thanks to Qianxin CodeSafe Team, @QiAnXinCodeSafe, for discovering this issue!

Fixes #11643.
2024-12-13 10:12:33 -05:00
Sam Lantinga 1944bc7407 Fixed warning C4702: unreachable code 2024-12-12 15:43:42 -08:00
Sam Lantinga 63a498c966 Fixed warning C4189: 'cqe': local variable is initialized but not referenced 2024-12-12 15:43:07 -08:00
Sam Lantinga ce9dddfde2 Don't free properties while modifying the property hashtable
A property cleanup callback might end up trying to set other properties, so we don't want to have a lock held at that point.

Fixes an assertion in testprocess when cleaning up IO stream properties
2024-12-12 14:39:53 -08:00
Sam Lantinga 43a61fec91 Removed external hashtable locking functions
Read-write locks are not recursive and can't be upgraded from one type to another, so it's not safe to lock the hash table and then call functions that operate on it. If you really want this functionality, we'd need to create unlocked versions of the hashtable functions and you would call those once you've taken a lock on the hashtable, and we'd have to assert that the operations you're doing are compatible with the type of lock you've taken.

All of that complicates working with hashtables, so if you need that type of access, you should probably just use external locking.
2024-12-12 14:39:53 -08:00
Sam Lantinga 61511c48a4 SDL_HashTable is now optionally thread-safe
Fixes https://github.com/libsdl-org/SDL/issues/11635
2024-12-12 14:39:53 -08:00
Ryan C. Gordon e0cee83a3a
emscriptenaudio: Removed comment about Firefox not supporting userActivation.
It does now, and has since Firefox 120 (around November 2023).
2024-12-12 10:48:23 -05:00
Marcin Serwin ce7cb10541 dialog/unix: create zenity argv on the main thread
Creating `argv` for zenity means we don't have to pass the building
blocks between threads which allows us to avoid deep copying some nested
structures. It also allows us to fail earlier in case of problems with
building the argument vector.
2024-12-11 20:57:07 -08:00
Marcin Serwin cf59fc797f dialog/unix: deep copy args to avoid data race
SDL properties passed to the `SDL_Zenity_ShowFileDialogWithProperties`
may be destroyed/modified immediately upon the function return.
Therefore, we must copy all the strings and structures passed via
pointers; otherwise, the `SDL_ZenityFileDialog` thread attempting to
read them will cause data race.
2024-12-11 20:57:07 -08:00
Marcin Serwin af6c641b8c dialog/unix: stricter typing
Introduce `const` where appropriate
2024-12-11 20:57:07 -08:00
Marcin Serwin 4c86511035 dialog/unix: reduce string allocations
Simplifies logic of spawning the zenity process by avoiding allocations
of static strings
2024-12-11 20:57:07 -08:00
Marcin Serwin ff82238172 dialog/unix: remove /usr/bin/env indirection
SDL process is using `posix_spawnp` which already does the path lookup
so additional indirection via `env` is unnecessary
2024-12-11 20:57:07 -08:00
cosmonaut c5acbef3bf GPU: Fix D3D12_INTERNAL_StrToWStr returning incorrect length 2024-12-11 16:38:28 -08:00
Ryan C. Gordon 6fe09e3aa4
dynapi: Minor optimization to SDL_SetError wrapper. 2024-12-11 18:04:43 -05:00
Evan Hemsley 3ee39f6c3f
GPU: Revise swapchain acquisition (#11633)
---------

Co-authored-by: Lucas Murray <22484+lmurray@users.noreply.github.com>
2024-12-11 11:16:35 -08:00
Ryan C. Gordon f45ce45603 ngage: Remove Nokia N-Gage support.
This can be reverted if a toolchain arrives that can handle C99 features like
variables declared in the middle of a scope, but for now we literally can't
compile SDL3 for this platform.

Fixes #11243.
2024-12-11 13:29:43 -05:00
Sam Lantinga 962268ca21 Fixed Chinese locales on PSP (thanks @ccawley2011!) 2024-12-10 14:47:31 -08:00
Frank Praznik 7c5c88a3ad
cocoa: Fix conditional coding style 2024-12-09 23:49:17 -05:00
Frank Praznik d4225070ad cocoa: Toggle the fullscreen menu item to 'leave' when entering a fullscreen space
Only return 'NO' during the menu item validation if the window is fullscreen and not in a fullscreen space.
2024-12-09 23:43:31 -05:00
Frank Praznik 5447cb6d38 video: Prefer the window manager supplied coordinates for selecting a fullscreen display
Unless there are pending client requested window coordinates, such as in the case where the position is set followed by immediately by entering fullscreen, prefer the true window coordinates as sent by the window manager to select a fullscreen display.

Fixes the case where, if the window manager moves an already maximized window to another display, the window would be made fullscreen on the wrong display since the last floating coordinates would be used.
2024-12-09 11:50:26 -05:00
Anonymous Maarten e4215a04d9 gpu: make macro's function-like using do-while-0 2024-12-09 00:01:16 +01:00
Anonymous Maarten fb71b44231 gpu: define EXPAND_ARRAY_IF_NEEDED macro once and make it function-like 2024-12-09 00:01:16 +01:00
Anonymous Maarten 0370b92d80 gpu: SDL_ClaimWindowForGPUDevice must set an error message on failure 2024-12-09 00:01:16 +01:00
cosmonaut 5c020b9930 GPU: Enable VK_ERROR_NATIVE_WINDOW_IN_USE_KHR to print 2024-12-08 11:20:06 -08:00
cosmonaut 279836d259 GPU: Swapchain image count respects number of allowed frames in flight 2024-12-08 09:07:50 -08:00
Anonymous Maarten 1d5d948ccf
Fix building SDL3 without dialog support 2024-12-08 14:31:19 +00:00
Marcin Serwin b5c05b6e29 wayland: pass actual empty strings to zenity
The double quotes were passed literally to the zenity arguments which
resulted in the message box displaying literal `""` when no text was
given. The empty string is more logical in this case, e.g., the empty
title results in the message box having lesser height.
2024-12-07 15:19:26 -08:00
Marcin Serwin 1e7c7c69c5 wayland: handle 0 extra buttons in message box
When no extra buttons are passed to zenity with `--question --switch`
arguments it fails to show anything, however, SDL3 still reports
success. To handle this case, we pass an additional "OK" button.
2024-12-07 15:19:26 -08:00
Salman Alshamrani 972c6d0b82 Add `SetTextInputProperties` to video device API and fix iOS handling 2024-12-07 11:43:35 -08:00
Salman Alshamrani 5d09656afa Refactor iOS text input activation to better work with hardware keyboards 2024-12-07 11:43:35 -08:00
Salman Alshamrani 72895a6994 Remove unused `hardwareKeyboard` variable 2024-12-07 11:43:35 -08:00
Sam Lantinga caf0348b26 Enable ApplePressAndHoldEnabled
Fixes https://github.com/libsdl-org/SDL/issues/3622
2024-12-06 17:33:10 -08:00
Sam Lantinga 900627f7fc Enable the SDL_HINT_MOUSE_DOUBLE_CLICK_TIME and SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS hints on macOS
Fixes https://github.com/libsdl-org/SDL/issues/4000
2024-12-06 17:07:16 -08:00
Sam Lantinga 846eb9a886 Added SDL_RenderTextureAffine() to the exported API 2024-12-06 14:16:16 -08:00
expikr d0f1910918 add SDL_RenderTextureAffine 2024-12-06 14:14:47 -08:00
Evan Hemsley fa5f84fb6e
GPU: Add SetGPUAllowedFramesInFlight (#11599) 2024-12-06 11:56:20 -08:00
Sam Lantinga ffb9b30e84 The metal renderer doesn't actually support RGB texture formats
Fixes https://github.com/libsdl-org/SDL/issues/11576
2024-12-06 09:47:50 -08:00
Ozkan Sezer d1b8fcd692 work around type redefinition errors in SDL_immdevice.h 2024-12-06 17:51:00 +03:00
Lucas Murray 9b82d46259 GPU: Use correct logging category 2024-12-06 07:53:37 -05:00
Lucas Murray 5229b520af GPU: Log D3D12 driver version 2024-12-05 21:49:42 -08:00
Semphris 7ddda4fe18 Add system theme support for Emscripten 2024-12-05 20:01:56 -08:00
Sam Lantinga 3060105cfa Don't filter out controllers when launched by Steam under Proton
Fixes https://github.com/libsdl-org/SDL/issues/11579
2024-12-05 19:50:15 -08:00
Frank Praznik 2e5208f353
kmsdrm: Fix Vulkan type redefinition errors from commit 24ed947cc3 2024-12-05 19:52:19 -05:00
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