The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Inconsistent SDL_KeyCodes between Win & OSX
Tim Walters
Guest

I’ve noticed that the key codes for some keys on non-QWERTY layouts in the key up/down events do not match in SDL on Windows and OS X.
It appears that on Windows, SDL is using the key codes corresponding to their scancode (matching QWERTY) but on OS X SDL is using key codes that match the label on the key where it already has a defined symbol (ex: SDLK_AMPERSAND for 1 on the AZERTY layout) and codes that don’t appear to have a corresponding symbol for others (ex: 233 for é which is on the 2 key on the AZERTY layout).

Is there a reason this inconsistent behavior still exists in SDL 2.x and how can the keycodes for other layouts that don’t have a corresponding SDLK_* symbol be identified?
Inconsistent SDL_KeyCodes between Win & OSX
Daniel Gibson
Guest

Hi,

same problem on Linux, posted about it recently, see
https://forums.libsdl.org/viewtopic.php?t=11555
(I didn't get any feedback from the SDL developers, though, and it's
unclear what behavior is desired, i.e. if Windows or Linux/OSX or
neither behave "as expected")

Interesting how apparently no one complained about this problem for
years and now suddenly two people report it within two weeks :)

Cheers,
Daniel

On 11/13/2015 11:06 PM, Tim Walters wrote:
Quote:
I’ve noticed that the key codes for some keys on non-QWERTY layouts in
the key up/down events do not match in SDL on Windows and OS X.

It appears that on Windows, SDL is using the key codes corresponding to
their scancode (matching QWERTY) but on OS X SDL is using key codes that
match the label on the key where it already has a defined symbol (ex:
SDLK_AMPERSAND for 1 on the AZERTY layout) and codes that don’t appear
to have a corresponding symbol for others (ex: 233 for é which is on the
2 key on the AZERTY layout).

Is there a reason this inconsistent behavior still exists in SDL 2.x and
how can the keycodes for other layouts that don’t have a corresponding
SDLK_* symbol be identified?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Inconsistent SDL_KeyCodes between Win & OSX
Tim Walters
Guest

Yes it looks like this bug probably goes back to SDL 1.x but I'm surprised to see there's still no resolution for it.
Based on very old posts I believe the non-Windows behavior (KeyCode matches label) is desired but strangely it looks like nothing has been done to make all platforms
match behavior which is pretty much the purpose of SDL.

-----Original Message-----
From: SDL [mailto:] On Behalf Of Daniel Gibson
Sent: Saturday, November 14, 2015 10:45 AM
To:
Subject: Re: [SDL] Inconsistent SDL_KeyCodes between Win & OSX

Hi,

same problem on Linux, posted about it recently, see
https://forums.libsdl.org/viewtopic.php?t=11555
(I didn't get any feedback from the SDL developers, though, and it's unclear what behavior is desired, i.e. if Windows or Linux/OSX or neither behave "as expected")

Interesting how apparently no one complained about this problem for years and now suddenly two people report it within two weeks Smile

Cheers,
Daniel

On 11/13/2015 11:06 PM, Tim Walters wrote:
Quote:
I’ve noticed that the key codes for some keys on non-QWERTY layouts in
the key up/down events do not match in SDL on Windows and OS X.

It appears that on Windows, SDL is using the key codes corresponding
to their scancode (matching QWERTY) but on OS X SDL is using key codes
that match the label on the key where it already has a defined symbol (ex:
SDLK_AMPERSAND for 1 on the AZERTY layout) and codes that don’t appear
to have a corresponding symbol for others (ex: 233 for é which is on
the
2 key on the AZERTY layout).

Is there a reason this inconsistent behavior still exists in SDL 2.x
and how can the keycodes for other layouts that don’t have a
corresponding
SDLK_* symbol be identified?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Inconsistent SDL_KeyCodes between Win & OSX
Daniel Gibson
Guest

On 11/17/2015 07:55 PM, Tim Walters wrote:
Quote:
Yes it looks like this bug probably goes back to SDL 1.x but I'm surprised to see there's still no resolution for it.
Based on very old posts I believe the non-Windows behavior (KeyCode matches label) is desired

if it is, those KeyCodes should have names (SDLK_*).

Quote:
but strangely it looks like nothing has been done to make all platforms
match behavior which is pretty much the purpose of SDL.

definitely.

Quote:

-----Original Message-----
From: SDL [mailto:] On Behalf Of Daniel Gibson
Sent: Saturday, November 14, 2015 10:45 AM
To:
Subject: Re: [SDL] Inconsistent SDL_KeyCodes between Win & OSX

Hi,

same problem on Linux, posted about it recently, see
https://forums.libsdl.org/viewtopic.php?t=11555
(I didn't get any feedback from the SDL developers, though, and it's unclear what behavior is desired, i.e. if Windows or Linux/OSX or neither behave "as expected")

Interesting how apparently no one complained about this problem for years and now suddenly two people report it within two weeks :)

Cheers,
Daniel

On 11/13/2015 11:06 PM, Tim Walters wrote:
Quote:
I’ve noticed that the key codes for some keys on non-QWERTY layouts in
the key up/down events do not match in SDL on Windows and OS X.

It appears that on Windows, SDL is using the key codes corresponding
to their scancode (matching QWERTY) but on OS X SDL is using key codes
that match the label on the key where it already has a defined symbol (ex:
SDLK_AMPERSAND for 1 on the AZERTY layout) and codes that don’t appear
to have a corresponding symbol for others (ex: 233 for é which is on
the
2 key on the AZERTY layout).

Is there a reason this inconsistent behavior still exists in SDL 2.x
and how can the keycodes for other layouts that don’t have a
corresponding
SDLK_* symbol be identified?


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org