We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 9

Summary: Keylock patch...
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: API change    
Priority: P2    
Version: HG 2.1   
Hardware: All   
OS: All   
Attachments: keylock patch

Description Ryan C. Gordon 2006-01-03 11:47:05 UTC
Date: Sun, 4 Sep 2005 14:23:37 +0100
To: sdl@libsdl.org
From: Julian Brown <brown@compsci.bristol.ac.uk>
Subject: [SDL] [PATCH] API to enable caps lock/num lock release events

[Trying to send this again. Sorry for any repeats.]

Hi,

I'm new here, so apologies in advance if this is slightly clueless (I'm
not sure if/how often this issue has come up before!).

For a little program I'm porting (back to!) to Linux just for fun,
it'd be really handy to have caps lock (and num lock, but that's not
so immediately pressing for me) treated like an ordinary key (*). I
assume the vast majority of machines can handle this from an OS/hardware
perspective, so it seems a little strange to me for there to be *no way*
of enabling this functionality in SDL.

So, this patch adds an API:

  int SDL_EnableLockKeyRelease(int enable);

with fairly similar semantics to SDL_EnableUNICODE: 1 to enable the
feature, 0 to disable it, -1 to just read previous value. So, e.g.,
I can put at the start of my program:

  SDL_EnableLockKeyRelease(SDL_TRUE);

and then caps lock & num lock will behave "as expected".

I've tested on a grand total of one machine type, x86/Linux with X11.
Please feel free to reformat/rewrite/augment the patch if necessary!

Cheers,

Julian

(*) It's a micro emulator, so needs fairly raw keyboard input. A quick
web search seemed to reveal other people had encountered similar
problems, but I couldn't find any existing solutions.

-----

...and here's a version with slightly fewer obvious bugs up-front (I
missed two break statements and spelled the error message wrong...).

Cheers,

Julian
Comment 1 Ryan C. Gordon 2006-01-03 11:47:33 UTC
Created attachment 7 [details]
keylock patch
Comment 2 Ryan C. Gordon 2006-01-05 02:33:46 UTC
(Changed severity to "API change" for a bunch of bugs.)

--ryan.

Comment 3 Ryan C. Gordon 2006-01-27 11:23:01 UTC
Setting Sam as "QA Contact" on all bugs (even resolved ones) so he'll definitely be in the loop to any further discussion here about SDL.

--ryan.

Comment 4 Sam Lantinga 2006-03-19 01:23:21 UTC
I'd actually like to change the key behavior so it works they way you'd expect in SDL 1.3.
Comment 5 Ryan C. Gordon 2006-10-28 21:10:55 UTC
Reassigning bug to Sam.

--ryan.

Comment 6 Ryan C. Gordon 2018-08-05 20:31:36 UTC
I think we did this, right? Can this be considered resolved for SDL2?

--ryan.
Comment 7 Ryan C. Gordon 2021-01-12 04:15:15 UTC
At the risk of resolving a single-digit bug glibly, I believe this is in a reasonable state in SDL 2.0.x, until we hear otherwise.

--ryan.