Commit Graph

10104 Commits

Author SHA1 Message Date
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