Hi,
Since switching to Fedora Core 3 from Red Hat 7.3, shifted versions of
the function keys and some keypad keys are no longer distinguished
from their non-shifted counterparts.
For example, pressing the keypad "multiply" key returns the XEmacs key
"kp-multiply" whether or not I have the shift key down.
The problem is in this code in xemacs/src/event-Xt.c:
| /* If this key contains two distinct keysyms, that is,
| "shift" generates a different keysym than the
| non-shifted key, then don't apply the shift modifier
| bit: it's implicit. Otherwise, if there would be no
| other way to tell the difference between the shifted
| and unshifted version of this key, apply the shift bit.
| Non-graphics, like Backspace and F1 get the shift bit
| in the modifiers slot. Neither the characters "a",
| "A", "2", nor "@" normally have the shift bit set.
| However, "F1" normally does. */
| if (modifiers & XEMACS_MOD_SHIFT)
| {
| int Mode_switch_p = *state & xd->ModeMask;
| KeySym bot = XLookupKeysym (ev, Mode_switch_p ? 2 : 0);
| KeySym top = XLookupKeysym (ev, Mode_switch_p ? 3 : 1);
| if (top && bot && top != bot)
| modifiers &= ~XEMACS_MOD_SHIFT;
| }
which appears to be the same in all recent 21.4 and 21.5 series; I've
mostly been using 21.4.14. This code is incorrectly clearing the
shift modifier bit from these keys.
The problem is that while on RH7.3 there is only one keysym defined
for the keycode for each of these keys:
| % xmodmap -pk | grep -i kp_multiply
| 63 0xffaa (KP_Multiply)
on FC3, there are two:
| % xmodmap -pk | grep -i kp_multiply
| 63 0xffaa (KP_Multiply) 0x1008fe21 (XF86_ClearGrab)
I'm using the xorg-x11-6.8.2-1.FC3.45.2 package.
The keycode to keysym bindings seem to be coming from here:
| % find /usr/X11R6/lib/X11 -type f | xargs grep -i XF86_ClearGrab
| /usr/X11R6/lib/X11/xkb/compat/xfree86: interpret XF86_ClearGrab {
| /usr/X11R6/lib/X11/xkb/symbols/srvr_ctrl: symbols[Group1]= [ KP_Multiply, XF86_ClearGrab ]
| /usr/X11R6/lib/X11/xkb/symbols/pc/pc: symbols[Group1]= [ KP_Multiply, XF86_ClearGrab ]
| /usr/X11R6/lib/X11/XKeysymDB:XF86_ClearGrab :1008FE21
What I really don't understand is that the call to XLookupString in
x_to_emacs_keysym() is returning the unshifted keysym for these keys
even when shifted, while for "a", "2", etc it is returning the second
keysym when shifted, i.e. "A", "@", respectively. I would have
expected to get "xf86-cleargrab" when shifting the "kp-multiply" key.
Looking at /usr/X11R6/lib/X11/xkb/symbols/pc/pc:
| key <KPMU> {
| type="CTRL+ALT",
| symbols[Group1]= [ KP_Multiply, XF86_ClearGrab ]
| };
it appears that the XF86_ClearGrab keysym is being added to the keypad
multiply key for modifiers "CTRL+ALT", so maybe the INDEX argument
needed to XLookupKeysym to get the shifted version must now be
computed in a different way than the XEmacs code is doing?
Or XLookupKeysym is just broken, and we need to instead call
XLookupString once on the event we received, and again on a copy of
that event with the shift bit cleared, and compare those keysyms. I
can try that over the weekend (the FC3 box is at home).
I can work around the problem by xmodmap'ing away the second keysyms
for the problematic keycodes.
However, it would be nice to solve the problem in XEmacs. I didn't
look at their code, but FSFMacs is not exhibiting this problem.
I'm not on this list, so please keep me copied on any replies.
thanks,
Greg