libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
8.47k stars 1.59k forks source link

Rename Key-/Scan-code names: APOSTROPHE vs QUOTE, GRAVE vs BACKQUOTE #9772

Closed Sackzement closed 2 weeks ago

Sackzement commented 2 weeks ago

""apostrophe" and "quote" are two names for the same symbol: ' "grave" and "backquote" are two names for the same symbol: `

SDL_SCANCODE_APOSTROPHE and SDLK_QUOTE
SDL_SCANCODE_GRAVE      and SDLK_BACKQUOTE

I would like to suggest renaming the scancode names to ...QUOTE:

SDL_SCANCODE_QUOTE     and SDLK_QUOTE
SDL_SCANCODE_BACKQUOTE and SDLK_BACKQUOTE

This would also go nicely with the other already named "quote" macro SDLK_QUOTEDBL(It would fit better if it was named SDLK_DBLQUOTE, but this is an issue for another day)

Sackzement commented 2 weeks ago

I'm not so sure about the renaming to ...QUOTE anymore. A lot of platforms call the characters GRAVE and APOSTROPHE.

Maybe it's better to rename the keycodes to SDLK_APOSTROPHE and SDLK_GRAVE.

slouken commented 2 weeks ago

These are based on the scancode names in the USB standard and we have no plans to change that.

Sackzement commented 2 weeks ago

Then what about changing the keycode names to be similar to their scancode equivalents?

slouken commented 2 weeks ago

That seems reasonable. I'm not sure why they're different. @icculus, thoughts?

Sackzement commented 2 weeks ago

keycodes were already available in 1.0 and scancodes were introduced in 2.0 with the specification names. I guess the names just stuck around.

I like the keycode "quote" names more, but it would be less confusing if they are named after the scancode names.

Edit: Platform specific scancode names were already available in 1.0, official SDL scancode names were available in 2.0.

icculus commented 2 weeks ago

Yeah, it's almost certainly a leftover from SDL 1.x...let's make them match the scancode names.

(And if the scancode names match the HID spec, they stay as they are.)

slouken commented 2 weeks ago

Please use build-scripts/rename_api.py to make any renaming changes.

Sackzement commented 2 weeks ago

Please use build-scripts/rename_api.py to make any renaming changes.

:thumbsup: