Fix missing OS-X keymapping for letter 'A'

The keymap-gen.pl script was not correctly distinguishing
keycodes with a value of '0', from undefined keycodes. All
were skipped. This meant that the mapping for OS-X ANSI_A
key was lost (since it has value 0).

For similar reasons the XQuartz mapping for the letter A
was also lost.

* src/keymap-gen.pl: Fix handling of 0 vs undef for keycodes
* src/keymaps.csv: Remove bogus 0x0 entry in OS-X keymap
This commit is contained in:
Daniel P. Berrange 2011-04-14 15:12:34 +01:00 committed by Christophe Fergeau
parent 1bb8c375a9
commit 066fa96e0f
2 changed files with 18 additions and 10 deletions

View File

@ -116,7 +116,7 @@ while ($row = $csv->getline(\*CSV)) {
my $col = $mapcolumns{$name};
my $val = $row->[$col];
$val = 0 unless $val;
next unless defined $val && $val ne "";
$val = hex($val) if $val =~ /0x/;
$to = $maps{$name}->[0];
@ -131,8 +131,10 @@ while ($row = $csv->getline(\*CSV)) {
# for values <= 83, and completely made up for extended
# scancodes :-(
($to, $from) = @{$maps{xorgkbd}};
$to->[$linux] = $maps{xkbdxt}->[0]->[$linux] + 8;
$from->[$to->[$linux]] = $linux;
if (defined $maps{xkbdxt}->[0]->[$linux]) {
$to->[$linux] = $maps{xkbdxt}->[0]->[$linux] + 8;
$from->[$to->[$linux]] = $linux;
}
# Xorg evdev is simply Linux keycodes offset by +8
($to, $from) = @{$maps{xorgevdev}};
@ -141,8 +143,10 @@ while ($row = $csv->getline(\*CSV)) {
# Xorg XQuartz is simply OS-X keycodes offset by +8
($to, $from) = @{$maps{xorgxquartz}};
$to->[$linux] = $maps{osx}->[0]->[$linux] + 8;
$from->[$to->[$linux]] = $linux;
if (defined $maps{osx}->[0]->[$linux]) {
$to->[$linux] = $maps{osx}->[0]->[$linux] + 8;
$from->[$to->[$linux]] = $linux;
}
# RFB keycodes are XT kbd keycodes with a slightly
# different encoding of 0xe0 scan codes. RFB uses
@ -150,16 +154,20 @@ while ($row = $csv->getline(\*CSV)) {
# bit of the second byte.
($to, $from) = @{$maps{rfb}};
my $xtkbd = $maps{xtkbd}->[0]->[$linux];
$to->[$linux] = $xtkbd ? (($xtkbd & 0x100)>>1) | ($xtkbd & 0x7f) : 0;
$from->[$to->[$linux]] = $linux;
if (defined $xtkbd) {
$to->[$linux] = $xtkbd ? (($xtkbd & 0x100)>>1) | ($xtkbd & 0x7f) : 0;
$from->[$to->[$linux]] = $linux;
}
# Xorg Cygwin is the Xorg Cygwin XT codes offset by +8
# The Cygwin XT codes are the same as normal XT codes
# for values <= 83, and completely made up for extended
# scancodes :-(
($to, $from) = @{$maps{xorgxwin}};
$to->[$linux] = $maps{xwinxt}->[0]->[$linux] + 8;
$from->[$to->[$linux]] = $linux;
if (defined $maps{xwinxt}->[0]->[$linux]) {
$to->[$linux] = $maps{xwinxt}->[0]->[$linux] + 8;
$from->[$to->[$linux]] = $linux;
}
# print $linux, "\n";
}

View File

@ -1,5 +1,5 @@
"Linux Name","Linux Keycode","OS-X Name","OS-X Keycode","AT set1 keycode","AT set2 keycode","AT set3 keycode",XT,"XT KBD","USB Keycodes","Win32 Name","Win32 Keycode","Xwin XT","Xfree86 KBD XT"
KEY_RESERVED,0,,0x0,,,,,,,,,,
KEY_RESERVED,0,,,,,,,,,,,,
KEY_ESC,1,Escape,0x35,1,118,8,1,1,41,VK_ESCAPE,0x1b,1,1
KEY_1,2,ANSI_1,0x12,2,22,22,2,2,30,VK_1,0x31,2,2
KEY_2,3,ANSI_2,0x13,3,30,30,3,3,31,VK_2,0x32,3,3

1 Linux Name Linux Keycode OS-X Name OS-X Keycode AT set1 keycode AT set2 keycode AT set3 keycode XT XT KBD USB Keycodes Win32 Name Win32 Keycode Xwin XT Xfree86 KBD XT
2 KEY_RESERVED 0 0x0
3 KEY_ESC 1 Escape 0x35 1 118 8 1 1 41 VK_ESCAPE 0x1b 1 1
4 KEY_1 2 ANSI_1 0x12 2 22 22 2 2 30 VK_1 0x31 2 2
5 KEY_2 3 ANSI_2 0x13 3 30 30 3 3 31 VK_2 0x32 3 3