Inconsistent SDL_KeyCodes between Win & OSX

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?

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 :slight_smile:

Cheers,
DanielOn 11/13/2015 11:06 PM, Tim Walters wrote:

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?

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:sdl-bounces@lists.libsdl.org] On Behalf Of Daniel Gibson
Sent: Saturday, November 14, 2015 10:45 AM
To: sdl at lists.libsdl.org
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 :slight_smile:

Cheers,
Daniel

On 11/13/2015 11:06 PM, Tim Walters wrote:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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_*).

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

definitely.On 11/17/2015 07:55 PM, Tim Walters wrote:

-----Original Message-----
From: SDL [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Daniel Gibson
Sent: Saturday, November 14, 2015 10:45 AM
To: sdl at lists.libsdl.org
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 :slight_smile:

Cheers,
Daniel

On 11/13/2015 11:06 PM, Tim Walters wrote:

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
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


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