GNU bug report logs -
#74423
Low level key events
Previous Next
Full log
Message #23 received at 74423 <at> debbugs.gnu.org (full text, mbox):
On 19/11/2024 0:49, Po Lu wrote:
> You are computing the modifier event to be generated incorrectly. You
> should search the modifier map (dpyinfo->modmap) for columns containing
> received keysyms, and compare modifier bits derived from the rows where
> they appear against meta_mod_mask, shift_lock_mask, alt_mod_mask,
> super_mod_mask, and hyper_mod_mask in the display structure, or CtrlMask
> and ShiftMask.
Thanks for the guidance. Does this look ok?
Lisp_Object
x_get_modifier_for_keycode (struct x_display_info *dpyinfo,
int keycode)
{
#ifdef HAVE_XKB
if (dpyinfo->xkb_desc)
for (int mod = 0; mod < XkbNumModifiers; mod++)
{
int mask = (1 << mod);
if (dpyinfo->xkb_desc->map->modmap[keycode] & mask)
{
if (mask == ShiftMask)
return Qshift;
if (mask == ControlMask)
return Qctrl;
if (mask == dpyinfo->meta_mod_mask)
return Qmeta;
if (mask == dpyinfo->alt_mod_mask)
return Qalt;
if (mask == dpyinfo->super_mod_mask)
return Qsuper;
if (mask == dpyinfo->hyper_mod_mask)
return Qhyper;
}
}
#endif
XModifierKeymap *map = dpyinfo->modmap;
if (map)
for (int mod = 0; mod < 8; mod++)
{
int mask = (1 << mod);
for (int key = 0; key < map->max_keypermod; key++)
if (map->modifiermap[mod * map->max_keypermod + key] == keycode)
{
if (mask == ShiftMask)
return Qshift;
if (mask == ControlMask)
return Qctrl;
if (mask == dpyinfo->meta_mod_mask)
return Qmeta;
if (mask == dpyinfo->alt_mod_mask)
return Qalt;
if (mask == dpyinfo->super_mod_mask)
return Qsuper;
if (mask == dpyinfo->hyper_mod_mask)
return Qhyper;
}
}
return Qnil;
}
This bug report was last modified 46 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.