[1093] in Athena Bugs
[jim@expo.lcs.mit.edu: close 990, xmodmap now tells users which keys are pressed]
daemon@ATHENA.MIT.EDU (Henry Mensch)
Sat Oct 1 01:55:36 1988
Date: Sat, 1 Oct 88 01:55:20 EDT
From: henry@GARP.MIT.EDU (Henry Mensch)
To: bugs@ATHENA.MIT.EDU
Reply-To: henry@GARP.MIT.EDU
Date: Fri, 30 Sep 88 13:31:46 EDT
From: jim@expo.lcs.mit.edu (Jim Fulton)
To: fix-trackers@EXPO.LCS.MIT.EDU
Subject: close 990, xmodmap now tells users which keys are pressed
Cc: henry@garp.mit.edu
The following patch makes xmodmap tell the user which keys are pressed
when a MappingBusy is returned instead of just saying "please lift your
fingers".
*** /tmp/,RCSt1a00386 Fri Sep 30 13:28:40 1988
--- clients/xmodmap/exec.c Fri Sep 30 13:28:31 1988
***************
*** 1,7 ****
/*
* xmodmap - program for loading keymap definitions into server
*
! * $XConsortium: exec.c,v 1.4 88/09/06 17:33:26 jim Exp $
*
* Copyright 1988 Massachusetts Institute of Technology
* Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
--- 1,7 ----
/*
* xmodmap - program for loading keymap definitions into server
*
! * $XConsortium: exec.c,v 1.5 88/09/30 13:28:30 jim Exp $
*
* Copyright 1988 Massachusetts Institute of Technology
* Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
***************
*** 48,54 ****
--- 48,59 ----
XModifierKeymap *map;
{
int retries, timeout;
+ unsigned char keymap[32];
+ int i;
+ static unsigned int masktable[8] = {
+ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
+
for (retries = 5, timeout = 2; retries > 0; retries--, timeout <<= 1) {
int result;
***************
*** 57,64 ****
case MappingSuccess: /* Success */
return (0);
case MappingBusy: /* Busy */
! fprintf (stderr, "%s: You have %d seconds to lift your hands\n",
ProgramName, timeout);
sleep (timeout);
continue;
case MappingFailed:
--- 62,79 ----
case MappingSuccess: /* Success */
return (0);
case MappingBusy: /* Busy */
! XQueryKeymap (dpy, (char *) keymap);
! fprintf (stderr,
! "%s: please release the following keys within %d seconds:\n",
ProgramName, timeout);
+ for (i = 0; i < 256; i++) {
+ if (keymap[i >> 3] & masktable[i & 7]) {
+ KeySym ks = XKeycodeToKeysym (dpy, (KeyCode) i, 0);
+ char *cp = XKeysymToString (ks);
+ fprintf (stderr, " %s (keysym 0x%x, keycode %d)\n",
+ cp ? cp : "UNNAMED", ks, i);
+ }
+ }
sleep (timeout);
continue;
case MappingFailed: