[SDL] Problems with keymapping on AZERTY keyboards on Mac OS X

Christophe Cavalaria chris.cavalaria at free.fr
Wed Jun 27 11:28:47 PDT 2007


Max Horn wrote:

> Hi folks,
> 
> some of our Mac OS X users are having problems with ScummVM <http://
> www.scummvm.org> running on a machine with an AZERTY keyboard, a
> layout that is standard in many french-speaking countries (France and
> Belgium for example). The tricky thing about that keyboard layout is
> that in it the "number row" differs considerably from that on a
> QWERTY keyboard.In particular, the key which "normally" is labeled
> "1" instead is labeled "&", and to get a "1" you have to press "Shift-
> &", i.e. the opposite of a what happens in "normal" keyboard layouts.
> To see what I mean, see here: <<http://en.wikipedia.org/wiki/AZERTY>.
> 
> Now, we offer our users certain hotkeys, among them are the Ctrl-
> NUMBER and Alt-NUMBER hotkeys (for quick saving/loading). No issue,
> you might say now -- just use the keysym and be done with it, it
> should return "1" for that key on AZERTY, too.
> 
> However, this is not the case on Mac OS X, due to some "clever" code
> which tries to correct the default hard-coded keymap to accommodate
> for non-US keyboards. The idea for adding that code back then (I was
> involved in that) was to compensate for changed letter key positions
> on non-QWERTY keyboards. For example I am using a QWERTZ keyboard
> where y and z are swapped. That code in the Mac OS X variant of SDL
> makes sure the keysyms for these two keys are swapped, too.
> 
> Why doing so? Because the purpose of keysyms is not completely well-
> defined in SDL (and I think Sam is aware of that and maybe 1.3 will
> improve in that regard). There are two different roles it tries to
> support: One is to represent the symbol that is printed on the key
> (which is what the OS X port currently tries to do). The other is to
> represent the "position" of the key (so you don't care whether the
> key between "t" and "u" is labeled "y" or "z", you  you always want
> SDLK_y, meaning "the key between t and u").

In my opinion, that would be ugly and would make it very hard for developers
using non Qwerty keyboards.

> 3) Call SDL's behavior "correct" and somehow fix the problem inside
> of ScummVM. Maybe by allowing the user to define a custom remapping,
> defining "quicksave to slot 1" as "Alt-&"

I'd say this is the correct solution. This is how UT 2004 handles it for the
quick chat menu (on windows at least, on Unix systems it fails miserably to
the point you HAVE to configure your keyboard layout in Qwerty to even have
a chance of using it correctly). Most commercial games allow you to
redefine the keyboard layout, and also chose the default values depending
on the installed language.





More information about the SDL mailing list