|
|
1.1 root 1: /************************************************************
2: Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
3:
4: All Rights Reserved
5:
6: Permission to use, copy, modify, and distribute this
7: software and its documentation for any purpose and without
8: fee is hereby granted, provided that the above copyright no-
9: tice appear in all copies and that both that copyright no-
10: tice and this permission notice appear in supporting docu-
11: mentation, and that the names of Sun or MIT not be used in
12: advertising or publicity pertaining to distribution of the
13: software without specific prior written permission. Sun and
14: M.I.T. make no representations about the suitability of this
15: software for any purpose. It is provided "as is" without any
16: express or implied warranty.
17:
18: SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19: INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
20: NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
21: ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
22: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
23: PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24: OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
25: THE USE OR PERFORMANCE OF THIS SOFTWARE.
26:
27: ********************************************************/
28:
29: /* $Header: xprkbd.c,v 1.2 87/09/10 18:53:29 sun Exp $ */
30: #include <stdio.h>
31: #include "X11/Xlib.h"
32: #include "X11/Xutil.h"
33: #include "X11/Xatom.h"
34:
35:
36: Display *dpy;
37: int scr;
38:
39: StartConnectionToServer(argc, argv)
40: int argc;
41: char *argv[];
42: {
43: char *display;
44: int i;
45:
46: display = NULL;
47: for(i = 1; i < argc; i++)
48: {
49: if(index(argv[i], ':') != NULL)
50: display = argv[i];
51: }
52: if (!(dpy = XOpenDisplay(display)))
53: {
54: perror("Cannot open display\n");
55: exit(0);
56: }
57: }
58:
59:
60: PrintKeyboardMapping()
61: {
62: int i;
63:
64: for (i = dpy->min_keycode; i <= dpy->max_keycode; i++) {
65: int j;
66: /* Next line merely to ensure fields in dpy initialized */
67: KeySym junk = XKeycodeToKeysym(dpy, dpy->min_keycode, 0);
68:
69: printf("0x%x\t", i);
70: for (j = 0; j < dpy->keysyms_per_keycode; j++) {
71: KeySym ks = XKeycodeToKeysym(dpy, i, j);
72:
73: if (ks != NoSymbol)
74: printf("0x%x\t%s\t", ks, XKeysymToString(ks));
75: }
76: printf("\n");
77: }
78: }
79:
80: main(argc, argv)
81: int argc;
82: char **argv;
83: {
84: StartConnectionToServer(argc, argv);
85:
86: PrintKeyboardMapping();
87: }
88:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.