Commit graph

60 commits

Author SHA1 Message Date
SDL Wiki Bot
e058aa6d65 Sync SDL3 wiki -> header 2024-08-02 21:50:11 +00:00
Sam Lantinga
50492e1d03 Change the text input defaults to match the natural input experience 2024-08-02 14:49:37 -07:00
Sam Lantinga
81f8e6aba6 Added SDL_StartTextInputWithProperties()
This allows you to customize the text input so you can have numeric text entry, hidden passwords, etc.

Fixes https://github.com/libsdl-org/SDL/issues/7101
Fixes https://github.com/libsdl-org/SDL/issues/7965
Fixes https://github.com/libsdl-org/SDL/issues/9439
2024-08-02 14:49:37 -07:00
Sam Lantinga
b5ad74998b Removed SDL_DECLSPEC_FREE 2024-07-28 07:24:21 -07:00
SDL Wiki Bot
0f2fc2fbaa Sync SDL3 wiki -> header 2024-07-27 03:59:43 +00:00
Sam Lantinga
4f55271571 Removed temporary memory from the API
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this.

So, we're largely going back to the original system, where the API returns allocated results and you free them.

In addition, to solve the problems we originally wanted temporary memory for:
* Short strings with a finite count, like device names, get stored in a per-thread string pool.
* Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
2024-07-26 20:59:14 -07:00
Sam Lantinga
5e513ecc7f Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready.
Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings.

Fixes https://github.com/libsdl-org/SDL/issues/10378
2024-07-26 10:05:03 -07:00
SDL Wiki Bot
975457cfb6 Sync SDL3 wiki -> header 2024-07-19 19:23:24 +00:00
Sam Lantinga
71a60d4c0e Updated documentation for functions that return temporary memory 2024-07-19 12:22:03 -07:00
Sam Lantinga
6ca18ed0e5 SDL_GetKeyboards() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga
637e9700dd Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
2024-07-19 12:22:03 -07:00
Sam Lantinga
217330a7b3 Made return value descriptions more consistent across the API 2024-07-19 12:22:03 -07:00
Sam Lantinga
d73c7311d5 Clarify that the SDL_GetStringRule means that SDL will automatically free the memory later. 2024-07-19 12:22:03 -07:00
Sam Lantinga
5c875e1183 Renamed *FromID() to *ForID()
While it makes sense to get an object pointer from an object ID, you want to get object attributes for an ID, otherwise e.g. GetNameFromID() sounds like it's a name ID, not an object ID. This is also consistent with the function naming convention in SDL2.
2024-07-14 15:56:50 -07:00
Sam Lantinga
9358333286 Renamed SDL_GetKeyboardInstanceName() and SDL_GetMouseInstanceName()
For consistency with other device APIs
2024-07-14 13:01:53 -07:00
Ryan C. Gordon
e290d16c47
include: Clean up SDL_GetKeyName documentation. 2024-07-02 12:29:33 -04:00
SDL Wiki Bot
f787790243 Sync SDL3 wiki -> header 2024-07-01 20:57:56 +00:00
Sam Lantinga
78dbf9be50 Document that SDL_GetKeyName() always returns uppercase names for alphabetic keycodes 2024-07-01 13:56:49 -07:00
SDL Wiki Bot
9332de9f25 Sync SDL3 wiki -> header 2024-06-29 00:09:51 +00:00
Sam Lantinga
bdd531986b SDL_SetTextInputRect() has been renamed to SDL_SetTextInputArea()
The new function includes the cursor position so IME UI elements can be placed relative to the cursor, as well as having the whole text area available so on-screen keyboards can avoid it.
2024-06-28 17:09:22 -07:00
SDL Wiki Bot
410bed20ba Sync SDL3 wiki -> header 2024-06-24 18:21:18 +00:00
Sam Lantinga
76631a0978 The text input state has been changed to be window-specific.
SDL_StartTextInput(), SDL_StopTextInput(), SDL_TextInputActive(), SDL_ClearComposition(), and SDL_SetTextInputRect() all now take a window parameter.

This change also fixes IME candidate positioning when SDL_SetTextInputRect() is called before SDL_StartTextInput(), as is recommended in the documentation.
2024-06-24 11:20:08 -07:00
SDL Wiki Bot
1e81424b3d Sync SDL3 wiki -> header 2024-06-22 05:06:38 +00:00
Sam Lantinga
0dd579d40d Removed SDL_Keysym 2024-06-21 22:06:08 -07:00
Sam Lantinga
679e4471ed Added the ability to query the keymap for keycodes based on modifier state 2024-06-21 22:06:08 -07:00
Sam Lantinga
ef9bd8b609 Add the raw platform specific key code to SDL_Keysym
This allows applications to handle keys that SDL doesn't recognize, in a platform dependent way.

