Thread View: gnu.epoch.misc
1 messages
1 total messages
Started by Ron M. Shapiro
Wed, 24 Jul 1991 12:17
Epoch Key Mapping Utility
Author: Ron M. Shapiro
Date: Wed, 24 Jul 1991 12:17
Date: Wed, 24 Jul 1991 12:17
128 lines
3729 bytes
3729 bytes
Fellow Epochites --
For what it is worth, I wrote a small X program to interactively determine
the X keysyms mappped to the keyboard. I have tested it on an apollo X11R3
and sun4 X11R4. This should allow you to quickly determine the names to
use to remap the keyboard using 'rebind-key' and 'global-set-key' or whatever.
The source follows. Compile with cc -o xkey xkey.c or by the method
you normally use (no, there is no Makefile!).
Hope it is of some use.
-- Ron
####### cut here ########
/*
* xkey : show X key information
*
* Written by Ron Shapiro rms@apollo.srl.ford.com
*
* Permission to use, copy, modify and distribute (without charge) this
* software, documentation, images, etc. is granted, provided that this
* comment and the author's name is retained.
*
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <stdio.h>
#define TRUE 1
#define FALSE 0
Display *display;
int screen_num;
static char *progname;
void main(int argc, char **argv)
{
Window win;
unsigned int width, height;
int x, y;
unsigned int border_width = 4;
unsigned int display_width, display_height;
unsigned int icon_width, icon_height;
char *window_name = "xkey";
char *icon_name = "xkey";
Pixmap icon_pixmap;
XSizeHints size_hints;
XIconSize *size_list;
int count;
XEvent report;
GC gc;
XFontStruct *font_info;
char *display_name = NULL;
int window_size = 0;
XEvent event;
char buffer[10];
int bufsize = 10;
XComposeStatus compose;
KeySym key;
XWMHints xwmh;
xwmh.flags = InputHint|StateHint;
xwmh.input = 1;
xwmh.initial_state = NormalState;
progname = argv[0];
if ( (display = XOpenDisplay(display_name)) == NULL )
{
fprintf(stderr, "%s: cannot connect to X server %s\n",
progname,XDisplayName(display_name));
exit(-1);
}
screen_num = DefaultScreen(display);
x = y = 0;
width = 100;
height = 50;
win = XCreateSimpleWindow(display, RootWindow(display,screen_num),
x, y, width, height, border_width,
BlackPixel(display,screen_num),
WhitePixel(display,screen_num));
size_hints.flags = PPosition | PSize | PMinSize;
size_hints.x = x;
size_hints.y = y;
size_hints.width = width;
size_hints.height = height;
size_hints.min_width = 100;
size_hints.min_height = 50;
XSetStandardProperties(display,win,window_name,icon_name,icon_pixmap, argv,
argc, &size_hints);
XSelectInput(display,win,KeyPressMask);
XSetWMHints(display,win,&xwmh);
XMapWindow(display,win);
fprintf(stderr,"Place pointer in window and type.\n");
while (TRUE)
{
*buffer = NULL;
XNextEvent(display,&report);
switch (report.type)
{
case KeyPress:
XLookupString(&report,buffer,bufsize,&key,&compose);
fprintf(stderr,
"The keycode = %d The keysym = %d The buffer = \"%s\"\n"
,report.keycode,key,buffer);
fprintf(stderr,"The X string for the key is \"%s\"\n",
XKeysymToString(key));
break;
default:
break;
}
}
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads