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 897

Summary: Repeat member to SDL_KeyboardEvent
Product: SDL Reporter: Edgar Simo <bobbens>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   

Description Edgar Simo 2009-12-09 10:50:51 UTC
Hello,


I implemented double tapping using SDL_KeyboardEvents by detecting time between key presses and if under a threshold create a double tap event. Afterwards I decided to activate keyboard repeat for other reasons. However this broke the double tap event. Currently there's no way to detect if an SDL_KeyboardEvent is a repeat or not. I'd propose to add a single member to be able to detect that, something like:

       typedef struct{
         Uint8 type;
         Uint8 state;
         SDL_keysym keysym;
         Uint8 repeat; /**< New repeat member. */
       } SDL_KeyboardEvent;

This would allow detection of repeats and handle them as needed if one wants to distinguish between repeats and actual presses like the case of double taps.

It will be ABI compliant and won't alter backward compatibility, nor will it increase the size of the SDL_event union since there's larger structs (like mouse events for example).

Overall it's a quite minor fix and not sure if anyone other then me might be interested in this. If I have time I'll see how hard it is to patch and attach a patch if possible.


Edgar
Comment 1 Sam Lantinga 2009-12-11 07:27:18 UTC
Sure, that sounds like a reasonable patch.  Thanks!
Comment 2 Sam Lantinga 2010-07-21 00:34:00 UTC
This is in the latest snapshot, thanks!