? libke.c.patch
Index: libke.c
===================================================================
RCS file: /cvs/gnome/gnopernicus/kbd_mouse/libke/libke.c,v
retrieving revision 1.53
diff -u -r1.53 libke.c
--- libke.c	22 Aug 2003 12:10:52 -0000	1.53
+++ libke.c	27 Aug 2003 11:58:12 -0000
@@ -1469,32 +1469,54 @@
  *
  * return: keycode array.
 **/
-static short*
-ke_get_keypad_keycodes (void)
+long numpad_keysym[COUNT_OF_ITEM_IN_LAYER_KEYSET] = { 
+    XK_KP_0,
+    XK_KP_1,
+    XK_KP_2,
+    XK_KP_3,
+    XK_KP_4,
+    XK_KP_5,
+    XK_KP_6,
+    XK_KP_7,
+    XK_KP_8,
+    XK_KP_9,
+    XK_KP_Decimal,
+    XK_KP_Enter,
+    XK_KP_Add,
+    XK_KP_Subtract,
+    XK_KP_Multiply,
+    XK_KP_Divide
+};
+
+static gchar*
+ke_get_keypad_keysyms (void)
 {
-    Display *display;
-    short *keycodes = (short *) g_new0 (short *, COUNT_OF_ITEM_IN_LAYER_KEYSET);	
+    gchar *rv = NULL;
+    gint i;
 
-    display = GDK_DISPLAY ();
+    for (i = 0 ; i < G_N_ELEMENTS(numpad_keysym) ; i++)
+    {
+        if (g_unichar_validate ((guint32)numpad_keysym[i]))
+        {
+	    gchar *keysym = NULL;
+    	    gchar *tmp = NULL;
+	
+    	    keysym = (gchar *) g_new0 (gchar *, 8);
+	
+	    g_unichar_to_utf8 ((guint32)numpad_keysym[i], keysym);
+	
+	    if (rv)
+		tmp = g_strconcat (rv, keysym, NULL);
+	    else
+		tmp = g_strdup (keysym);
+		
+	    g_free (keysym);
+	    g_free (rv);
+	    rv = tmp;
+        }
+    }
     
-    keycodes [0] = XKeysymToKeycode (display, XK_KP_0);
-    keycodes [1] = XKeysymToKeycode (display, XK_KP_1);
-    keycodes [2] = XKeysymToKeycode (display, XK_KP_2);
-    keycodes [3] = XKeysymToKeycode (display, XK_KP_3);
-    keycodes [4] = XKeysymToKeycode (display, XK_KP_4);
-    keycodes [5] = XKeysymToKeycode (display, XK_KP_5);
-    keycodes [6] = XKeysymToKeycode (display, XK_KP_6);
-    keycodes [7] = XKeysymToKeycode (display, XK_KP_7);
-    keycodes [8] = XKeysymToKeycode (display, XK_KP_8);
-    keycodes [9] = XKeysymToKeycode (display, XK_KP_9);
-    keycodes [10] = XKeysymToKeycode (display, XK_KP_Decimal);
-    keycodes [11] = XKeysymToKeycode (display, XK_KP_Enter);
-    keycodes [12] = XKeysymToKeycode (display, XK_KP_Add);
-    keycodes [13] = XKeysymToKeycode (display, XK_KP_Subtract);
-    keycodes [14] = XKeysymToKeycode (display, XK_KP_Multiply);
-    keycodes [15] = XKeysymToKeycode (display, XK_KP_Divide);
-    	
-    return keycodes;
+    return rv;
 }
 
 /**
@@ -1646,7 +1668,7 @@
 gboolean
 ke_init (KeyboardEchoCB kecb)
 {
-    short  *ke_layer_keycodes = NULL;
+    gchar  *ke_layer_keysyms = NULL;
     gchar  *ke_keyecho_keysyms = NULL;
   
     sru_return_val_if_fail (ke_keyboard_status == KE_IDLE, FALSE);
@@ -1680,9 +1702,9 @@
     /*
 	Layer commands.
     */
-    ke_layer_keycodes = ke_get_keypad_keycodes ();
-    ke_layer_keyset   = SPI_createAccessibleKeySet (COUNT_OF_ITEM_IN_LAYER_KEYSET, NULL, ke_layer_keycodes, NULL);
-    g_free (ke_layer_keycodes);
+    ke_layer_keysyms  = ke_get_keypad_keysyms ();
+    ke_layer_keyset   = SPI_createAccessibleKeySet (COUNT_OF_ITEM_IN_LAYER_KEYSET, ke_layer_keysyms, NULL, NULL);
+    g_free (ke_layer_keysyms);
 
     /*
 	Keyboard echo.
