SDL 1.3 keyboard test (please participate)

With SDL 1.3 we’re trying something new with keyboard input:

The SDLK* constants have been extended to include the entire Unicode space,
and represent the characters generated using the current keyboard layout.

A set of virtual scancodes representing the physical keys have been added,
and these are layout independent, with the alphabetic keys positioned in
the US QWERTY layout. These scancodes are based on the USB HID standard.

This system has the advantage that positional controls (e.g. WASD) work
on all keyboard layouts by using the scancodes, and non-positional controls
(e.g. I for inventory) work on all keyboards containing those keys.

The big disadvantge of this system is that neither X11 nor Win32 support
the concept of position independent virtual keys, so we end up having to
look at raw keyboard scancodes to make sure we’re getting the right values.

This makes me very nervous, so to get a feel for how robust this method
is, I’d like everybody who can to download the SDL 1.3 source code and
build the checkkeys test program and see if the output matches your keyboard.
(there’s no graphical output, keys are printed to stdout)

I’m especially interested in your results if you have non-standard keyboards,
international keyboards, non-PC hardware, or non-XOrg/XFree86 X servers.

This is implemented for Windows, X11 and Mac OS X.

http://www.libsdl.org/tmp/SDL-1.3.tar.gz
or
http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

tried to build from tar.gz you posted but got this…

In file included from ./src/video/directfb/SDL_DirectFB_events.h:24,
from ./src/video/directfb/SDL_DirectFB_events.c:32:
./src/video/directfb/SDL_DirectFB_video.h:144: error: expected
specifier-qualifier-list before ‘u8’
./src/video/directfb/SDL_DirectFB_events.c: In function
’DirectFB_PumpEventsWindow’:
./src/video/directfb/SDL_DirectFB_events.c:73: error: too many arguments to
function ‘SDL_SendKeyboardKey’
./src/video/directfb/SDL_DirectFB_events.c:79: error: too many arguments to
function ‘SDL_SendKeyboardKey’
./src/video/directfb/SDL_DirectFB_events.c: In function
’DirectFB_InitOSKeymap’:
./src/video/directfb/SDL_DirectFB_events.c:157: error: ‘SDLK_0’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:157: error: (Each undeclared
identifier is reported only once
./src/video/directfb/SDL_DirectFB_events.c:157: error: for each function it
appears in.)
./src/video/directfb/SDL_DirectFB_events.c:158: error: ‘SDLK_1’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:159: error: ‘SDLK_2’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:160: error: ‘SDLK_3’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:161: error: ‘SDLK_4’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:162: error: ‘SDLK_5’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:163: error: ‘SDLK_6’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:164: error: ‘SDLK_7’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:165: error: ‘SDLK_8’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:166: error: ‘SDLK_9’ undeclared
(firstuse in this function)
./src/video/directfb/SDL_DirectFB_events.c:228: error: 'SDLK_EQUALS’
undeclared
(first use in this function)
./src/video/directfb/SDL_DirectFB_events.c:229: error: 'SDLK_RIGHTBRACKET’
undeclared (first use in this function)
./src/video/directfb/SDL_DirectFB_events.c:230: error: 'SDLK_LEFTBRACKET’
undeclared (first use in this function)
./src/video/directfb/SDL_DirectFB_events.c:231: error: 'SDLK_BACKSLASH’
undeclared (first use in this function)
./src/video/directfb/SDL_DirectFB_events.c:232: error: 'SDLK_SEMICOLON’
undeclared (first use in this function)
./src/video/directfb/SDL_DirectFB_events.c:234: error: ‘SDLK_COMMA’ undeclared
(first use in this function)
./src/video/directfb/SDL_DirectFB_events.c:235: error: 'SDLK_PERIOD’
undeclared
(first use in this function)
./src/video/directfb/SDL_DirectFB_events.c:236: error: ‘SDLK_SLASH’ undeclared
(first use in this function)
make: *** [build/SDL_DirectFB_events.lo] Error 1
neil at salon:~/cutouts/SDL-1.3$
neil at salon:~/cutouts/SDL-1.3$

tried to build from tar.gz you posted but got this…

DirectFB isn’t updated for the new video API, just configure with:
–disable-video-directfb

See ya,
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

OK - UK keyboard - Xorg -

X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: Linux Debian (xorg-server 2:1.3.0.0.dfsg-12lenny2)
Current Operating System: Linux salon 2.6.22-3-686 #1 SMP Mon Nov 12 08:32:57
UTC2007 i686
Build Date: 19 January 2008

keys presses \ , . / ; ’ # [ ] - = / * - s d l r o x `

going left to right bottom up of all the non letter character keys

keypad function keys

sdlrox

and the key on the top left corner below escape

hope this is useful!

and can recheck on my kubuntu dell laptop if you like…

./checkkeys
Using scancode set 1
Sending text event
Key pressed : scancode 0x0064 = , keycode 0x0000005C = \ ()
modifiers: (none)
Text:
Key released: scancode 0x0064 = , keycode 0x0000005C = \ modifiers: (none)
Sending text event ,
Key pressed : scancode 0x0036 = , keycode 0x0000002C = , (,) modifiers:
(none)
Text: ,
Key released: scancode 0x0036 = , keycode 0x0000002C = , modifiers: (none)
Sending text event .
Key pressed : scancode 0x0037 = ., keycode 0x0000002E = . (.) modifiers:
(none)
Text: .
Key released: scancode 0x0037 = ., keycode 0x0000002E = . modifiers: (none)
Sending text event /
Key pressed : scancode 0x0038 = /, keycode 0x0000002F = / (/) modifiers:
(none)
Text: /
Key released: scancode 0x0038 = /, keycode 0x0000002F = / modifiers: (none)
Sending text event ;
Key pressed : scancode 0x0033 = ;, keycode 0x0000003B = ; (:wink: modifiers:
(none)
Text: ;
Key released: scancode 0x0033 = ;, keycode 0x0000003B = ; modifiers: (none)
Sending text event '
Key pressed : scancode 0x0034 = ‘, keycode 0x00000027 = ’ (’) modifiers:
(none)
Text: '
Key released: scancode 0x0034 = ', keycode 0x00000027 = ’ modifiers: (none)
Sending text event #
Key pressed : scancode 0x0031 = , keycode 0x00000023 = # (#) modifiers:
(none)
Text: #
Key released: scancode 0x0031 = , keycode 0x00000023 = # modifiers: (none)
Sending text event [
Key pressed : scancode 0x002F = [, keycode 0x0000005B = [ ([) modifiers:
(none)
Text: [
Key released: scancode 0x002F = [, keycode 0x0000005B = [ modifiers: (none)
Sending text event ]
Key pressed : scancode 0x0030 = ], keycode 0x0000005D = ] (]) modifiers:
(none)
Text: ]
Key released: scancode 0x0030 = ], keycode 0x0000005D = ] modifiers: (none)
Sending text event -
Key pressed : scancode 0x002D = -, keycode 0x0000002D = - (-) modifiers:
(none)
Text: -
Key released: scancode 0x002D = -, keycode 0x0000002D = - modifiers: (none)
Sending text event =
Key pressed : scancode 0x002E = =, keycode 0x0000003D = = (=) modifiers:
(none)
Text: =
Key released: scancode 0x002E = =, keycode 0x0000003D = = modifiers: (none)
Sending text event /
Key pressed : scancode 0x0054 = Keypad /, keycode 0x40000054 = Keypad
/ modifiers: (none)
Text: /
Key released: scancode 0x0054 = Keypad /, keycode 0x40000054 = Keypad
/ modifiers: (none)
Sending text event *
Key pressed : scancode 0x0055 = Keypad *, keycode 0x40000055 = Keypad

  • modifiers: (none)
    Text: *
    Key released: scancode 0x0055 = Keypad *, keycode 0x40000055 = Keypad
  • modifiers: (none)
    Sending text event -
    Key pressed : scancode 0x0056 = Keypad -, keycode 0x40000056 = Keypad
  • modifiers: (none)
    Text: -
    Key released: scancode 0x0056 = Keypad -, keycode 0x40000056 = Keypad
  • modifiers: (none)
    Sending text event s
    Key pressed : scancode 0x0016 = S, keycode 0x00000073 = S (s) modifiers:
    (none)
    Text: s
    Key released: scancode 0x0016 = S, keycode 0x00000073 = S modifiers: (none)
    Sending text event d
    Key pressed : scancode 0x0007 = D, keycode 0x00000064 = D (d) modifiers:
    (none)
    Text: d
    Key released: scancode 0x0007 = D, keycode 0x00000064 = D modifiers: (none)
    Sending text event l
    Key pressed : scancode 0x000F = L, keycode 0x0000006C = L (l) modifiers:
    (none)
    Text: l
    Key released: scancode 0x000F = L, keycode 0x0000006C = L modifiers: (none)
    Sending text event r
    Key pressed : scancode 0x0015 = R, keycode 0x00000072 = R ® modifiers:
    (none)
    Text: r
    Key released: scancode 0x0015 = R, keycode 0x00000072 = R modifiers: (none)
    Sending text event o
    Key pressed : scancode 0x0012 = O, keycode 0x0000006F = O (o) modifiers:
    (none)
    Text: o
    Key released: scancode 0x0012 = O, keycode 0x0000006F = O modifiers: (none)
    Sending text event x
    Key pressed : scancode 0x001B = X, keycode 0x00000078 = X (x) modifiers:
    (none)
    Text: x
    Key released: scancode 0x001B = X, keycode 0x00000078 = X modifiers: (none)
    Sending text event Key pressed : scancode 0x0035 =, keycode 0x00000060 = () modifiers:
    (none)
    Text: Key released: scancode 0x0035 =, keycode 0x00000060 = ` modifiers: (none)

OK - UK keyboard - Xorg -

Looks great, thanks! Do you have any “internet” keys or anything like that?

Checking your Dell laptop would be helpful as well.

Thanks!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

Swedish keyboard

???

robin at PC:~/Desktop/SDL-1.3/test$ ./checkkeys
Using scancode set 1
Sending text event
Key pressed : scancode 0x002F = [, keycode 0x000000E5 = ? (?) modifiers:
(none)
Text:
Key released: scancode 0x002F = [, keycode 0x000000E5 = ? modifiers:
(none)
Sending text event
Key pressed : scancode 0x0034 = ', keycode 0x000000E4 = ? (?) modifiers:
(none)
Text:
Key released: scancode 0x0034 = ', keycode 0x000000E4 = ? modifiers:
(none)
Sending text event
Key pressed : scancode 0x0033 = ;, keycode 0x000000F6 = ? (?) modifiers:
(none)
Text:
Key released: scancode 0x0033 = ;, keycode 0x000000F6 = ? modifiers:
(none)

I’m especially interested in your results if you have non-standard
keyboards, international keyboards, non-PC hardware, or non-XOrg/XFree86 X
servers.

I’m trying with a spanish keyboard on a PC running Linux. It’s extremely
similar to this one :
http://www.pcservice.com.uy/download/imagenesmail/eukm408_gde.jpg but with
some differences because it’s a spanish keyboard. I can take a picture of
mine if that helps.

I don’t like what I see but I’m not sure about what I’m supposed to see to
begin with - sorry, I wasn’t following this thread closely.

First, ? (? key) :

Using scancode set 1
Sending text event
Key pressed : scancode 0x0033 = ;, keycode 0x000000F1 = ? (?) modifiers:
(none)
Text:
Key released: scancode 0x0033 = ;, keycode 0x000000F1 = ? modifiers:
(none)

By the way, it doesn’t say (,) as parenthesis - comma - parenthesis; instead
of the comma I see a question mark inside a square rotated 45?, I guess it’s
"character not present in this font" - the comma appears when I paste the
console output here.On Feb 10, 2008 1:36 PM, Sam Lantinga wrote:


Now I try ? (shift - ? key) :

Key pressed : scancode 0x00E5 = Right Shift, keycode 0x400000E5 = Right
Shift modifiers: RSHIFT
Sending text event
Key pressed : scancode 0x0033 = ;, keycode 0x000000F1 = ? (?) modifiers:
RSHIFT
Text:
Key released: scancode 0x0033 = ;, keycode 0x000000F1 = ? modifiers:
RSHIFT
Key released: scancode 0x00E5 = Right Shift, keycode 0x400000E5 = Right
Shift modifiers: (none)

I get similar results for ? and ?. We don’t use that character in spanish
but it is used in portuguese and for some reason spanish keyboars usually
have it.


Accented characters (? ? ? ? ?) are composed with a dead key, and it doesn’t
seem to work. For ? :

Sending text event ?
Unknown Key (scancode = 0x0034 = ') pressed modifiers: (none)
Text: ?
Unknown Key (scancode = 0x0034 = ') released modifiers: (none)
Sending text event a
Key pressed : scancode 0x0004 = A, keycode 0x00000061 = A (a) modifiers:
(none)
Text: a
Key released: scancode 0x0004 = A, keycode 0x00000061 = A modifiers:
(none)


Now ? and ? (we use opening exclamation and interrogation signs, as in ?wow!
?really?). Both are on the same physical key. The regular keypress should
produce ? and shift-key should produce ? :

Sending text event ?
Key pressed : scancode 0x002E = =, keycode 0x000000A1 = ? (?) modifiers:
(none)
Text: ?
Key released: scancode 0x002E = =, keycode 0x000000A1 = ? modifiers:
(none)
Key pressed : scancode 0x00E5 = Right Shift, keycode 0x400000E5 = Right
Shift modifiers: RSHIFT
Sending text event ?
Key pressed : scancode 0x002E = =, keycode 0x000000A1 = ? (?) modifiers:
RSHIFT
Text: ?
Key released: scancode 0x002E = =, keycode 0x000000A1 = ? modifiers:
RSHIFT
Key released: scancode 0x00E5 = Right Shift, keycode 0x400000E5 = Right
Shift modifiers: (none)


My keyboard also has several weird keys. First the left Windows key, then
the right Windows key, and the right Popup Menu key :

Using scancode set 1
Key pressed : scancode 0x00E3 = Left GUI, keycode 0x400000E3 = Left GUI
modifiers: LGUI
Key released: scancode 0x00E3 = Left GUI, keycode 0x400000E3 = Left GUI
modifiers: (none)
Key pressed : scancode 0x00E7 = Right GUI, keycode 0x400000E7 = Right GUI
modifiers: RGUI
Key released: scancode 0x00E7 = Right GUI, keycode 0x400000E7 = Right GUI
modifiers: (none)
Key pressed : scancode 0x0065 = Menu, keycode 0x40000065 = Menu modifiers:
(none)
Key released: scancode 0x0065 = Menu, keycode 0x40000065 = Menu modifiers:
(none)


Now some icons that look like internet navigation : home, email, back,
forward, a star, a magnifier, reload, and stop :

The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 130
(122), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 236
(228), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 234
(226), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 233
(225), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 230
(222), X11 KeySym 0x0 ((null)).
Key pressed : scancode 0x006C = F17, keycode 0x4000006C = F17 modifiers:
(none)
Key released: scancode 0x006C = F17, keycode 0x4000006C = F17 modifiers:
(none)
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 231
(223), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 232
(224), X11 KeySym 0x0 ((null)).


Icons at the bottom - “mark” in a rectangle; copy; paste; cut; a calculator;
and a LCD :

MARK : The key you just pressed is not recognized by SDL. To help get this
fixed, please report this to the SDL mailing list X11
KeyCode 209 (201), X11 KeySym 0x0 ((null)).

COPY : does nothing

PASTE : Unknown Key (scancode = 0x0089 = ) pressed modifiers: (none)
Unknown Key (scancode = 0x0089 = ) released modifiers: (none)

CUT : does nothing

CALCULATOR : The key you just pressed is not recognized by SDL. To help get
this fixed, please report this to the SDL mailing list X11
KeyCode 161 (153), X11 KeySym 0x0 ((null)).

LCD : The key you just pressed is not recognized by SDL. To help get this
fixed, please report this to the SDL mailing list X11
KeyCode 198 (190), X11 KeySym 0x0 ((null)).


Media player icons : rewind, forward, stop, mute, play/pause :

Key pressed : scancode 0x0075 = Help, keycode 0x40000075 = Help modifiers:
(none)
Key released: scancode 0x0075 = Help, keycode 0x40000075 = Help modifiers:
(none)
Key pressed : scancode 0x007E = Find, keycode 0x4000007E = Find modifiers:
(none)
Key released: scancode 0x007E = Find, keycode 0x4000007E = Find modifiers:
(none)
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 164
(156), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 160
(152), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 162
(154), X11 KeySym 0x0 ((null)).


Euro sign, as [press alt gr] - [press and release E] - [release alt gr] :

Key pressed : scancode 0x00E6 = Right Alt, keycode 0x400000E6 = Right Alt
modifiers: RALT
Key pressed : scancode 0x0008 = E, keycode 0x00000065 = E (e) modifiers:
RALT
Key released: scancode 0x0008 = E, keycode 0x00000065 = E modifiers: RALT
Key released: scancode 0x00E6 = Right Alt, keycode 0x400000E6 = Right Alt
modifiers: (none)


The weird left icons you see in the picture :

The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 223
(215), X11 KeySym 0x0 ((null)).

Only the half moon (sleep?) icon did anything.


The weird right icons :

The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 129
(121), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 208
(200), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 129
(121), X11 KeySym 0x0 ((null)).
The key you just pressed is not recognized by SDL. To help get this fixed,
please report this to the SDL mailing list X11 KeyCode 131
(123), X11 KeySym 0x0 ((null)).

The second icon, some kind of W, did nothing.

Hope this helps. Can I do anything else?

–Gabriel

erm just tried on my dell laptop, erm… build sdl1.3, built test programs…
then it says it cant find any video ( couldnt init sdl - no avaliable video
device ) when i try to run the test program… dunno whats goin on
there, i use
it for development using whatver version of sdl umbongo debs give you,
and they
work… so just to recap, i have no clue what is going on, but it dosnt work.

May I quote Sam

DirectFB isn’t updated for the new video API, just configure with:
–disable-video-directfb

erm just tried on my dell laptop, erm… build sdl1.3, built test programs…
then it says it cant find any video ( couldnt init sdl - no avaliable video
device )

Make sure you have the X11, Xt, Xext and GL/GLU development libraries installed.
I just tried installing on a fresh Ubuntu install and got the same problem. :slight_smile:

See ya,
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment

I’m trying with a spanish keyboard on a PC running Linux. It’s extremely
similar to this one :
http://www.pcservice.com.uy/download/imagenesmail/eukm408_gde.jpg

Wow, that’s a great keyboard to test with. Lots of good feedback,
which mostly means the SDL code needs a lot of work.

Is there any chance I could borrow the keyboard?

See ya!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment