summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-12-04 22:03:56 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-12-04 22:03:56 +0000
commiteb9faf624f11691c4ca7344f4169117718cea9c7 (patch)
tree384fe6a6a84d6a456f27458e0040deee4eb8f69d /exec.c
parentd678c60d8b5bede9e61f532aa1740d741b8bbe90 (diff)
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/exec.c b/exec.c
index d23bf49..2741dc4 100644
--- a/exec.c
+++ b/exec.c
@@ -56,7 +56,7 @@ from The Open Group.
* Author: Jim Fulton, MIT X Consortium; derived from parts of the
* original xmodmap, written by David Rosenthal, of Sun Microsystems.
*/
-/* $XFree86: xc/programs/xmodmap/exec.c,v 1.5 2001/12/14 20:02:13 dawes Exp $ */
+/* $XFree86: xc/programs/xmodmap/exec.c,v 1.6 2003/12/02 13:13:57 pascal Exp $ */
#include <X11/Xos.h>
#include <X11/Xlib.h>
@@ -212,8 +212,13 @@ void
PrintModifierMapping(XModifierKeymap *map, FILE *fp)
{
int i, k = 0;
+ int min_keycode, max_keycode, keysyms_per_keycode = 0;
- fprintf (fp,
+ XDisplayKeycodes (dpy, &min_keycode, &max_keycode);
+ XGetKeyboardMapping (dpy, min_keycode, (max_keycode - min_keycode + 1),
+ &keysyms_per_keycode);
+
+ fprintf (fp,
"%s: up to %d keys per modifier, (keycodes in parentheses):\n\n",
ProgramName, map->max_keypermod);
for (i = 0; i < 8; i++) {
@@ -222,8 +227,14 @@ PrintModifierMapping(XModifierKeymap *map, FILE *fp)
fprintf(fp, "%-10s", modifier_table[i].name);
for (j = 0; j < map->max_keypermod; j++) {
if (map->modifiermap[k]) {
- KeySym ks = XKeycodeToKeysym(dpy, map->modifiermap[k], 0);
- char *nm = XKeysymToString(ks);
+ KeySym ks;
+ int index = 0;
+ char *nm;
+ do {
+ ks = XKeycodeToKeysym(dpy, map->modifiermap[k], index);
+ index++;
+ } while ( !ks && index < keysyms_per_keycode);
+ nm = XKeysymToString(ks);
fprintf (fp, "%s %s (0x%0x)", (j > 0 ? "," : ""),
(nm ? nm : "BadKey"), map->modifiermap[k]);