The keycode in key events is affected by modifiers by default.

This behavior can be customized with SDL_HINT_KEYCODE_OPTIONS.
This commit is contained in:
Sam Lantinga 2024-06-22 00:04:33 -07:00
parent 1e81424b3d
commit 90034b16dc
6 changed files with 149 additions and 29 deletions

View file

@ -2003,6 +2003,28 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES "SDL_JOYSTICK_ZERO_CENTERED_DEVICES"
/**
* A variable that controls keycode representation in keyboard events.
*
* This variable is a comma separated set of options for translating keycodes in events:
*
* - "unmodified": The keycode is the symbol generated by pressing the key without any modifiers applied. e.g. Shift+A would yield the keycode SDLK_a, or 'a'.
* - "modified": The keycode is the symbol generated by pressing the key with modifiers applied. e.g. Shift+A would yield the keycode SDLK_A, or 'A'.
* - "french_numbers": The number row on French keyboards is inverted, so pressing the 1 key would yield the keycode SDLK_1, or '1', instead of SDLK_AMPERSAND, or '&'
* - "latin_letters": For keyboards using non-Latin letters, such as Russian or Thai, the letter keys generate keycodes as though it had an en_US layout. e.g. pressing the key associated with SDL_SCANCODE_A on a Russian keyboard would yield 'a' instead of 'ф'.
*
* The default value for this hint is equivalent to "modified,french_numbers"
*
* Some platforms like Emscripten only provide modified keycodes and the options are not used.
*
* These options do not affect the return value of SDL_GetKeyFromScancode() or SDL_GetScancodeFromKey(), they just apply to the keycode included in key events.
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.0.0.
*/
#define SDL_HINT_KEYCODE_OPTIONS "SDL_KEYCODE_OPTIONS"
/**
* A variable that controls what KMSDRM device to use.
*