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 784

Summary: Problem with handling of multiple keys.
Product: SDL Reporter: Derek Kulinski <takeda>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: 1.2.13   
Hardware: x86   
OS: Windows Vista   

Description Derek Kulinski 2009-08-22 13:15:53 UTC
I don't know whether this is OS specific or not, though I know Windows can handle it, since there are programs (e.g. NES emulators) which don't have problem with that exact combo (I configured them to use those keys and they work fine).

I was first using SDL_GetKeyState() but after experiencing problems I started searching on the web about solutions to it.
Most of them recommend to trace events and keep the key state in an array (which I believe that's exactly what SDL_GetKeyState() is doing)

Anyway, I wrote simple routine which displays the events that are received and it doesn't seem right to me, here's the output:

<here I'm pressing and holding 'z'>

> Got 1 events.
> z down

<while holding 'z' I'm pressing right arrow (You know, B button and arrow in Mario to run)>

> Got 1 events.
> right down

<now I want to jump while running, so I press A ('x' button while holding others>

> Got 1 events.
> x down

<up until now everything looks fine, I'm releasing 'x'>

> Got 1 events.
> x up

<and here's the problem, I'm getting those two events right after the previous one despite still holding 'z' and right arrow>

> Got 2 events.
> z up
> right up

What's the reason for it? Am I doing something wrong? Is there any workaround?
Also I disabled all key repeating (though I believe it's like that by default).
Comment 1 Derek Kulinski 2009-08-22 13:53:47 UTC
Ok looks like this is an issue is with a keyboard, on built-in keyboard in my laptop everything seems to work fine.

So I guess this bug can be closed.