[AD] xkeymap fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I'm about to commit the attached patch to stop xkeymap from crashing,
since KEY_MAX was increased and someone coded xkeymap so it tries to
display a NULL pointer in that case (/me looks away). Btw., is there a
reason KEY_MAX is 120, but the highest key is 118? And what is the
purpose of KEY_MODIFIERS ? If some part of the Allegro code assumes only
modifier keys are defined after it, something might go wrong with the
added OSX keys..

-- 
Elias Pschernig <elias@xxxxxxxxxx>
Index: xkeymap.c
===================================================================
RCS file: /cvsroot/alleg/allegro/tools/x11/xkeymap.c,v
retrieving revision 1.2
diff -u -r1.2 xkeymap.c
--- xkeymap.c	10 Mar 2003 08:33:56 -0000	1.2
+++ xkeymap.c	9 Oct 2003 21:18:31 -0000
@@ -147,6 +147,10 @@
    {"KEY_SCRLOCK", 0x46},
    {"KEY_NUMLOCK", 0x45},
    {"KEY_CAPSLOCK", 0x3A},
+   {"KEY_EQUALS_PAD", 0},
+   {"KEY_BACKQUOTE", 0},
+   {"KEY_SEMICOLON", 0},
+   {"KEY_COMMAND", 0},
    {NULL, 0}
 };
 
@@ -170,7 +174,10 @@
 static char *keycode_getter(int index, int *list_size)
 {
    if (index >= 0) {
-      return keymap[1 + index].string;
+      if (keymap[1 + index].string)
+        return keymap[1 + index].string;
+      else
+        return "<undef>";
    }
    else {
       *list_size = KEY_MAX - 1;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/