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 1733 - Regression in SDL_GetScancodeFromKey
Summary: Regression in SDL_GetScancodeFromKey
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: x86_64 Windows 7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-26 07:49 UTC by Andreas Schiffler
Modified: 2013-03-01 08:32 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schiffler 2013-02-26 07:49:32 UTC
The recent changes to the windows keyboard code seems to have introduced a regression on the SDL_GetScancodeFromKey function.

SDL_GetScancodeFromKey([SDLK_virtual_key]) should not map to a scancode but return 0. 

Repro on cygwin:
./testautomation --filter keyboard_getScancodeFromKey

INFO:  02/26/13 15:42:06: ----- Test Case 4.10: 'keyboard_getScancodeFromKey' started
INFO:  02/26/13 15:42:06: Test Description: 'Check call to SDL_GetScancodeFromKey'
INFO:  02/26/13 15:42:06: Test Iteration 1: execKey 307027605339784282
INFO:  02/26/13 15:42:06: Assert 'Call to SDL_GetScancodeFromKey(SDLK_4)': Pass
INFO:  02/26/13 15:42:06: Assert 'Validate return value from SDL_GetScancodeFromKey, expected: 33, got: 33': Passed
INFO:  02/26/13 15:42:06: Assert 'Call to SDL_GetScancodeFromKey(SDLK_PLUS)': Pass
ERROR: 02/26/13 15:42:06: Assert 'Validate return value from SDL_GetScancodeFromKey, expected: 0, got: 87': Failed
ERROR: 02/26/13 15:42:06: Assert Summary: Total=4 Passed=3 Failed=1
INFO:  02/26/13 15:42:06: Total Test runtime: 0.0 sec
ERROR: 02/26/13 15:42:06: >>> Test 'keyboard_getScancodeFromKey': Failed

If this behavior is expected, the documentation and the test case should be updated.
Comment 1 Gabriel Jacobo 2013-02-27 02:48:18 UTC

*** This bug has been marked as a duplicate of bug 1730 ***
Comment 2 Philipp Wiesemann 2013-02-28 15:26:40 UTC
(In reply to comment #1)
> 
> *** This bug has been marked as a duplicate of bug 1730 ***

Bug #1730 is about SDL_GetKeyFromScancode() while this bug (#1733) is about SDL_GetScancodeFromKey(). It may be similar but no duplicate.
Comment 3 Sam Lantinga 2013-03-01 01:00:18 UTC
As Phillip said, this is related, but not duplicated.
Comment 4 Sam Lantinga 2013-03-01 01:01:09 UTC
Er, Philipp. :)
Comment 5 Sam Lantinga 2013-03-01 01:04:50 UTC
Nice catch!  This is fixed in:
http://hg.libsdl.org/SDL/rev/b272d47f70a7
Comment 6 Gabriel Jacobo 2013-03-01 08:32:10 UTC
Sorry, I got carried away with the duplicates. I blame Bugzilla ¿?