Non US keyboards

Hi !

As SDL is at the moment it does not work with most non US keyboard, ok
sorry, it does work fine with US keys of course, but it does not work with
characters used in other languages like Swedish, German, French and so on.

Are there any plans to support this in the future ?

At the moment the SDL_GetKeyName() is hardcoded for US keys and some others,
most platforms has functions for doing key to keyname conversion builtin (at
least Win32 and Xlib has it), would it be possible to use these functions
instead, then non US keys would be translated as they should.

Yes I know that SDL is intended for games which usually does not have any
need for this stuff, but SDL is very flexible and can be used for lots of
other stuff to so I think it would be useful, one example is that there are
a number of GUI libraries being implemented using SDL.

Mikael

As SDL is at the moment it does not work with most non US keyboard, ok
sorry, it does work fine with US keys of course, but it does not work with
characters used in other languages like Swedish, German, French and so on.

“does not work” is a severe exaggeration. Both key events and character code
translation work, only SDL_GetKeyName gives misleading info. This should
be fixed in some way but it’s not crystal clear what the best solution is.

It is clearly not acceptable for GetKeyName to return “world-69” instead of
"?" and this can be trivially fixed (at least for x11); but it would also
be nice to have SDLK_aring defined instead of SDLK_WORLD_69. The problem
is that in order to accomodate all possible keysym names, we either need
a lot more than 255 keysyms, or need to give the same value to several
SDLK_ constants. Besides, I’m not quite sure that different keyboard drivers
always give the “?” key the same keysym number.

The solution is probably to remove the SDLK_WORLD_XX constants (serving
no purpose), allow each driver to fill in missing entries in the keynames[]
vector, and maybe add an API call for retrieving the keysym number
corresponding to a keyname string (for the latter to be meaningful we
need to set up a list of canonic names for keys - probably those in
X11/keysymdefs.h with their prefix stripped)

Hi !> ----- Original Message -----

From: f91-men@nada.kth.se (Mattias Engdegard)
To:
Sent: Monday, June 25, 2001 2:06 PM
Subject: Re: [SDL] Non US keyboards…

As SDL is at the moment it does not work with most non US keyboard, ok
sorry, it does work fine with US keys of course, but it does not work
with

characters used in other languages like Swedish, German, French and so
on.

“does not work” is a severe exaggeration. Both key events and character
code
translation work, only SDL_GetKeyName gives misleading info. This should
be fixed in some way but it’s not crystal clear what the best solution is.

I think I am doing something wrong then, when I press the “?” (that’s a
swedish character) I get 91 in the key event, which is a ‘[’ character, and
"[" is returned by SDL_GetKeyName() (this is all with SDL 1.2.1 on
Windows2000, I have not tried it on Linux yet).

Mikael

It is clearly not acceptable for GetKeyName to return “world-69” instead
of
"?" and this can be trivially fixed (at least for x11); but it would also
be nice to have SDLK_aring defined instead of SDLK_WORLD_69. The problem
is that in order to accomodate all possible keysym names, we either need
a lot more than 255 keysyms, or need to give the same value to several
SDLK_ constants. Besides, I’m not quite sure that different keyboard
drivers
always give the “?” key the same keysym number.

The solution is probably to remove the SDLK_WORLD_XX constants (serving
no purpose), allow each driver to fill in missing entries in the
keynames[]
vector, and maybe add an API call for retrieving the keysym number
corresponding to a keyname string (for the latter to be meaningful we
need to set up a list of canonic names for keys - probably those in
X11/keysymdefs.h with their prefix stripped)

I think I am doing something wrong then, when I press the “?” (that’s a
swedish character) I get 91 in the key event, which is a ‘[’ character, and
"[" is returned by SDL_GetKeyName() (this is all with SDL 1.2.1 on
Windows2000, I have not tried it on Linux yet).

It could very well be broken on windows for all I know. I’ll see if I can
do anything about the X11 port and let others take care about the other
targets

Hi !> ----- Original Message -----

From: f91-men@nada.kth.se (Mattias Engdegard)
To:
Sent: Tuesday, June 26, 2001 12:39 PM
Subject: Re: [SDL] Non US keyboards…

I think I am doing something wrong then, when I press the “?” (that’s a
swedish character) I get 91 in the key event, which is a ‘[’ character,
and

“[” is returned by SDL_GetKeyName() (this is all with SDL 1.2.1 on
Windows2000, I have not tried it on Linux yet).

It could very well be broken on windows for all I know. I’ll see if I can
do anything about the X11 port and let others take care about the other
targets

I just tested on a RedHat 7.1 with the checkkeys test application included
with SDL and that one works just fine, so I think the problem child is (as
usual) Windows.

Mikael

Is there an easy way to make a copy of an SDL_Surface that preserves its
alpha information and such?—
John Hattan Sweet software for a saturnine world
@John_Hattan http://www.thecodezone.com

Is there an easy way to make a copy of an SDL_Surface that preserves its
alpha information and such?

SDL_ConvertSurface(surface, surface->format, surface->flags)

Of Mattias Engdeg?rd

Is there an easy way to make a copy of an SDL_Surface that preserves its
alpha information and such?

SDL_ConvertSurface(surface, surface->format, surface->flags)

I knew the answer was easier than I thought it’d be. Works like a charm!> From: owner-sdl at lokigames.com [mailto:owner-sdl at lokigames.com]On Behalf

Sent: Tuesday, June 26, 2001 10:43 AM
To: sdl at lokigames.com
Subject: Re: [SDL] How to duplicate an SDL surface


John Hattan Sweet software for a saturnine world
@John_Hattan http://www.thecodezone.com

I think I am doing something wrong then, when I press the “?” (that’s a
swedish character) I get 91 in the key event, which is a ‘[’ character, and
"[" is returned by SDL_GetKeyName() (this is all with SDL 1.2.1 on
Windows2000, I have not tried it on Linux yet).

It’s a common mistake and should go in the FAQ.

You’re expecting text input and what you’re getting is raw keysyms.
Enable UNICODE translation by using the following call:
SDL_EnableUNICODE(1);
Then look at the ‘unicode’ member of the SDL keyboard event.

Note that a unicode value for a key up event is not defined.

See ya!
-Sam Lantinga, Lead Programmer, Loki Software, Inc.

Hi !

Thanks, that did it, but as this is unicode stuff, does this work on
Windows95/98 to ? (I don’t have one to try it on)

Mikael> ----- Original Message -----

From: slouken@devolution.com (Sam Lantinga)
To:
Sent: Wednesday, June 27, 2001 12:44 AM
Subject: Re: [SDL] Non US keyboards…

I think I am doing something wrong then, when I press the “?” (that’s a
swedish character) I get 91 in the key event, which is a ‘[’ character,
and

“[” is returned by SDL_GetKeyName() (this is all with SDL 1.2.1 on
Windows2000, I have not tried it on Linux yet).

It’s a common mistake and should go in the FAQ.

You’re expecting text input and what you’re getting is raw keysyms.
Enable UNICODE translation by using the following call:
SDL_EnableUNICODE(1);
Then look at the ‘unicode’ member of the SDL keyboard event.

Note that a unicode value for a key up event is not defined.

See ya!
-Sam Lantinga, Lead Programmer, Loki Software, Inc.

It’s a common mistake and should go in the FAQ.

there’s still a (minor) problem with the keysym number (should not be
SDLK_LEFTBRACKET if the user presses “?”), and a (slightly worse) problem
with the GetKeyName() string (should not be “[”)

I don’t give it top priority but I’ll look into it when I get some time