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 1421

Summary: SDLK_PRINTSCREEN generates SDL_KEYDOWN on key release
Product: SDL Reporter: Andreas Weis <sdl_forum>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: REOPENED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P1    
Version: HG 2.0   
Hardware: x86_64   
OS: Windows (XP)   

Description Andreas Weis 2012-02-17 08:40:06 UTC
On Windows XPx64, the SDL_KEYDOWN event for the Print key (SDLK_PRINTSCREEN) is not generated when pressing the button. Instead it is generated upon *releasing* the button, immediately followed by an SDL_KEYUP event for the same key.

On MacOS X in contrast, events for that key are generated correctly.
Comment 1 Ryan C. Gordon 2013-07-12 18:52:47 UTC
(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.)

Tagging a bunch of bugs as target-2.0.0, Priority 1.

This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible.

That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship.

Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment.

Thanks!
--ryan.
Comment 2 Sam Lantinga 2013-08-01 04:52:22 UTC
I believe this is just how the operating system handles the key on Windows and there's nothing SDL can do about it.

Bouncing to Ryan to confirm.
Comment 3 Ryan C. Gordon 2013-08-01 10:29:08 UTC
(In reply to comment #2)
> I believe this is just how the operating system handles the key on Windows
> and there's nothing SDL can do about it.
> 
> Bouncing to Ryan to confirm.

Yeah, we only get a KEYUP from Windows for that key. It's a common problem, without a good solution. So we fake it:

http://hg.libsdl.org/SDL/file/5287c82340e3/src/video/windows/SDL_windowsevents.c#l473

I think this is the best we can do, short of maybe getting keyboard keys from RAWINPUT instead of the standard message loop, but we're not going to explore that for the 2.0.0 release. Maybe revisit in 2.1? I'll mark this as RESOLVED LATER for now.

--ryan.
Comment 4 Ryan C. Gordon 2013-08-01 21:53:03 UTC
(Actually, I'll reopen this and remove the target-2.0.0 tag, for administrative purposes.)

--ryan.