You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2434 lines
85 KiB

/*
* Copyright (C) 1997-2002, Michael Jennings
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
static const char cvs_ident[] = "$Id$";
#include "config.h"
#include "feature.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>
#ifdef HAVE_X11_SUNKEYSYM_H
# include <X11/Sunkeysym.h>
#endif
#include "actions.h"
#include "buttons.h"
#include "command.h"
#include "e.h"
#include "events.h"
#include "font.h"
#include "misc.h"
#include "startup.h"
#include "options.h"
#include "pixmap.h"
#include "screen.h"
#include "scrollbar.h"
#include "term.h"
#include "windows.h"
#ifdef ESCREEN
# include "screamcfg.h"
#endif
#ifdef META8_OPTION
unsigned char meta_char = 033; /* Alt-key prefix */
#endif
unsigned long PrivateModes = PrivMode_Default;
unsigned long SavedModes = PrivMode_Default;
char *def_colorName[] = {
"rgb:aa/aa/aa", "rgb:0/0/0", /* fg/bg */
"rgb:0/0/0", /* 0: black (#000000) */
#ifndef NO_BRIGHTCOLOR
/* low-intensity colors */
"rgb:cc/00/00", /* 1: red */
"rgb:00/cc/00", /* 2: green */
"rgb:cc/cc/00", /* 3: yellow */
"rgb:00/00/cc", /* 4: blue */
"rgb:cc/00/cc", /* 5: magenta */
"rgb:00/cc/cc", /* 6: cyan */
"rgb:aa/aa/aa", /* 7: white */
/* high-intensity colors */
"rgb:33/33/33", /* 8: bright black */
#endif /* NO_BRIGHTCOLOR */
"rgb:ff/00/00", /* 1/9: bright red */
"rgb:00/ff/00", /* 2/10: bright green */
"rgb:ff/ff/00", /* 3/11: bright yellow */
"rgb:00/00/ff", /* 4/12: bright blue */
"rgb:ff/00/ff", /* 5/13: bright magenta */
"rgb:00/ff/ff", /* 6/14: bright cyan */
"rgb:ff/ff/ff", /* 7/15: bright white */
#ifndef NO_CURSORCOLOR
NULL, NULL, /* cursorColor, cursorColor2 */
#endif /* NO_CURSORCOLOR */
NULL, NULL /* pointerColor, borderColor */
#ifndef NO_BOLDUNDERLINE
, NULL, NULL /* colorBD, colorUL */
#endif /* NO_BOLDUNDERLINE */
};
char *rs_color[NRS_COLORS];
Pixel PixColors[NRS_COLORS + NSHADOWCOLORS];
unsigned int MetaMask = 0, AltMask = 0, NumLockMask = 0;
unsigned int modmasks[] = { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask };
/* This function queries X to see which modifier keys (specifically Alt, Meta, and NumLock,
since that's really all we care about) are bound to the 5 modifier masks. It then sets
the variables MetaMask, AltMask, and NumLockMask to the appropriate modifier mask (e.g.,
Mod1Mask). That way, we can use MetaMask in lookup_key() instead of using a specific
ModMask. This function also handles fallbacks, so that if there is no Meta key, the Alt
key will be used as Meta, and vice versa. get_modifiers() is called once on startup and
after each MappingNotify event. */
void
get_modifiers(void)
{
unsigned short i;
XModifierKeymap *modmap;
KeyCode *kc;
modmap = XGetModifierMapping(Xdisplay);
kc = modmap->modifiermap;
/* For each of the 5 modifier masks... */
for (i = Mod5MapIndex; i >= Mod1MapIndex; i--) {
unsigned short j;
register unsigned short k, l;
k = i * modmap->max_keypermod;
l = i - Mod1MapIndex;
/* Find each key bound to it... */
for (j = 0; j < modmap->max_keypermod; j++, k++) {
unsigned char match = 0;
if (kc[k] == 0) {
break;
}
/* Check to see if it's one that we care about. */
switch (XKeycodeToKeysym(Xdisplay, kc[k], 0)) {
case XK_Meta_L:
case XK_Meta_R:
D_X11(("Found Meta key as mod %d\n", l + 1));
match = MetaMask = modmasks[l];
break;
case XK_Alt_L:
case XK_Alt_R:
D_X11(("Found Alt key as mod %d\n", l + 1));
match = AltMask = modmasks[l];
break;
case XK_Num_Lock:
D_X11(("Found NumLock key as mod %d\n", l + 1));
match = NumLockMask = modmasks[l];
break;
default:
break;
}
if (match) {
break;
}
}
}
XFreeModifiermap(modmap);
/* Fallbacks. */
if (MetaMask == 0) {
if (AltMask != 0) {
D_X11(("Defaulted Meta key to match Alt mask\n"));
MetaMask = AltMask;
} else {
D_X11(("Defaulted Meta key to mod 1\n"));
MetaMask = Mod1Mask;
}
}
if (AltMask == 0) {
D_X11(("Defaulted Alt key to match Meta mask\n"));
AltMask = MetaMask; /* MetaMask will always be defined at this point. */
}
/* See if the user wants to override any of those */
if (rs_meta_mod) {
MetaMask = modmasks[rs_meta_mod - 1];
}
if (rs_alt_mod) {
AltMask = modmasks[rs_alt_mod - 1];
}
if (rs_numlock_mod) {
NumLockMask = modmasks[rs_numlock_mod - 1];
}
}
/* To handle buffer overflows properly, we must malloc a buffer. Free it when done. */
#ifdef USE_XIM
# define LK_RET() do {if (kbuf_alloced) FREE(kbuf); return;} while (0)
#else
# define LK_RET() return
#endif
/* This function is called for every keypress event we receive. Its job is to convert
the keypress into its corresponding action. It is responsible for calling the action
bindings routine to see if there is an action binding for that keysym; if there is,
this routine will exit. If not, it continues. It then uses the keysym to determine
the action or escape sequence which should result from the keypress. Actions are
performed and the event discarded. Escape sequences are generated and sent to the
child process. */
void
lookup_key(XEvent * ev)
{
#ifdef ESCREEN
static int escreen_escape = 0;
#endif
static int numlock_state = 0;
int ctrl, meta, shft, len;
KeySym keysym;
#ifdef USE_XIM
int valid_keysym = 0;
static unsigned char short_buf[256];
unsigned char *kbuf = short_buf;
int kbuf_alloced = 0;
#else
static unsigned char kbuf[KBUFSZ];
#endif
#ifdef GREEK_SUPPORT
static short greek_mode = 0;
#endif
/* Quick boolean variables tell us which modifier keys were pressed. */
shft = (ev->xkey.state & ShiftMask);
ctrl = (ev->xkey.state & ControlMask);
meta = (ev->xkey.state & MetaMask);
/* The num lock key toggles application keypad
mode. Num lock on, app. keypad mode off. */
if (numlock_state || (ev->xkey.state & NumLockMask)) {
numlock_state = (ev->xkey.state & NumLockMask);
PrivMode((!numlock_state), PrivMode_aplKP);
}
#ifdef USE_XIM
if (xim_input_context != NULL) {
Status status_return;
kbuf[0] = '\0';
/* Lookup the string equivalent in terms of the XIM input context. */
len = XmbLookupString(xim_input_context, &ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, &status_return);
D_TTY(("XmbLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\" based on the XIM input context %010p\n",
len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len), xim_input_context));
/* Whoops, it's too long. Allocate a new buffer and repeat the call. */
if (status_return == XBufferOverflow) {
kbuf = (unsigned char *) MALLOC(len + 1);
kbuf_alloced = 1;
len = XmbLookupString(xim_input_context, &ev->xkey, (char *) kbuf, len, &keysym, &status_return);
D_TTY(("XmbLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\" based on the XIM input context %010p\n",
len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len), xim_input_context));
}
valid_keysym = (status_return == XLookupKeySym) || (status_return == XLookupBoth);
} else {
/* No XIM input context. Do it the normal way. */
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, NULL);
D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n",
len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len)));
valid_keysym = 1;
}
#else /* USE_XIM */
/* Translate the key event into its corresponding string according to X. This also gets us a keysym. */
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL);
D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n",
len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len)));
/* If there is no string and it's a Latin2-7 character, replace it with the Latin1 character instead. */
if (!len && (keysym >= 0x0100) && (keysym < 0x0900)) {
len = 1;
kbuf[0] = (keysym & 0xff);
}
#endif /* USE_XIM */
#ifdef ESCREEN
if (escreen_escape) {
if (kbuf[0]) {
escreen_escape = 0;
if (kbuf[0] < 128)
(void) ns_parse_screen_key(TermWin.screen, kbuf[0]);
LK_RET();
}
} else if (TermWin.screen && TermWin.screen->escape == kbuf[0]) {
escreen_escape = 1;
LK_RET();
}
#endif
#ifdef USE_XIM
/* Don't do anything without a valid keysym. */
if (valid_keysym) {
#endif
/* Check for a corresponding action binding. If there is one, we're done with this event. */
if (action_dispatch(ev, keysym)) {
LK_RET();
}
if (len) {
/* Only home for keypresses with length. */
if (Options & Opt_home_on_input) {
TermWin.view_start = 0;
}
}
/* This is a special mode that reports all extended keysyms (above 0xff00) to the application
as escape sequences. Very few applications use it, but it can be a handy thing to have. */
if ((Options & Opt_report_as_keysyms) && (keysym >= 0xff00)) {
len = sprintf((char *) kbuf, "\033[k%X;%X~", (unsigned int) (ev->xkey.state & 0xff), (unsigned int) (keysym & 0xff));
tt_write(kbuf, len);
LK_RET();
}
#ifdef HOTKEY
/* Ctrl-> and Ctrl-< should change font sizes. (Meta if HOTKEY has been changed to Meta.) */
if (HOTKEY) {
if (keysym == ks_bigfont) {
change_font(0, BIGGER_FONT);
LK_RET();
} else if (keysym == ks_smallfont) {
change_font(0, SMALLER_FONT);
LK_RET();
}
}
#endif
#if defined(HAVE_X11_SUNKEYSYM_H) && defined(HAVE_X11_XMU_ATOMS_H)
switch (keysym) {
case SunXK_Copy:
case SunXK_Cut:
selection_copy(XA_CLIPBOARD(Xdisplay));
LK_RET();
break;
case SunXK_Paste:
selection_paste(XA_CLIPBOARD(Xdisplay));
LK_RET();
break;
case SunXK_Front:
xterm_seq(XTerm_Takeover, "");
LK_RET();
break;
default:
break;
}
#endif
if (shft) {
/* Shift + F1 - F10 generates F11 - F20 */
if (keysym >= XK_F1 && keysym <= XK_F10) {
keysym += (XK_F11 - XK_F1);
shft = 0;
} else if (!ctrl && !meta && (PrivateModes & PrivMode_ShiftKeys)) {
switch (keysym) {
case XK_Prior: /* Shift-PgUp scrolls up a page */
if (TermWin.saveLines) {
scr_page(UP, (TermWin.nrow - CONTEXT_LINES));
LK_RET();
}
break;
case XK_Next: /* Shift-PgDn scrolls down a page */
if (TermWin.saveLines) {
scr_page(DN, (TermWin.nrow - CONTEXT_LINES));
LK_RET();
}
break;
case XK_Insert: /* Shift-Ins pastes the current selection. */
selection_paste(XA_PRIMARY);
LK_RET();
break;
case XK_KP_Add: /* Shift-Plus on the keypad increases the font size */
change_font(0, BIGGER_FONT);
LK_RET();
break;
case XK_KP_Subtract: /* Shift-Minus on the keypad decreases the font size */
change_font(0, SMALLER_FONT);
LK_RET();
break;
}
}
}
#ifdef UNSHIFTED_SCROLLKEYS
/* Allow PgUp/PgDn by themselves to scroll. Not recommended. */
else if (!ctrl && !meta) {
switch (keysym) {
case XK_Prior:
if (TermWin.saveLines) {
scr_page(UP, TermWin.nrow - CONTEXT_LINES);
LK_RET();
}
break;
case XK_Next:
if (TermWin.saveLines) {
scr_page(DN, TermWin.nrow - CONTEXT_LINES);
LK_RET();
}
break;
}
}
#endif
switch (keysym) {
case XK_Print: /* Print the screen contents out to the print pipe */
#if DEBUG >= DEBUG_SELECTION
if (DEBUG_LEVEL >= DEBUG_SELECTION) {
scr_dump_to_file("/tmp/Eterm_screen_dump.log");
} else
#endif
#ifdef PRINTPIPE
scr_printscreen(ctrl | shft);
#endif
LK_RET();
break;
case XK_Mode_switch:
#ifdef GREEK_SUPPORT
greek_mode = !greek_mode;
if (greek_mode) {
xterm_seq(XTerm_title, (greek_getmode() == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]"));
greek_reset();
} else
xterm_seq(XTerm_title, APL_NAME "-" VERSION);
LK_RET();
#endif
break;
}
/* At this point, all the keystrokes that have special meaning to us have been handled.
If we're in pause mode, this is a keystroke asking us to exit. Otherwise, return here. */
if (paused) {
if (keysym && len) {
exit(0);
}
LK_RET();
}
/* Process extended keysyms. This is where the conversion to escape sequences happens. */
if (keysym >= 0xff00 && keysym <= 0xffff) {
#ifdef KEYSYM_ATTRIBUTE
/* The "keysym" attribute in the config file gets handled here. */
if (!(shft | ctrl) && KeySym_map[keysym - 0xff00] != NULL) {
const unsigned char *tmpbuf;
unsigned int len;
tmpbuf = (KeySym_map[keysym - 0xff00]);
len = *tmpbuf++;
/* escape prefix */
if (meta
# ifdef META8_OPTION
&& (meta_char == 033)
# endif
) {
const unsigned char ch = '\033';
tt_write(&ch, 1);
}
tt_write(tmpbuf, len);
LK_RET();
} else
#endif
/* This is a big-ass switch statement that handles all the special keysyms */
switch (keysym) {
case XK_BackSpace:
len = 1;
#ifdef FORCE_BACKSPACE
kbuf[0] = (!(shft | ctrl) ? '\b' : '\177');
#elif defined(FORCE_DELETE)
kbuf[0] = ((shft | ctrl) ? '\b' : '\177');
#else
kbuf[0] = (((PrivateModes & PrivMode_BackSpace) ? !(shft | ctrl) : (shft | ctrl)) ? '\b' : '\177');
#endif
#ifdef MULTI_CHARSET
if ((Options & Opt_mbyte_cursor) && scr_multi2()) {
memmove(kbuf + len, kbuf, len);
len *= 2;
}
#endif /* MULTI_CHARSET */
break;
/* Tab key is normal unless it's shift-tab. */
case XK_Tab:
if (shft) {
len = 3;
strcpy(kbuf, "\033[Z");
}
break;
#ifdef XK_KP_Home
case XK_KP_Home:
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033Ow");
break;
}
/* -> else FALL THROUGH */
#endif
case XK_Home:
len = strlen(strcpy(kbuf, KS_HOME));
break;
#ifdef XK_KP_Left
case XK_KP_Left: /* \033Ot or standard cursor key */
case XK_KP_Up: /* \033Ox or standard cursor key */
case XK_KP_Right: /* \033Ov or standard cursor key */
case XK_KP_Down: /* \033Or or standard cursor key */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033OZ"); /* The Z is replaced by t, x, v, or r */
kbuf[2] = ("txvr"[keysym - XK_KP_Left]);
break;
} else {
keysym = XK_Left + (keysym - XK_KP_Left);
}
/* Continue on with the normal cursor keys... */
#endif
case XK_Left: /* "\033[D" */
case XK_Up: /* "\033[A" */
case XK_Right: /* "\033[C" */
case XK_Down: /* "\033[B" */
len = 3;
strcpy(kbuf, "\033[@");
kbuf[2] = ("DACB"[keysym - XK_Left]);
if (PrivateModes & PrivMode_aplCUR) {
kbuf[1] = 'O';
} else if (shft) { /* do Shift first */
kbuf[2] = ("dacb"[keysym - XK_Left]);
} else if (ctrl) {
kbuf[1] = 'O';
kbuf[2] = ("dacb"[keysym - XK_Left]);
}
#ifdef MULTI_CHARSET
if ((Options & Opt_mbyte_cursor)
&& ((keysym == XK_Left && scr_multi2())
|| (keysym == XK_Right && scr_multi1()))) {
memmove(kbuf + len, kbuf, len);
len *= 2;
}
#endif /* MULTI_CHARSET */
break;
/* Keypad and normal PgUp/PgDn */
#ifndef UNSHIFTED_SCROLLKEYS
# ifdef XK_KP_Prior
case XK_KP_Prior:
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033Oy");
break;
}
/* -> else FALL THROUGH */
# endif /* XK_KP_Prior */
case XK_Prior:
len = 4;
strcpy(kbuf, "\033[5~");
break;
# ifdef XK_KP_Next
case XK_KP_Next:
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033Os");
break;
}
/* -> else FALL THROUGH */
# endif /* XK_KP_Next */
case XK_Next:
len = 4;
strcpy(kbuf, "\033[6~");
break;
#endif /* UNSHIFTED_SCROLLKEYS */
/* End key */
#ifdef XK_KP_End
case XK_KP_End:
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033Oq");
break;
}
/* -> else FALL THROUGH */
#endif /* XK_KP_End */
case XK_End:
len = strlen(strcpy(kbuf, KS_END));
break;
case XK_Select:
len = 4;
strcpy(kbuf, "\033[4~");
break;
#ifdef DXK_Remove
case DXK_Remove:
#endif
case XK_Execute:
len = 4;
strcpy(kbuf, "\033[3~");
break;
#ifdef XK_KP_Insert
case XK_KP_Insert:
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033Op");
break;
}
#endif
case XK_Insert:
len = 4;
strcpy(kbuf, "\033[2~");
break;
#ifdef XK_KP_Delete
case XK_KP_Delete:
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033On");
break;
}
#endif
case XK_Delete:
#ifdef KS_DELETE
len = strlen(strcpy(kbuf, KS_DELETE));
#ifdef MULTI_CHARSET
if ((Options & Opt_mbyte_cursor) && scr_multi1()) {
memmove(kbuf + len, kbuf, len);
len *= 2;
}
#endif /* MULTI_CHARSET */
#endif
break;
case XK_Menu:
len = 5;
strcpy(kbuf, "\033[29~");
break;
case XK_Find:
len = 4;
strcpy(kbuf, "\033[1~");
break;
case XK_Help:
len = 5;
strcpy(kbuf, "\033[28~");
break;
case XK_KP_Enter:
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033OM");
} else {
len = 1;
kbuf[0] = '\r';
}
break;
#ifdef XK_KP_Begin
case XK_KP_Begin:
len = 3;
strcpy(kbuf, "\033Ou");
break;
#endif /* XK_KP_Begin */
case XK_KP_F1: /* "\033OP" */
case XK_KP_F2: /* "\033OQ" */
case XK_KP_F3: /* "\033OR" */
case XK_KP_F4: /* "\033OS" */
len = 3;
strcpy(kbuf, "\033OP");
kbuf[2] += (keysym - XK_KP_F1);
break;
case XK_KP_Multiply: /* "\033Oj" : "*" */
case XK_KP_Add: /* "\033Ok" : "+" */
case XK_KP_Separator: /* "\033Ol" : "," */
case XK_KP_Subtract: /* "\033Om" : "-" */
case XK_KP_Decimal: /* "\033On" : "." */
case XK_KP_Divide: /* "\033Oo" : "/" */
case XK_KP_0: /* "\033Op" : "0" */
case XK_KP_1: /* "\033Oq" : "1" */
case XK_KP_2: /* "\033Or" : "2" */
case XK_KP_3: /* "\033Os" : "3" */
case XK_KP_4: /* "\033Ot" : "4" */
case XK_KP_5: /* "\033Ou" : "5" */
case XK_KP_6: /* "\033Ov" : "6" */
case XK_KP_7: /* "\033Ow" : "7" */
case XK_KP_8: /* "\033Ox" : "8" */
case XK_KP_9: /* "\033Oy" : "9" */
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033Oj");
kbuf[2] += (keysym - XK_KP_Multiply);
} else {
len = 1;
kbuf[0] = ('*' + (keysym - XK_KP_Multiply));
}
break;
#define FKEY(n,fkey) do { \
len = 5; \
sprintf((char *) kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))); \
} while (0);
case XK_F1: /* "\033[11~" */
case XK_F2: /* "\033[12~" */
case XK_F3: /* "\033[13~" */
case XK_F4: /* "\033[14~" */
case XK_F5: /* "\033[15~" */
FKEY(11, XK_F1);
break;
case XK_F6: /* "\033[17~" */
case XK_F7: /* "\033[18~" */
case XK_F8: /* "\033[19~" */
case XK_F9: /* "\033[20~" */
case XK_F10: /* "\033[21~" */
FKEY(17, XK_F6);
break;
case XK_F11: /* "\033[23~" */
case XK_F12: /* "\033[24~" */
case XK_F13: /* "\033[25~" */
case XK_F14: /* "\033[26~" */
FKEY(23, XK_F11);
break;
case XK_F15: /* "\033[28~" */
case XK_F16: /* "\033[29~" */
FKEY(28, XK_F15);
break;
case XK_F17: /* "\033[31~" */
case XK_F18: /* "\033[32~" */
case XK_F19: /* "\033[33~" */
case XK_F20: /* "\033[34~" */
case XK_F21: /* "\033[35~" */
case XK_F22: /* "\033[36~" */
case XK_F23: /* "\033[37~" */
case XK_F24: /* "\033[38~" */
case XK_F25: /* "\033[39~" */
case XK_F26: /* "\033[40~" */
case XK_F27: /* "\033[41~" */
case XK_F28: /* "\033[42~" */
case XK_F29: /* "\033[43~" */
case XK_F30: /* "\033[44~" */
case XK_F31: /* "\033[45~" */
case XK_F32: /* "\033[46~" */
case XK_F33: /* "\033[47~" */
case XK_F34: /* "\033[48~" */
case XK_F35: /* "\033[49~" */
FKEY(31, XK_F17);
break;
#undef FKEY
}
#ifdef META8_OPTION
if (meta && (meta_char == 0x80) && len > 0) {
kbuf[len - 1] |= 0x80;
}
#endif
} else if (ctrl && keysym == XK_minus) {
len = 1;
kbuf[0] = '\037'; /* Ctrl-Minus generates ^_ (31) */
} else {
#ifdef META8_OPTION
/* set 8-bit on */
if (meta && (meta_char == 0x80)) {
unsigned char *ch;
for (ch = kbuf; ch < kbuf + len; ch++)
*ch |= 0x80;
meta = 0;
}
#endif
#ifdef GREEK_SUPPORT
if (greek_mode)
len = greek_xlat(kbuf, len);
#endif
}
#ifdef USE_XIM
}
#endif