Fixes https://github.com/libsdl-org/SDL/issues/6390
2024-06-21 22:06:08 -07:00
Ryan C. Gordon
51902d4ac5
Updated headers with latest wikiheaders tweaks. 2024-06-14 02:09:55 -04:00
Ryan C. Gordon
e23257307e Introduce formal policy for APIs that return strings.
This declares that any `const char *` returned from SDL is owned by SDL, and
promises to be valid _at least_ until the next time the event queue runs, or
SDL_Quit() is called, even if the thing that owns the string gets destroyed
or changed before then.

This is noted in the headers as "the SDL_GetStringRule", so this will both be
greppable to find a detailed explaination in docs/README-strings.md and
wikiheaders will automatically turn it into a link we can point at the
appropriate documentation.

Fixes #9902.

(and several FIXMEs, both known and yet-undocumented.)
2024-06-03 14:20:49 -04:00
SDL Wiki Bot
04a0a85d92 Sync SDL3 wiki -> header 2024-05-29 02:48:51 +00:00
Sam Lantinga
542a3663de Added SDL_GetDefaultKeyFromScancode() to the public API
This is useful when getting the English name of a key for a non-Latin keyboard layout, for example.
2024-05-28 19:48:24 -07:00
Sam Lantinga
6f2621438a Renamed DECLSPEC to SDL_DECLSPEC 2024-05-17 17:09:09 -07:00
Ryan C. Gordon
45df084287
SDL_keyboard.h: Added a \sa to SDL_Keysym's docs. 2024-05-16 12:19:50 -04:00
Ryan C. Gordon
665ff8c5f6
include: Removed :: from symbol names in comments.
This isn't C++ code, so there's no need to append global symbols with two
colons. It looks ugly.

I _did_ leave them for actual C++ things in WinRT-specific comments and other
places, like a reference to a Perl class thing.

Also, even though it's not valid C, it's a useful expression to say
`StructType::SpecificField`, so I left those alone, too.
2024-05-16 12:16:57 -04:00
Ryan C. Gordon
5e6d85b8f0
wikiheaders: bridge wiki Category docs to the headers!
Did an initial cleanup on the headers and wrote a few pieces of documentation,
but this needs more work to fill out the documentation.
2024-05-16 11:48:23 -04:00
Sam Lantinga
026edbeab0 Use the correct type for the modifier in SDL_Keysym
This shrinks the structure by 32-bits because we've removed implicit padding between the fields
2024-05-10 17:36:10 -07:00
Ryan C. Gordon
760d7d276b
include: Filled in some missing documentation. 2024-05-02 22:53:08 -04:00
SDL Wiki Bot
3f2f712fff Sync SDL3 wiki -> header 2024-04-28 12:29:13 +00:00
Ryan C. Gordon
0df988389c
include: Add \since to all documentation that was missing it. 2024-04-11 13:34:29 -04:00
Ryan C. Gordon
e044318a8e
Sync SDL3 wiki -> headers 2024-04-09 00:50:03 -04:00
Ryan C. Gordon
ad090d2444
include: A ton of little documentation tweaks, fixes, and improvements.
This is just stuff I noticed while working on the wikiheaders updates. A
thorough pass over all the docs would not be terrible, and maybe a simple
script to check for consistency (does everything have a `\since` on it? etc)
might be nice, too.
2024-04-09 00:50:02 -04:00
Sam Lantinga
b9a88bbecb Removed SDL_TextInputShown()
This was only implemented on Windows and often confused with SDL_ScreenKeyboardShown()
2024-03-25 13:26:23 -07:00
SDL Wiki Bot
675216e81b Sync SDL3 wiki -> header 2024-03-23 23:32:24 +00:00
Sam Lantinga
9eb87ca325 Note that many things are considered mice and keyboards that you might not expect 2024-03-23 16:31:00 -07:00
Sam Lantinga
c0f4565552 Added SDL_GetKeyboardName() and SDL_GetMouseName() 2024-03-23 16:31:00 -07:00
Sam Lantinga
2fe1a6a279 Initial support for hotplugging mice and keyboards 2024-03-23 16:31:00 -07:00
Charlie Volow
5ae2ffc127 document that text input is on by default
See:
https://discourse.libsdl.org/t/text-input-is-active-by-default-hampering-frame-rate/24396
https://discourse.libsdl.org/t/restoring-text-input-to-the-default-state/42690
2024-01-27 15:18:05 -08:00
Sam Lantinga
5b3ee51c6c Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL Wiki Bot
e4582e6edc Sync SDL3 wiki -> header 2023-11-30 15:22:19 +00:00
shenleban tongying
3e6513c773 document the purpose of SDL_SetTextInputRect 2023-11-28 12:06:16 -08:00
Ryan C. Gordon
c53843a961
docs: Remove Doxygen \brief tags.
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.

Fixes #8446.
2023-11-06 10:26:06 -05:00