Re: [AD] X11/keyboard related patches for V4.0.2

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


> I made some X11/keyboard related patches for V4.0.2, and
> Elias Pschernig asked me to send it to this list, together with some
> notes.

Thanks. Btw, any particular reasons why you don't use 4.0.3 instead?

> I added missing (at least for me) numeric pad keys

As Elias said on [AL], this change is pretty non-controversial, so I commited 
it along with your modifications to the Swiss keyboard mapping file, both to 
the 4.1.x and the 4.0.x series.

> and fixed some other problems. I mostly wrote comments into the code where
> I made modification. Please ask, if more explanations are necessary.
> To the changing of MOUSE_WARP_DELAY: I'm not sure if it is good.

These changes are more questionable, so I'll need a third opinion on them, 
probably from an antipodal part of the world :-)

> @@ -2456,8 +2455,8 @@
>  /* Mappings between KeySym and Allegro scancodes.  */
>  static struct
>  {
> -   KeySym keysym;
> -   int scancode;
> +   KeySym keysym; /* from /usr/include/X11/keysymdef.h */

The path is probably correct on Linux in general, but not on Solaris for 
example.

> +   int scancode; /* from include/allegro/keyboard.h */

No, include/allegro/keyboard.h contains the Allegro keysyms. The scancodes 
are the raw PC scancodes, as returned by the PC BIOS.

>  } _xwin_keysym_to_scancode[] =
>  {
>     { XK_Escape, 0x01 },

--
Eric Botcazou
Index: src/x/xwin.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xwin.c,v
retrieving revision 1.54
diff -u -p -r1.54 xwin.c
--- src/x/xwin.c	7 Jul 2003 14:57:14 -0000	1.54
+++ src/x/xwin.c	29 Oct 2003 12:31:33 -0000
@@ -2652,6 +2652,20 @@ static struct
    { XK_KP_Insert, 0x52 },
    { XK_KP_Delete, 0x53 },
 
+   /* Some X servers return different keycodes depending
+      upon whether NumLock is turned on. */
+   { XK_KP_1, 0x4F },
+   { XK_KP_2, 0x50 },
+   { XK_KP_3, 0x51 },
+   { XK_KP_4, 0x4B },
+   { XK_KP_5, 0x4C },
+   { XK_KP_6, 0x4D },
+   { XK_KP_7, 0x47 },
+   { XK_KP_8, 0x48 },
+   { XK_KP_9, 0x49 },
+   { XK_KP_0, 0x52 },
+   { XK_KP_Decimal, 0x53 },
+
    { NoSymbol, 0 },
 };
 
Index: resource/keyboard/ch.cfg
===================================================================
RCS file: /cvsroot/alleg/allegro/resource/keyboard/ch.cfg,v
retrieving revision 1.3
diff -u -r1.3 ch.cfg
--- resource/keyboard/ch.cfg	17 Sep 2001 10:01:50 -0000	1.3
+++ resource/keyboard/ch.cfg	29 Oct 2003 12:30:44 -0000
@@ -22,7 +22,7 @@
 key70 = 36
 key26 = 121
 key74 = 45
-key90 = 0
+key90 = 46
 key71 = 60
 
 [key_capslock]
@@ -36,7 +36,7 @@
 key70 = 181
 key26 = 89
 key74 = 45
-key90 = 0
+key90 = 46
 key71 = 60
 key25 = 90
 
@@ -51,11 +51,9 @@
 key36 = 41
 key27 = 61
 key61 = 63
-key63 = 8
 key64 = 0
 key65 = 252
 key66 = 33
-key67 = 13
 key68 = 246
 key69 = 228
 key60 = 163
@@ -64,9 +62,8 @@
 key72 = 59
 key73 = 58
 key74 = 95
-key75 = 32
 key37 = 0
-key90 = 0
+key90 = 46
 key71 = 62
 key62 = 96
 key25 = 90


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