/* * Xkmap.c: X key mapping * This code is junk! But it might be helpful. * C Durland Public Domain */ #include "me2.h" #include "term.h" #include #include #include #define XK_MISCELLANY #include /* Note: do *NOT* return a keycode with CTRL set. * Use the ASCII value key codes from terminal */ static struct { uint16 scancode; KeyCode keycode; } key_map[] = { XK_BackSpace, 0x8, XK_Tab, 0x9, XK_Clear, SOFKEY|'G', XK_Linefeed, 0xA, XK_Return, 0xD, XK_Escape, 0x1B, XK_Delete, 0x7F, XK_Home, SOFKEY|'A', XK_Left, SOFKEY|'F', /* Move left, left arrow */ XK_Up, SOFKEY|'C', /* Move up, up arrow */ XK_Right, SOFKEY|'E', /* Move right, right arrow */ XK_Down, SOFKEY|'D', /* Move down, down arrow */ XK_Prior, SOFKEY|'I', /* Prior, previous <> */ XK_Next, SOFKEY|'J', /* Next <> */ XK_End, SOFKEY|'B', /* EOL */ XK_Begin, SOFKEY|'A', /* BOL */ XK_Select, '\0', /* Select, mark */ XK_Insert, SOFKEY|'G', /* Insert, insert here */ XK_Cancel, 0x7, /* Cancel, stop, abort, exit */ XK_ClearLine, SOFKEY|'K', XK_InsertLine, SOFKEY|'M', XK_DeleteLine, SOFKEY|'L', XK_InsertChar, SOFKEY|'G', XK_DeleteChar, SOFKEY|'H', XK_BackTab, META|'I', /* Keypad Functions, keypad numbers cleverly chosen to map to ascii */ XK_KP_Space, ' ', /* space */ XK_KP_Tab, 0x9, XK_KP_Enter, 0xD, /* enter */ XK_KP_Equal, '=', /* equals */ XK_KP_Multiply, '*', XK_KP_Add, '+', XK_KP_Separator, ',', /* separator, often comma */ XK_KP_Subtract, '-', XK_KP_Decimal, '.', XK_KP_Divide, '/', XK_KP_0, '0', XK_KP_1, '1', XK_KP_2, '2', XK_KP_3, '3', XK_KP_4, '4', XK_KP_5, '5', XK_KP_6, '6', XK_KP_7, '7', XK_KP_8, '8', XK_KP_9, '9', XK_F1, SOFKEY|'1', XK_F2, SOFKEY|'2', XK_F3, SOFKEY|'3', XK_F4, SOFKEY|'4', XK_F5, SOFKEY|'5', XK_F6, SOFKEY|'6', XK_F7, SOFKEY|'7', XK_F8, SOFKEY|'8', XK_F9, SOFKEY|'9', XK_F10, SOFKEY|'0', }; /* convert terminal codes to ME codes. */ map_key(state,scancode,keycode) register unsigned int state; register KeySym scancode; KeyCode *keycode; { register KeyCode kc = 0; register int j, found = FALSE; if (scancode & 0xFF00) /* non ASCII */ { for (j=0; j