jtkohl@ATHENA.MIT.EDU (John T Kohl) (09/30/87)
These patches use routines in Xlib (but not documented) to manipulate the modifier mappings. This has the side-effect of allowing the user to increase the maximum number of modifier keys on a given modifier function. *** /tmp/,RCSt1006192 Tue Sep 29 16:59:31 1987 --- xmodmap.c Tue Sep 29 16:59:08 1987 *************** *** 26,32 **** ********************************************************/ ! /* $Header: xmodmap.c,v 1.4 87/09/13 22:03:20 jtkohl Locked $ */ #include <stdio.h> #include <ctype.h> #include "X11/Xlib.h" --- 26,32 ---- ********************************************************/ ! /* $Header: xmodmap.c,v 1.4 87/09/13 22:03:20 toddb Exp $ */ #include <stdio.h> #include <ctype.h> #include "X11/Xlib.h" *************** *** 91,97 **** SetMod(argc, argv, map, mod) int argc; char **argv; ! XModifierKeymap *map; int mod; { if (argc) { --- 91,97 ---- SetMod(argc, argv, map, mod) int argc; char **argv; ! XModifierKeymap **map; int mod; { if (argc) { *************** *** 107,141 **** keycode = XKeysymToKeycode(dpy, ks); } fprintf(stderr, "%s: 0x%x\n", *argv, keycode); ! if (keycode) { ! int i; ! ! for (i = 0; i < map->max_keypermod; i++) { ! int index = mod*map->max_keypermod + i; ! if (map->modifiermap[index] == 0) { ! map->modifiermap[index] = (unsigned char) keycode; ! return (1); ! } ! } ! } } return (0); } ClearMod(map, mod) ! XModifierKeymap *map; int mod; { int i; ! for (i = 0; i < map->max_keypermod; i++) ! map->modifiermap[mod * map->max_keypermod + i] = '\0'; } DecodeArgs(argc, argv, map) int argc; char **argv; ! XModifierKeymap *map; { while (--argc > 0) { argv++; --- 107,132 ---- keycode = XKeysymToKeycode(dpy, ks); } fprintf(stderr, "%s: 0x%x\n", *argv, keycode); ! if (keycode) ! *map = XInsertModifiermapEntry(*map, keycode, mod); } return (0); } ClearMod(map, mod) ! register XModifierKeymap **map; int mod; { int i; ! for (i = 0; i < (*map)->max_keypermod; i++) ! (*map)->modifiermap[mod * (*map)->max_keypermod + i] = '\0'; } DecodeArgs(argc, argv, map) int argc; char **argv; ! XModifierKeymap **map; { while (--argc > 0) { argv++; *************** *** 225,230 **** --- 216,222 ---- { int i, k = 0; + fprintf(fout, "Currently max %d keys/mod\n", map->max_keypermod); for (i = 0; i < 8; i++) { int j; *************** *** 256,262 **** map = XGetModifierMapping(dpy); ! DecodeArgs(argc, argv, map); if (fout) PrintModifierMapping(map, fout); --- 248,254 ---- map = XGetModifierMapping(dpy); ! DecodeArgs(argc, argv, &map); if (fout) PrintModifierMapping(map, fout);