[gtk-vnc] Fix missing OS-X keymapping for letter 'A'



commit 379294ff981fc81fc80923bb6b8218e45f92f840
Author: Daniel P. Berrange <berrange redhat com>
Date:   Thu Apr 14 15:12:34 2011 +0100

    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

 src/keymap-gen.pl |   26 +++++++++++++++++---------
 src/keymaps.csv   |    2 +-
 2 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/keymap-gen.pl b/src/keymap-gen.pl
index fd96bdf..3582e2b 100644
--- a/src/keymap-gen.pl
+++ b/src/keymap-gen.pl
@@ -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";
 }
diff --git a/src/keymaps.csv b/src/keymaps.csv
index e18f794..59e3bba 100644
--- a/src/keymaps.csv
+++ b/src/keymaps.csv
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]