Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDLK_CAPSLOCK works differently than in SDL 1.2 #331

Open
mikrosk opened this issue May 8, 2024 · 3 comments
Open

SDLK_CAPSLOCK works differently than in SDL 1.2 #331

mikrosk opened this issue May 8, 2024 · 3 comments

Comments

@mikrosk
Copy link

mikrosk commented May 8, 2024

Our project still uses SDL1.2 API (not only due to lack of manpower to do the transition to SDL2 but also because some other backends lack SDL2 entirely). In december 2023 we discovered a discrepancy in CAPSLOCK behaviour between SDL 1.2 and SDL12-compat: atari800/atari800#177.

I didn't make too much of it, I merged the patch however I hadn't realised that this will break any platform still using native SDL 1.2 library and indeed, today I have discovered just that.

In short, the original SDL doesn't send "key up" for CAPSLOCK: https://github.com/libsdl-org/SDL-1.2/blob/be74a7a89a5b004a03a04e3c4279d9068f88cfcd/src/events/SDL_keyboard.c#L496-L497 and simulates "key up" when pressed for the second time: https://github.com/libsdl-org/SDL-1.2/blob/be74a7a89a5b004a03a04e3c4279d9068f88cfcd/src/events/SDL_keyboard.c#L449-L450.

Presumably SDL2 doesn't do this kind of distinction and therefore neither does SDL12-compat.

Personally I find SDL12-compat/SDL2's behaviour more logical but I can't decide which side should be fixed now:

  • there may be old applications which depend on such behaviour (as our project did until December 2023)
  • if such applications are in use, most like they use SDL12-compact and therefore this bug has been already fixed on their side (as in our project after December 2023)

In the meantime perhaps I'll try to partially revert our patch and put it between #ifdef SDL12_COMPAT_HEADERS.

@icculus
Copy link
Collaborator

icculus commented May 8, 2024

This needs to be fixed in sdl12-compat to work like classic 1.2, even if it seems like the less correct behavior.

I would recommend reverting the patch in your code and we'll correct sdl12-compat.

@mikrosk
Copy link
Author

mikrosk commented May 8, 2024

Does sdl12-compat provide some kind of versioning? Because if I revert our patch, it may take a while before the new sdl12-compat makes it into Debian, Ubuntu etc. So if I could put there something like #if defined(SDL12_COMPAT_HEADERS) && SDL12_COMPAT_VERSION < XXX, that would be ideal.

mikrosk added a commit to atari800/atari800 that referenced this issue May 8, 2024
While this fixed issue #177, it also introduced regression on targets
with native SDL 1.2.

This assumes libsdl-org/sdl12-compat#331 will be fixed in 1.2.70; then
the #if can be removed because the code shall be again compatible with
SDL 1.2 (despite its less than ideal behavior).
@jengelh
Copy link

jengelh commented Nov 19, 2024

include/SDL/SDL_version.h:#define SDL_PATCHLEVEL 68

Everything above 50 is the compat variant by definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants