XFree86 3.3.5/Metrolink Motif 2.1.2 patch for Amaya 2.2

Amaya 2.2's keyboard functions are not working at all with XFree86 3.3.5
or Metrolink/Red Hat Motif 2.1.2.  None of the edit boxes (XmKey, I think)
are processing any keyboard input.

Here's what's happening.  Either XFree86, or this particular Motif
library, I'm not sure which one is the culprit, is setting some bits in
XKeyEvent->state to garbage.  The manual page for XKeyEvent(3X11) states
the following:

       The state member is set to indicate the logical state of
       the pointer buttons and modifier keys just prior to the
       event, which is the bitwise inclusive OR of one or more of
       the button or modifier key masks: Button1Mask,
       Button2Mask, Button3Mask, Button4Mask, Button5Mask,
       ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask,
       Mod3Mask, Mod4Mask, and Mod5Mask.

There are some additional bits in the state field which are used for other
kinds of events, and what's happening is that those other bits are not
being cleared.  Subsequent to that, TtaXLookupString() gets hopelessly
confused.

The following patch fixes this problem, at least on English keyboards.
Actually, it's only the line #543 that needs to be added.  The remaining
diffs get rid of some egcs 1.1.2 warning messages.

--
Sam



--- thotlib/dialogue/interface.c.orig	Tue Oct 19 06:50:48 1999
+++ thotlib/dialogue/interface.c	Tue Nov  2 23:06:07 1999
@@ -491,7 +491,7 @@
    {0, 0, 0},
 };
 
-#define NB_MK (sizeof(mk_tab) / sizeof(Multi_Key))
+#define NB_MK (int)((sizeof(mk_tab) / sizeof(Multi_Key)))
 
 #ifndef _WINDOWS
 static Display     *TtaDisplay = NULL;
@@ -531,7 +531,7 @@
 
   if (event == NULL)
     return (0);
-  if (event->keycode < TtaMinKeyCode || event->keycode > TtaMaxKeyCode)
+  if ((int)event->keycode < TtaMinKeyCode || (int)event->keycode > TtaMaxKeyCode)
     {
       if (keysym != NULL)
 	*keysym = 0;
@@ -540,6 +540,8 @@
 
   keycode = event->keycode - TtaMinKeyCode;
   state = event->state;
+  state= state & (ShiftMask | LockMask | Mod1Mask | Mod3Mask);
+
   /* search for the keysym depending on the state flags */
   if (state == 0)
     {

Received on Wednesday, 3 November 1999 04:22:55 UTC