[SDL] Portable keycodes?

Sylvain Beucler beuc at beuc.net
Sun Aug 19 07:42:50 PDT 2007


Hi,

Not everybody has a 3D card but we still want hardware acceleration
when available. Same here :)


On Sun, Aug 19, 2007 at 08:59:46PM +0900, Alissa Sabre wrote:
> > My question is: is there a way to get consistent keycodes across
> > platforms with SDL?
> 
> I don't think you can get the keycode with the feature you want.
> 
> SDL is cross-platform oriented.  There are a lot of platforms that has
> no PC-compatible 101/102 keyboard.  Some device may have just 3 x 5
> keypads.  There are no such thing as
> 
> > the 0-9 digits
> > (those in the top line of the keyboard)
> 
> > I think the DirectX keycodes or the xev "keycode" field (see below)
> > are a good thing: they do not rely on the current keyboard mapping,
> > they always refer to the same physical location on the keyboard (from
> 
> This is because Windows only supports those keyboards that obey
> Microsoft-defined requirements.  Yes, Bill wants to force everybody on
> this plant to use a keyboard that is physically similar to his
> favorite, that is US 101.  His OS has no problem assuming everyone has
> Gates-compatible keyboard.
> 
> > The main problem is that under X11, SDL_sim returns essentially the
> > same thing than the SDL unicode field.
> 
> On the other hand, X11 is intentionally designed to be capable of all
> _strange_ keyboards.  As a result, you can't identify physical key
> positions in a portable manner.  You need to rely on the user's
> keymap under X11
> 
> Of course, you can get the physical location based keycode in X11, if
> you give up the cross-platform portability and limit your application
> to run on Xorg based X11 implementation and PC 101 compatible
> keyboards only.
> 
> I don't think it is the way SDL is to go.


More information about the SDL mailing list