Module Name: xsrc Committed By: mrg Date: Sun Jan 9 09:17:32 UTC 2022
Modified Files: xsrc/external/mit/xauth/dist: process.c xsrc/external/mit/xterm/dist: fontutils.c linedata.c misc.c ptyx.h xterm.h xterm.man xsrc/external/mit/xterm/include: xtermcfg.h Log Message: merge xauth 1.1.1 and xterm 370. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xauth/dist/process.c cvs rdiff -u -r1.10 -r1.11 xsrc/external/mit/xterm/dist/fontutils.c cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xterm/dist/linedata.c cvs rdiff -u -r1.22 -r1.23 xsrc/external/mit/xterm/dist/misc.c cvs rdiff -u -r1.17 -r1.18 xsrc/external/mit/xterm/dist/ptyx.h cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xterm/dist/xterm.h cvs rdiff -u -r1.19 -r1.20 xsrc/external/mit/xterm/dist/xterm.man cvs rdiff -u -r1.18 -r1.19 xsrc/external/mit/xterm/include/xtermcfg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: xsrc/external/mit/xauth/dist/process.c diff -u xsrc/external/mit/xauth/dist/process.c:1.7 xsrc/external/mit/xauth/dist/process.c:1.8 --- xsrc/external/mit/xauth/dist/process.c:1.7 Mon Jul 15 06:01:53 2019 +++ xsrc/external/mit/xauth/dist/process.c Sun Jan 9 09:17:31 2022 @@ -37,6 +37,7 @@ from The Open Group. #include "xauth.h" #include <ctype.h> #include <errno.h> +#include <stdint.h> #include <sys/stat.h> #ifndef WIN32 #include <sys/socket.h> @@ -251,6 +252,18 @@ skip_nonspace(register char *s) return s; } +#ifndef HAVE_REALLOCARRAY +static inline void * +reallocarray(void *optr, size_t nmemb, size_t size) +{ + if ((nmemb > 0) && (SIZE_MAX / nmemb < size)) { + errno = ENOMEM; + return NULL; + } + return realloc(optr, size * nmemb); +} +#endif + static const char ** split_into_words(char *src, int *argcp) /* argvify string */ { @@ -278,9 +291,15 @@ split_into_words(char *src, int *argcp) savec = *src; *src = '\0'; if (cur == total) { + const char **new_argv; total += WORDSTOALLOC; - argv = realloc (argv, total * sizeof (char *)); - if (!argv) return NULL; + new_argv = reallocarray (argv, total, sizeof (char *)); + if (new_argv != NULL) { + argv = new_argv; + } else { + free(argv); + return NULL; + } } argv[cur++] = jword; if (savec) src++; /* if not last on line advance */ @@ -633,7 +652,7 @@ static Bool xauth_modified = False; /* i static Bool xauth_allowed = True; /* if allowed to write auth file */ static Bool xauth_locked = False; /* if has been locked */ static const char *xauth_filename = NULL; -static volatile Bool dieing = False; +static volatile Bool dying = False; /* poor man's puts(), for under signal handlers, @@ -645,7 +664,7 @@ _X_NORETURN static void die(int sig) { - dieing = True; + dying = True; _exit (auth_finalize ()); /* NOTREACHED */ } @@ -697,6 +716,10 @@ auth_initialize(const char *authfilename FILE *authfp; Bool exists; + if (strlen(authfilename) > 1022) { + fprintf (stderr, "%s: authority file name \"%s\" too long\n", + ProgramName, authfilename); + } xauth_filename = authfilename; /* used in cleanup, prevent race with signals */ register_signals (); @@ -854,10 +877,10 @@ write_auth_file(char *tmp_nam) int auth_finalize(void) { - char temp_name[1024]; /* large filename size */ + char temp_name[1025]; /* large filename size */ if (xauth_modified) { - if (dieing) { + if (dying) { if (verbose) { /* * called from a signal handler -- printf is *not* reentrant; also @@ -1614,13 +1637,22 @@ do_add(const char *inputfilename, int li hexkey = argv[3]; len = strlen(hexkey); - if (hexkey[0] == '"' && hexkey[len-1] == '"') { + if (len > 1 && hexkey[0] == '"' && hexkey[len-1] == '"') { key = malloc(len-1); + if (!key) { + fprintf(stderr, "unable to allocate memory\n"); + return 1; + } strncpy(key, hexkey+1, len-2); + key[len-1] = '\0'; len -= 2; } else if (!strcmp(protoname, SECURERPC) || !strcmp(protoname, K5AUTH)) { key = malloc(len+1); + if (!key) { + fprintf(stderr, "unable to allocate memory\n"); + return 1; + } strcpy(key, hexkey); } else { len = cvthexkey (hexkey, &key); @@ -1859,10 +1891,10 @@ do_generate(const char *inputfilename, i const char *displayname; int major_version, minor_version; XSecurityAuthorization id_return; - Xauth *auth_in, *auth_return; + Xauth *auth_in = NULL, *auth_return = NULL; XSecurityAuthorizationAttributes attributes; unsigned long attrmask = 0; - Display *dpy; + Display *dpy = NULL; int status; const char *args[4]; const char *protoname = "."; @@ -1870,7 +1902,7 @@ do_generate(const char *inputfilename, i int authdatalen = 0; const char *hexdata; char *authdata = NULL; - char *hex; + char *hex = NULL; if (argc < 2 || !argv[1]) { prefix (inputfilename, lineno); @@ -1889,7 +1921,8 @@ do_generate(const char *inputfilename, i if (++i == argc) { prefix (inputfilename, lineno); badcommandline (argv[i-1]); - return 1; + status = 1; + goto exit_generate; } attributes.timeout = atoi(argv[i]); attrmask |= XSecurityTimeout; @@ -1906,7 +1939,8 @@ do_generate(const char *inputfilename, i if (++i == argc) { prefix (inputfilename, lineno); badcommandline (argv[i-1]); - return 1; + status = 1; + goto exit_generate; } attributes.group = atoi(argv[i]); attrmask |= XSecurityGroup; @@ -1915,13 +1949,20 @@ do_generate(const char *inputfilename, i if (++i == argc) { prefix (inputfilename, lineno); badcommandline (argv[i-1]); - return 1; + status = 1; + goto exit_generate; } hexdata = argv[i]; authdatalen = strlen(hexdata); if (hexdata[0] == '"' && hexdata[authdatalen-1] == '"') { authdata = malloc(authdatalen-1); + if (!authdata) { + fprintf(stderr, "unable to allocate memory\n"); + status = 1; + goto exit_generate; + } strncpy(authdata, hexdata+1, authdatalen-2); + authdata[authdatalen-1] = '\0'; authdatalen -= 2; } else { authdatalen = cvthexkey (hexdata, &authdata); @@ -1929,13 +1970,15 @@ do_generate(const char *inputfilename, i prefix (inputfilename, lineno); fprintf (stderr, "data contains odd number of or non-hex characters\n"); - return 1; + status = 1; + goto exit_generate; } } } else { prefix (inputfilename, lineno); badcommandline (argv[i]); - return 1; + status = 1; + goto exit_generate; } } @@ -1945,7 +1988,8 @@ do_generate(const char *inputfilename, i if (!dpy) { prefix (inputfilename, lineno); fprintf (stderr, "unable to open display \"%s\".\n", displayname); - return 1; + status = 1; + goto exit_generate; } status = XSecurityQueryExtension(dpy, &major_version, &minor_version); @@ -1954,7 +1998,8 @@ do_generate(const char *inputfilename, i prefix (inputfilename, lineno); fprintf (stderr, "couldn't query Security extension on display \"%s\"\n", displayname); - return 1; + status = 1; + goto exit_generate; } /* fill in input Xauth struct */ @@ -1979,7 +2024,8 @@ do_generate(const char *inputfilename, i { prefix (inputfilename, lineno); fprintf (stderr, "couldn't generate authorization\n"); - return 1; + status = 1; + goto exit_generate; } if (verbose) @@ -1994,10 +2040,12 @@ do_generate(const char *inputfilename, i status = do_add(inputfilename, lineno, 4, args); - if (authdata) free(authdata); + exit_generate: + free(authdata); XSecurityFreeXauth(auth_in); XSecurityFreeXauth(auth_return); free(hex); - XCloseDisplay(dpy); + if (dpy != NULL) + XCloseDisplay(dpy); return status; } Index: xsrc/external/mit/xterm/dist/fontutils.c diff -u xsrc/external/mit/xterm/dist/fontutils.c:1.10 xsrc/external/mit/xterm/dist/fontutils.c:1.11 --- xsrc/external/mit/xterm/dist/fontutils.c:1.10 Sun Jul 11 00:31:54 2021 +++ xsrc/external/mit/xterm/dist/fontutils.c Sun Jan 9 09:17:31 2022 @@ -1,4 +1,4 @@ -/* $XTermId: fontutils.c,v 1.705 2021/06/02 23:49:10 tom Exp $ */ +/* $XTermId: fontutils.c,v 1.709 2021/11/10 00:36:27 Rajeev.V.Pillai Exp $ */ /* * Copyright 1998-2020,2021 by Thomas E. Dickey @@ -180,7 +180,7 @@ set_font_width(TScreen *screen, VTwin *w SetFontWidth(screen, win, width); TRACE(("SetFontWidth %d\n", win->f_width)); #undef SetFontWidth -#define SetFontWidth(screen, win, height) set_font_width(screen, win, height) +#define SetFontWidth(screen, win, width) set_font_width(screen, win, width) } #endif @@ -1282,11 +1282,15 @@ xtermUpdateFontGCs(XtermWidget xw, MyGet unsigned xtermUpdateItalics(XtermWidget xw, unsigned new_attrs, unsigned old_attrs) { - if ((new_attrs & ATR_ITALIC) && !(old_attrs & ATR_ITALIC)) { - xtermLoadItalics(xw); - xtermUpdateFontGCs(xw, getItalicFont); - } else if (!(new_attrs & ATR_ITALIC) && (old_attrs & ATR_ITALIC)) { - xtermUpdateFontGCs(xw, getNormalFont); + TScreen *screen = TScreenOf(xw); + + if (UseItalicFont(screen)) { + if ((new_attrs & ATR_ITALIC) && !(old_attrs & ATR_ITALIC)) { + xtermLoadItalics(xw); + xtermUpdateFontGCs(xw, getItalicFont); + } else if (!(new_attrs & ATR_ITALIC) && (old_attrs & ATR_ITALIC)) { + xtermUpdateFontGCs(xw, getNormalFont); + } } return new_attrs; } @@ -1449,6 +1453,15 @@ loadWideFP(XtermWidget xw, } else { xtermCopyFontInfo(infoOut, infoRef); } +#define MinWidthOf(fs) fs->min_bounds.width +#define MaxWidthOf(fs) fs->max_bounds.width + xw->work.force_wideFont = False; + if (MaxWidthOf(infoOut->fs) != (2 * MaxWidthOf(infoRef->fs))) { + TRACE(("...reference width %d\n", MaxWidthOf(infoRef->fs))); + TRACE(("...?? double-width %d\n", 2 * MaxWidthOf(infoRef->fs))); + TRACE(("...actual width %d\n", MaxWidthOf(infoOut->fs))); + xw->work.force_wideFont = True; + } return status; } @@ -1842,7 +1855,7 @@ xtermLoadItalics(XtermWidget xw) { TScreen *screen = TScreenOf(xw); - if (!screen->ifnts_ok) { + if (UseItalicFont(screen) && !screen->ifnts_ok) { int n; FontNameProperties *fp; XTermFonts *data; @@ -2442,7 +2455,7 @@ dumpXft(XtermWidget xw, XTermXftFonts *d #endif for (c = first; c <= last; ++c) { if (FcCharSetHasChar(xft->charset, c)) { - int width = CharWidth(c); + int width = CharWidth(screen, c); XGlyphInfo extents; Boolean big_x; Boolean big_y; @@ -2610,7 +2623,7 @@ checkXftWidth(XtermWidget xw, XTermXftFo * Ignore control characters - their extent information is misleading. */ for (c = 32; c < 256; ++c) { - if (CharWidth(c) <= 0) + if (CharWidth(TScreenOf(xw), c) <= 0) continue; if (FcCharSetHasChar(source->font->charset, c)) { (void) checkedXftWidth(XtDisplay(xw), @@ -3626,8 +3639,7 @@ xtermMissingChar(unsigned ch, XTermFonts #endif if (pc == 0 || CI_NONEXISTCHAR(pc)) { - TRACE2(("xtermMissingChar %#04x (!exists), %d cells\n", - ch, CharWidth(ch))); + TRACE2(("xtermMissingChar %#04x (!exists)\n", ch)); result = True; } if (ch < KNOWN_MISSING) { @@ -4054,7 +4066,7 @@ foundXftGlyph(XtermWidget xw, XftFont *f if (font != 0 && XftGlyphExists(screen->display, font, wc)) { int expect; - if ((expect = CharWidth(wc)) > 0) { + if ((expect = CharWidth(screen, wc)) > 0) { XGlyphInfo gi; int actual; Index: xsrc/external/mit/xterm/dist/linedata.c diff -u xsrc/external/mit/xterm/dist/linedata.c:1.7 xsrc/external/mit/xterm/dist/linedata.c:1.8 --- xsrc/external/mit/xterm/dist/linedata.c:1.7 Tue Apr 27 01:58:18 2021 +++ xsrc/external/mit/xterm/dist/linedata.c Sun Jan 9 09:17:31 2022 @@ -1,4 +1,4 @@ -/* $XTermId: linedata.c,v 1.99 2021/03/08 00:24:12 tom Exp $ */ +/* $XTermId: linedata.c,v 1.100 2021/08/22 20:02:23 tom Exp $ */ /* * Copyright 2009-2019,2021 by Thomas E. Dickey @@ -51,14 +51,8 @@ getLineData(TScreen *screen, int row) if (row >= 0) { buffer = screen->visbuf; } else { -#if OPT_FIFO_LINES buffer = 0; result = getScrollback(screen, row); -#else - buffer = screen->saveBuf_index; - row += screen->savelines; - max_row += screen->savelines; -#endif } if (row >= 0 && row <= max_row) { result = (LineData *) scrnHeadAddr(screen, buffer, (unsigned) row); Index: xsrc/external/mit/xterm/dist/misc.c diff -u xsrc/external/mit/xterm/dist/misc.c:1.22 xsrc/external/mit/xterm/dist/misc.c:1.23 --- xsrc/external/mit/xterm/dist/misc.c:1.22 Sun Jul 11 00:31:54 2021 +++ xsrc/external/mit/xterm/dist/misc.c Sun Jan 9 09:17:31 2022 @@ -1,4 +1,4 @@ -/* $XTermId: misc.c,v 1.988 2021/06/07 23:19:42 tom Exp $ */ +/* $XTermId: misc.c,v 1.1007 2021/11/12 09:28:19 tom Exp $ */ /* * Copyright 1999-2020,2021 by Thomas E. Dickey @@ -2593,7 +2593,7 @@ maskToWidth(unsigned long mask) return result; } -int +XVisualInfo * getVisualInfo(XtermWidget xw) { #define MYFMT "getVisualInfo \ @@ -2634,7 +2634,9 @@ rgb masks (%04lx/%04lx/%04lx)\n" (vi->blue_mask != 0) && ((vi->red_mask & vi->green_mask) == 0) && ((vi->green_mask & vi->blue_mask) == 0) && - ((vi->blue_mask & vi->red_mask) == 0)); + ((vi->blue_mask & vi->red_mask) == 0) && + (vi->class == TrueColor + || vi->class == DirectColor)); if (resource.reportColors) { printf(MYFMT, MYARG); @@ -2644,9 +2646,13 @@ rgb masks (%04lx/%04lx/%04lx)\n" xw->rgb_shifts[0], xw->rgb_shifts[1], xw->rgb_shifts[2])); + TRACE(("...widths %u/%u/%u\n", + xw->rgb_widths[0], + xw->rgb_widths[1], + xw->rgb_widths[2])); } } - return (xw->visInfo != 0) && (xw->numVisuals > 0); + return (xw->visInfo != 0) && (xw->numVisuals > 0) ? xw->visInfo : NULL; #undef MYFMT #undef MYARG } @@ -2659,12 +2665,11 @@ ReportAnsiColorRequest(XtermWidget xw, i if (AllowColorOps(xw, ecGetAnsiColor)) { XColor color; - Colormap cmap = xw->core.colormap; char buffer[80]; TRACE(("ReportAnsiColorRequest %d\n", colornum)); color.pixel = GET_COLOR_RES(xw, TScreenOf(xw)->Acolors[colornum]); - XQueryColor(TScreenOf(xw)->display, cmap, &color); + (void) QueryOneColor(xw, &color); sprintf(buffer, "%d;%d;rgb:%04x/%04x/%04x", opcode, (opcode == 5) ? (colornum - NUM_ANSI_COLORS) : colornum, @@ -2731,6 +2736,75 @@ loadColorTable(XtermWidget xw, unsigned return result; } +/***====================================================================***/ + +/* + * Call this function with def->{red,green,blue} initialized, to obtain a pixel + * value. + */ +Boolean +AllocOneColor(XtermWidget xw, XColor *def) +{ + TScreen *screen = TScreenOf(xw); + XVisualInfo *visInfo; + Boolean result = True; + +#define MaskIt(name,nn) \ + ((unsigned long) ((def->name >> (16 - xw->rgb_widths[nn])) \ + << xw->rgb_shifts[nn]) \ + & xw->visInfo->name ##_mask) + + if ((visInfo = getVisualInfo(xw)) != NULL && xw->has_rgb) { + def->pixel = MaskIt(red, 0) | MaskIt(green, 1) | MaskIt(blue, 2); + } else { + Display *dpy = screen->display; + if (!XAllocColor(dpy, xw->core.colormap, def)) { + /* + * Decide between foreground and background by a grayscale + * approximation. + */ + int bright = def->red * 3 + def->green * 10 + def->blue; + int levels = 14 * 0x8000; + def->pixel = ((bright >= levels) + ? xw->dft_background + : xw->dft_foreground); + result = False; + } + } + return result; +} + +/***====================================================================***/ + +/* + * Call this function with def->pixel set to the color that we want to convert + * to separate red/green/blue. + */ +Boolean +QueryOneColor(XtermWidget xw, XColor *def) +{ + XVisualInfo *visInfo; + Boolean result = True; + +#define UnMaskIt(name,nn) \ + ((unsigned short)((def->pixel & xw->visInfo->name ##_mask) >> xw->rgb_shifts[nn])) +#define UnMaskIt2(name,nn) \ + (unsigned short)((((UnMaskIt(name,nn) << 8) \ + |UnMaskIt(name,nn))) << (8 - xw->rgb_widths[nn])) + + if ((visInfo = getVisualInfo(xw)) != NULL && xw->has_rgb) { + /* *INDENT-EQLS* */ + def->red = UnMaskIt2(red, 0); + def->green = UnMaskIt2(green, 1); + def->blue = UnMaskIt2(blue, 2); + } else if (!XQueryColor(TScreenOf(xw)->display, xw->core.colormap, def)) { + result = False; + } + return result; +} + +/***====================================================================***/ + /* * Find closest color for "def" in "cmap". * Set "def" to the resulting color. @@ -2742,7 +2816,7 @@ loadColorTable(XtermWidget xw, unsigned * Return False if not able to find or allocate a color. */ static Boolean -allocateClosestRGB(XtermWidget xw, Colormap cmap, XColor *def) +allocateClosestRGB(XtermWidget xw, XColor *def) { TScreen *screen = TScreenOf(xw); Boolean result = False; @@ -2796,8 +2870,7 @@ allocateClosestRGB(XtermWidget xw, Color } } } - if (XAllocColor(screen->display, cmap, - &screen->cmap_data[bestInx]) != 0) { + if (AllocOneColor(xw, &screen->cmap_data[bestInx])) { *def = screen->cmap_data[bestInx]; TRACE(("...closest %x/%x/%x\n", def->red, def->green, def->blue)); @@ -2822,193 +2895,6 @@ allocateClosestRGB(XtermWidget xw, Color #define ULONG_MAX (unsigned long)(~(0L)) #endif -#define CheckColor(result, value) \ - result = 0; \ - if (value.red) \ - result |= 1; \ - if (value.green) \ - result |= 2; \ - if (value.blue) \ - result |= 4 - -#define SelectColor(state, value, result) \ - switch (state) { \ - default: \ - case 1: \ - result = value.red; \ - break; \ - case 2: \ - result = value.green; \ - break; \ - case 4: \ - result = value.blue; \ - break; \ - } - -/* - * Check if the color map consists of values in exactly one of the red, green - * or blue columns. If it is not, we do not know how to use it for the exact - * match. - */ -static int -simpleColors(XColor *colortable, unsigned length) -{ - unsigned n; - int state = 0; - int check; - - for (n = 0; n < length; ++n) { - if (state > 0) { - CheckColor(check, colortable[n]); - if (check > 0 && check != state) { - state = 0; - break; - } - } else { - CheckColor(state, colortable[n]); - } - } - switch (state) { - case 1: - case 2: - case 4: - break; - default: - state = 0; - break; - } - return state; -} - -/* - * Shift the mask left or right to put its most significant bit at the 16-bit - * mark. - */ -static unsigned -normalizeMask(unsigned mask) -{ - while (mask < 0x8000) { - mask <<= 1; - } - while (mask >= 0x10000) { - mask >>= 1; - } - return mask; -} - -static unsigned -searchColors(XColor *colortable, unsigned mask, unsigned length, unsigned - color, int state) -{ - unsigned result = 0; - unsigned n; - unsigned long best = ULONG_MAX; - unsigned value; - - mask = normalizeMask(mask); - for (n = 0; n < length; ++n) { - unsigned long diff; - - SelectColor(state, colortable[n], value); - diff = ((color & mask) - (value & mask)); - diff *= diff; - if (diff < best) { -#if 0 - TRACE(("...%d:looking for %x, found %x/%x/%x (%lx)\n", - n, color, - colortable[n].red, - colortable[n].green, - colortable[n].blue, - diff)); -#endif - result = n; - best = diff; - } - } - SelectColor(state, colortable[result], value); - return value; -} - -/* - * This is a workaround for a longstanding defect in the X libraries. - * - * According to - * http://www.unix.com/man-page/all/3x/XAllocColoA/ - * - * XAllocColor() acts differently on static and dynamic visuals. On Pseu- - * doColor, DirectColor, and GrayScale visuals, XAllocColor() fails if - * there are no unallocated colorcells and no allocated read-only cell - * exactly matches the requested RGB values. On StaticColor, TrueColor, - * and StaticGray visuals, XAllocColor() returns the closest RGB values - * available in the colormap. The colorcell_in_out structure returns the - * actual RGB values allocated. - * - * That is, XAllocColor() should suffice unless the color map is full. In that - * case, allocateClosestRGB() is useful for the dynamic display classes such as - * PseudoColor. It is not useful for TrueColor, since XQueryColors() does not - * return regular RGB triples (unless a different scheme was used for - * specifying the pixel values); only the blue value is filled in. However, it - * is filled in with the colors that the server supports. - * - * Also (the reason for this function), XAllocColor() does not really work as - * described. For some TrueColor configurations it merely returns a close - * approximation, but not the closest. - */ -static Boolean -allocateExactRGB(XtermWidget xw, Colormap cmap, XColor *def) -{ - XColor save = *def; - TScreen *screen = TScreenOf(xw); - Boolean result = (Boolean) (XAllocColor(screen->display, cmap, def) != 0); - - /* - * If this is a statically allocated display with too many items to store - * in our array, i.e., TrueColor, see if we can improve on the result by - * using the color values actually supported by the server. - */ - if (result) { - unsigned cmap_type; - unsigned cmap_size; - - getColormapInfo(xw, &cmap_type, &cmap_size); - - if (cmap_type == TrueColor) { - XColor temp = *def; - int state; - - if (loadColorTable(xw, cmap_size) - && (state = simpleColors(screen->cmap_data, cmap_size)) > 0) { -#define SearchColors(which) \ - temp.which = (unsigned short) searchColors(screen->cmap_data, \ - (unsigned) xw->visInfo->which##_mask,\ - cmap_size, \ - save.which, \ - state) - SearchColors(red); - SearchColors(green); - SearchColors(blue); - if (XAllocColor(screen->display, cmap, &temp) != 0) { -#if OPT_TRACE - if (temp.red != save.red - || temp.green != save.green - || temp.blue != save.blue) { - TRACE(("...improved %x/%x/%x ->%x/%x/%x\n", - save.red, save.green, save.blue, - temp.red, temp.green, temp.blue)); - } else { - TRACE(("...no improvement for %x/%x/%x\n", - save.red, save.green, save.blue)); - } -#endif - *def = temp; - } - } - } - } - - return result; -} - /* * Allocate a color for the "ANSI" colors. That actually includes colors up * to 256. @@ -3027,11 +2913,8 @@ AllocateAnsiColor(XtermWidget xw, XColor def; if (xtermAllocColor(xw, &def, spec)) { - if ( -#if OPT_COLOR_RES - res->mode == True && -#endif - EQL_COLOR_RES(res, def.pixel)) { + if (res->mode == True && + EQL_COLOR_RES(res, def.pixel)) { result = 0; } else { result = 1; @@ -3045,11 +2928,9 @@ AllocateAnsiColor(XtermWidget xw, def.green, def.blue, def.pixel)); -#if OPT_COLOR_RES if (!res->mode) result = 0; res->mode = True; -#endif } } else { TRACE(("AllocateAnsiColor %s (failed)\n", spec)); @@ -3058,7 +2939,6 @@ AllocateAnsiColor(XtermWidget xw, return (result); } -#if OPT_COLOR_RES Pixel xtermGetColorRes(XtermWidget xw, ColorRes * res) { @@ -3086,7 +2966,6 @@ xtermGetColorRes(XtermWidget xw, ColorRe } return result; } -#endif static int ChangeOneAnsiColor(XtermWidget xw, int color, const char *name) @@ -3225,16 +3104,15 @@ ResetAnsiColorRequest(XtermWidget xw, ch return repaint; } #else -#define allocateClosestRGB(xw, cmap, def) 0 -#define allocateExactRGB(xw, cmap, def) XAllocColor(TScreenOf(xw)->display, cmap, def) +#define allocateClosestRGB(xw, def) 0 #endif /* OPT_ISO_COLORS */ Boolean allocateBestRGB(XtermWidget xw, XColor *def) { - Colormap cmap = xw->core.colormap; - - return allocateExactRGB(xw, cmap, def) || allocateClosestRGB(xw, cmap, def); + (void) xw; + (void) def; + return AllocOneColor(xw, def) || allocateClosestRGB(xw, def); } static Boolean @@ -3247,7 +3125,7 @@ xtermAllocColor(XtermWidget xw, XColor * if (have == 0 || have > MAX_U_STRING) { if (resource.reportColors) { - printf("color (ignored, length %lu)\n", (unsigned long)have); + printf("color (ignored, length %lu)\n", (unsigned long) have); } } else if (XParseColor(screen->display, cmap, spec, def)) { XColor save_def = *def; @@ -3284,7 +3162,7 @@ int xtermClosestColor(XtermWidget xw, int find_red, int find_green, int find_blue) { int result = -1; -#if OPT_COLOR_RES && OPT_ISO_COLORS +#if OPT_ISO_COLORS int n; int best_index = -1; unsigned long best_value = 0; @@ -3319,6 +3197,7 @@ xtermClosestColor(XtermWidget xw, int fi } TRACE(("...best match at %d with diff %lx\n", best_index, best_value)); result = best_index; + #else (void) xw; (void) find_red; @@ -3332,19 +3211,48 @@ xtermClosestColor(XtermWidget xw, int fi int getDirectColor(XtermWidget xw, int red, int green, int blue) { -#define nRGB(name,shift) \ - ((unsigned long)(name << xw->rgb_shifts[shift]) \ - & xw->visInfo->name ##_mask) - MyPixel result = (MyPixel) (nRGB(red, 0) | nRGB(green, 1) | nRGB(blue, 2)); + Pixel result = 0; + +#define getRGB(name,shift) \ + do { \ + Pixel value = (Pixel) name & 0xff; \ + if (xw->rgb_widths[shift] < 8) { \ + value >>= (int) (8 - xw->rgb_widths[shift]); \ + } \ + value <<= xw->rgb_shifts[shift]; \ + value &= xw->visInfo->name ##_mask; \ + result |= value; \ + } while (0) + + getRGB(red, 0); + getRGB(green, 1); + getRGB(blue, 2); + +#undef getRGB + return (int) result; } static void formatDirectColor(char *target, XtermWidget xw, unsigned value) { -#define fRGB(name, shift) \ - (value & xw->visInfo->name ## _mask) >> xw->rgb_shifts[shift] - sprintf(target, "%lu:%lu:%lu", fRGB(red, 0), fRGB(green, 1), fRGB(blue, 2)); + Pixel result[3]; + +#define getRGB(name, shift) \ + do { \ + result[shift] = value & xw->visInfo->name ## _mask; \ + result[shift] >>= xw->rgb_shifts[shift]; \ + if (xw->rgb_widths[shift] < 8) \ + result[shift] <<= (int) (8 - xw->rgb_widths[shift]); \ + } while(0) + + getRGB(red, 0); + getRGB(green, 1); + getRGB(blue, 2); + +#undef getRGB + + sprintf(target, "%lu:%lu:%lu", result[0], result[1], result[2]); } #endif /* OPT_DIRECT_COLOR */ @@ -3688,7 +3596,6 @@ ReportColorRequest(XtermWidget xw, int n if (AllowColorOps(xw, ecGetColor)) { XColor color; - Colormap cmap = xw->core.colormap; char buffer[80]; /* @@ -3700,7 +3607,7 @@ ReportColorRequest(XtermWidget xw, int n GetOldColors(xw); color.pixel = xw->work.oldColors->colors[ndx]; - XQueryColor(TScreenOf(xw)->display, cmap, &color); + (void) QueryOneColor(xw, &color); sprintf(buffer, "%d;rgb:%04x/%04x/%04x", i + 10, color.red, color.green, @@ -3841,8 +3748,6 @@ ResetColorsRequest(XtermWidget xw, (void) code; TRACE(("ResetColorsRequest code=%d\n", code)); - -#if OPT_COLOR_RES if (GetOldColors(xw)) { ScrnColors newColors; const char *thisName; @@ -3868,7 +3773,6 @@ ResetColorsRequest(XtermWidget xw, } result = True; } -#endif return result; } @@ -7056,7 +6960,9 @@ die_callback(Widget w GCC_UNUSED, XtPointer client_data GCC_UNUSED, XtPointer call_data GCC_UNUSED) { - TRACE(("die_callback %p\n", die_callback)); + TRACE(("die_callback client=%p, call=%p\n", + (void *) client_data, + (void *) call_data)); TRACE_SM_PROPS(); NormalExit(); } @@ -7266,7 +7172,7 @@ findFontParams(int argc, char **argv) } static int -insertFontParams(XtermWidget xw, int *targetp, Boolean first) +insertFontParams(XtermWidget xw, int *targetp, Bool first) { int changed = 0; int n; Index: xsrc/external/mit/xterm/dist/ptyx.h diff -u xsrc/external/mit/xterm/dist/ptyx.h:1.17 xsrc/external/mit/xterm/dist/ptyx.h:1.18 --- xsrc/external/mit/xterm/dist/ptyx.h:1.17 Sun Jul 11 00:31:54 2021 +++ xsrc/external/mit/xterm/dist/ptyx.h Sun Jan 9 09:17:31 2022 @@ -1,4 +1,4 @@ -/* $XTermId: ptyx.h,v 1.1032 2021/06/07 19:29:11 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.1041 2021/11/08 22:23:28 tom Exp $ */ /* * Copyright 1999-2020,2021 by Thomas E. Dickey @@ -552,10 +552,6 @@ typedef enum { #define OPT_COLOR_CLASS 1 /* true if xterm uses separate color-resource classes */ #endif -#ifndef OPT_COLOR_RES -#define OPT_COLOR_RES 1 /* true if xterm delays color-resource evaluation */ -#endif - #ifndef OPT_DABBREV #define OPT_DABBREV 0 /* dynamic abbreviations */ #endif @@ -616,10 +612,6 @@ typedef enum { #define OPT_EXTRA_PASTE 1 #endif -#ifndef OPT_FIFO_LINES -#define OPT_FIFO_LINES 1 /* optimize save-lines feature using FIFO */ -#endif - #ifndef OPT_FOCUS_EVENT #define OPT_FOCUS_EVENT 1 /* focus in/out events */ #endif @@ -752,10 +744,6 @@ typedef enum { #define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ #endif -#ifndef OPT_SAVE_LINES -#define OPT_SAVE_LINES OPT_FIFO_LINES /* optimize save-lines feature */ -#endif - #ifndef OPT_SCO_FUNC_KEYS #define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ #endif @@ -860,21 +848,6 @@ typedef enum { #define OPT_AIX_COLORS 0 #endif -#if OPT_COLOR_RES && !OPT_ISO_COLORS -/* You must have ANSI/ISO colors to support ColorRes logic */ -#undef OPT_COLOR_RES -#define OPT_COLOR_RES 0 -#endif - -#if OPT_256_COLORS && (OPT_WIDE_CHARS || OPT_RENDERFONT || OPT_XMC_GLITCH) -/* It's actually more complicated than that - but by trimming options you can - * have 256 color resources though. - */ -#define OPT_COLOR_RES2 1 -#else -#define OPT_COLOR_RES2 0 -#endif - #if OPT_PC_COLORS && !OPT_ISO_COLORS /* You must have ANSI/ISO colors to support PC colors */ #undef OPT_PC_COLORS @@ -1532,13 +1505,8 @@ typedef enum { #define COLOR_RES_CLASS(root) XtCForeground #endif -#if OPT_COLOR_RES #define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) #define COLOR_RES2(name,class,offset,value) Sres(name, class, offset.resource, value) -#else -#define COLOR_RES(root,offset,value) Cres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset, value) -#define COLOR_RES2(name,class,offset,value) Cres(name, class, offset, value) -#endif #define CLICK_RES_NAME(count) "on" count "Clicks" #define CLICK_RES_CLASS(count) "On" count "Clicks" @@ -2096,16 +2064,12 @@ typedef enum { #define NUM_POPUP_MENUS 4 -#if OPT_COLOR_RES typedef struct { String resource; Pixel value; unsigned short red, green, blue; int mode; /* -1=invalid, 0=unset, 1=set */ } ColorRes; -#else -#define ColorRes Pixel -#endif /* these are set in getPrinterFlags */ typedef struct { @@ -3021,6 +2985,13 @@ typedef enum { /* legal values for scr , ebLast } ebMetaModeTypes; +typedef enum { /* legal values for misc.cdXtraScroll */ + edFalse = 0 + , edTrue = 1 + , edTrim = 2 + , edLast +} edXtraScrollTypes; + #define NAME_OLD_KT " legacy" #if OPT_HP_FUNC_KEYS @@ -3139,10 +3110,12 @@ typedef struct _Misc { Boolean useRight; #endif Boolean titeInhibit; - Boolean tiXtraScroll; /* scroll on ti/te */ - Boolean cdXtraScroll; /* scroll on cd (clear-display) */ Boolean appcursorDefault; Boolean appkeypadDefault; + int cdXtraScroll; /* scroll on cd (clear-display) */ + char *cdXtraScroll_s; + int tiXtraScroll; /* scroll on ti/te (init/end-cup) */ + char *tiXtraScroll_s; #if OPT_INPUT_METHOD char* f_x; /* font for XIM */ char* input_method; @@ -3216,6 +3189,7 @@ typedef struct _Work { unsigned meta_mods; /* modifier for Meta_L or Meta_R */ #endif XtermFontNames fonts; + Boolean force_wideFont; /* true to single-step wideFont */ #if OPT_RENDERFONT Boolean render_font; unsigned max_fontsets; @@ -3409,7 +3383,6 @@ typedef struct _TekWidgetRec { /* The following attribute is used in the argument of xtermSpecialFont etc */ #define NORESOLUTION DrawBIT(5) /* find the font without resolution */ - /* * Groups of attributes */ @@ -3436,6 +3409,11 @@ typedef struct _TekWidgetRec { #endif /* + * Sixel-scrolling is backwards, perhaps from an error in the hardware design. + */ +#define SixelScrolling(xw) (!((xw)->keyboard.flags & MODE_DECSDM)) + +/* * Per-line flags */ #define LINEWRAPPED AttrBIT(0) Index: xsrc/external/mit/xterm/dist/xterm.h diff -u xsrc/external/mit/xterm/dist/xterm.h:1.5 xsrc/external/mit/xterm/dist/xterm.h:1.6 --- xsrc/external/mit/xterm/dist/xterm.h:1.5 Sun Jul 11 00:31:54 2021 +++ xsrc/external/mit/xterm/dist/xterm.h Sun Jan 9 09:17:31 2022 @@ -1,4 +1,4 @@ -/* $XTermId: xterm.h,v 1.893 2021/06/06 23:14:40 Stelios.Bounanos Exp $ */ +/* $XTermId: xterm.h,v 1.902 2021/09/19 18:27:35 tom Exp $ */ /* * Copyright 1999-2020,2021 by Thomas E. Dickey @@ -963,10 +963,12 @@ extern void report_char_class(XtermWidge #define WideCells(n) (((IChar)(n) >= first_widechar) ? my_wcwidth((wchar_t) (n)) : 1) #define isWideFrg(n) (((n) == HIDDEN_CHAR) || (WideCells((n)) == 2)) #define isWide(n) (((IChar)(n) >= first_widechar) && isWideFrg(n)) -#define CharWidth(n) (((n) < 256) ? (IsLatin1(n) ? 1 : 0) : my_wcwidth((wchar_t) (n))) +#define CharWidth(screen, n) ((!((screen)->utf8_mode) && ((n) < 256)) \ + ? (IsLatin1(n) ? 1 : 0) \ + : my_wcwidth((wchar_t) (n))) #else #define WideCells(n) 1 -#define CharWidth(n) (IsLatin1(n) ? 1 : 0) +#define CharWidth(screen, n) (IsLatin1(n) ? 1 : 0) #endif /* cachedCgs.c */ @@ -1165,6 +1167,7 @@ extern Window WMFrameWindow (XtermWidget extern XtInputMask xtermAppPending (void); extern XrmOptionDescRec * sortedOptDescs (XrmOptionDescRec *, Cardinal); extern XtermWidget getXtermWidget (Widget /* w */); +extern XVisualInfo *getVisualInfo (XtermWidget /* xw */); extern char *udk_lookup (XtermWidget /* xw */, int /* keycode */, int * /* len */); extern char *xtermEnvEncoding (void); extern char *xtermFindShell (char * /* leaf */, Bool /* warning */); @@ -1175,7 +1178,6 @@ extern int ResetAnsiColorRequest (XtermW extern int XStrCmp (char * /* s1 */, char * /* s2 */); extern int creat_as (uid_t /* uid */, gid_t /* gid */, Bool /* append */, char * /* pathname */, unsigned /* mode */); extern int getVisualDepth (XtermWidget /* xw */); -extern int getVisualInfo (XtermWidget /* xw */); extern int ignore_x11_error(Display * /* dpy */, XErrorEvent * /* event */); extern int open_userfile (uid_t /* uid */, gid_t /* gid */, char * /* path */, Bool /* append */); extern int update_winsize(int /* fd */, int /* rows */, int /* cols */, int /* height */, int /* width */); @@ -1263,6 +1265,14 @@ extern char *ProcGetCWD(pid_t /* pid */) #define ProcGetCWD(pid) NULL #endif +#if OPT_ISO_COLORS +extern Boolean AllocOneColor(XtermWidget /* xw */, XColor * /* def */); +extern Boolean QueryOneColor(XtermWidget /* xw */, XColor * /* def */); +#else +#define AllocOneColor(xw, def) ((def)->pixel = 0) +#define QueryOneColor(xw, def) ((def)->red = (def)->green = (def)->blue = 0) +#endif + #if OPT_MAXIMIZE extern int QueryMaximize (XtermWidget /* xw */, unsigned * /* width */, unsigned * /* height */); extern void HandleDeIconify PROTO_XT_ACTIONS_ARGS; @@ -1562,7 +1572,7 @@ extern void ChangeColors (XtermWidget / extern void ClearRight (XtermWidget /* xw */, int /* n */); extern void ClearScreen (XtermWidget /* xw */); extern void DeleteChar (XtermWidget /* xw */, unsigned /* n */); -extern void DeleteLine (XtermWidget /* xw */, int /* n */); +extern void DeleteLine (XtermWidget /* xw */, int /* n */, Bool /* canSave */); extern void FlushScroll (XtermWidget /* xw */); extern void GetColors (XtermWidget /* xw */, ScrnColors * /* pColors */); extern void InsertChar (XtermWidget /* xw */, unsigned /* n */); @@ -1572,7 +1582,7 @@ extern void ReverseVideo (XtermWidget /* extern void WriteText (XtermWidget /* xw */, IChar * /* str */, Cardinal /* len */); extern void decode_keyboard_type (XtermWidget /* xw */, struct XTERM_RESOURCE * /* rp */); extern void decode_wcwidth (XtermWidget /* xw */); -extern void do_cd_xtra_scroll (XtermWidget /* xw */); +extern void do_cd_xtra_scroll (XtermWidget /* xw */, int /* param */); extern void do_erase_display (XtermWidget /* xw */, int /* param */, int /* mode */); extern void do_erase_char (XtermWidget /* xw */, int /* param */, int /* mode */); extern void do_erase_line (XtermWidget /* xw */, int /* param */, int /* mode */); @@ -1615,18 +1625,11 @@ extern void ClearCurBackground (XtermWid #define xtermColorPair(xw) makeColorPair(xw) -#if OPT_COLOR_RES #define GET_COLOR_RES(xw, res) xtermGetColorRes(xw, &(res)) #define SET_COLOR_RES(res,color) (res)->value = color #define EQL_COLOR_RES(res,color) (res)->value == color #define T_COLOR(v,n) (v)->Tcolors[n].value extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */); -#else -#define GET_COLOR_RES(xw, res) res -#define SET_COLOR_RES(res,color) *res = color -#define EQL_COLOR_RES(res,color) *res == color -#define T_COLOR(v,n) (v)->Tcolors[n] -#endif #define ExtractForeground(color) (unsigned) GetCellColorFG(color) #define ExtractBackground(color) (unsigned) GetCellColorBG(color) @@ -1693,7 +1696,7 @@ extern void discardRenderDraw(TScreen * #define extract_bg(xw, color, flags) (unsigned) (xw)->cur_background /* FIXME: Reverse-Video? */ -#define T_COLOR(v,n) (v)->Tcolors[n] +#define T_COLOR(v,n) (v)->Tcolors[n].value #define xtermColorPair(xw) 0 #define checkVeryBoldColors(flags, fg) /* nothing */ Index: xsrc/external/mit/xterm/dist/xterm.man diff -u xsrc/external/mit/xterm/dist/xterm.man:1.19 xsrc/external/mit/xterm/dist/xterm.man:1.20 --- xsrc/external/mit/xterm/dist/xterm.man:1.19 Sun Jul 11 00:31:54 2021 +++ xsrc/external/mit/xterm/dist/xterm.man Sun Jan 9 09:17:31 2022 @@ -1,5 +1,5 @@ '\" t -.\" $XTermId: xterm.man,v 1.848 2021/06/07 21:00:31 tom Exp $ +.\" $XTermId: xterm.man,v 1.852 2021/09/22 23:29:09 tom Exp $ .\" .\" Copyright 1996-2020,2021 by Thomas E. Dickey .\" @@ -2661,6 +2661,22 @@ the whole screen. Like \fBtiXtraScroll\fP, the intent of this option is to provide a picture of the full-screen application's display on the scrollback before wiping out the text. +.IP +\fI\*N\fP accepts either a keyword (ignoring case) +or the number shown in parentheses: +.RS +.TP +false (0) +nothing is added to the scrollback. +.TP +true (1) +the current screen is added to the scrollback. +.TP +trim (2) +the current screen is added to the scrollback, +but repeated blank lines are trimmed (reduced to a single blank line). +.RE +.IP The default for this resource is \*(``false\*(''. .TP 8 .B "charClass\fP (class\fB CharClass\fP)" @@ -5079,14 +5095,14 @@ If \fI\*n\fR is configured to support SI this resource tells it whether to scroll up one line at a time when sixels would be written past the bottom line on the window. -The default is \*(``false\*(''. +The default is \*(``false\*('' which enables scrolling. .TP 8 .B "sixelScrollsRight\fP (class\fB SixelScrollsRight\fP)" If \fI\*n\fR is configured to support SIXEL graphics, this resource tells it whether to scroll to the right as needed to keep the current position visible rather than truncate the plot on the on the right. -The default is \*(``false\*(''. +The default is \*(``false\*('' which disables scrolling. .TP 8 .B "tekGeometry\fP (class\fB Geometry\fP)" Specifies the preferred size and position of the Tektronix window. @@ -5112,11 +5128,28 @@ The default is \*(``false\*(''. .TP 8 .B "tiXtraScroll\fP (class\fB TiXtraScroll\fP)" Specifies whether \fI\*n\fP should scroll to a new page when processing -the \fIti\fP termcap entry, i.e., the private modes 47, 1047 or 1049. +the \fIti\fP or \fIte\fP termcap strings, +i.e., the private modes 47, 1047 or 1049. This is only in effect if \fBtiteInhibit\fP is \*(``true\*('', because the intent of this option is to provide a picture of the full-screen application's display on the scrollback without wiping out the text that would be shown before the application was initialized. +.IP +\fI\*N\fP accepts either a keyword (ignoring case) +or the number shown in parentheses: +.RS +.TP +false (0) +nothing is added to the scrollback. +.TP +true (1) +the current screen is added to the scrollback. +.TP +trim (2) +the current screen is added to the scrollback, +but repeated blank lines are trimmed (reduced to a single blank line). +.RE +.IP The default for this resource is \*(``false\*(''. .TP 8 .B "titeInhibit\fP (class\fB TiteInhibit\fP)" @@ -8867,7 +8900,7 @@ Steve Pitschke (Stellar), Ron Newman (MI Consortium), Dave Serisky (HP), Jonathan Kamens (MIT-Athena). .PP Beginning with XFree86, there were far more identifiable contributors. -The \fITHANKS\fP file in \fI\*n\fP's source lists 228 in September 2020. +The \fITHANKS\fP file in \fI\*n\fP's source lists 234 in August 2021. Keep in mind these: Jason Bacon, Jens Schweikhardt, Index: xsrc/external/mit/xterm/include/xtermcfg.h diff -u xsrc/external/mit/xterm/include/xtermcfg.h:1.18 xsrc/external/mit/xterm/include/xtermcfg.h:1.19 --- xsrc/external/mit/xterm/include/xtermcfg.h:1.18 Mon May 10 12:29:11 2021 +++ xsrc/external/mit/xterm/include/xtermcfg.h Sun Jan 9 09:17:31 2022 @@ -1,5 +1,5 @@ /* xtermcfg.h. Generated automatically by configure. */ -/* $XTermId: xtermcfg.hin,v 1.220 2020/10/05 22:42:06 tom Exp $ */ +/* $XTermId: xtermcfg.hin,v 1.223 2021/08/22 20:00:07 tom Exp $ */ /* * Copyright 1997-2019,2020 by Thomas E. Dickey @@ -89,6 +89,7 @@ /* #undef HAVE_NCURSES_TERM_H */ /* AC_CHECK_HEADERS(ncurses/term.h) */ #define HAVE_PATHS_H 1 /* CF_LASTLOG */ /* #undef HAVE_PCRE2POSIX_H */ /* CF_WITH_PCRE2 */ +/* #undef HAVE_PCRE2REGCOMP */ /* CF_WITH_PCRE2 */ /* #undef HAVE_PCREPOSIX_H */ /* CF_WITH_PCRE */ #define HAVE_POSIX_OPENPT 1 /* CF_FUNC_GRANTPT */ #define HAVE_POSIX_SAVED_IDS 1 /* CF_POSIX_SAVED_IDS */ @@ -167,7 +168,6 @@ #define OPT_DIRECT_COLOR 1 /* CF_ARG_ENABLE(direct-color) */ /* #undef OPT_DOUBLE_BUFFER */ /* CF_ARG_ENABLE(double-buffer) */ /* #undef OPT_EXEC_XTERM */ /* CF_ARG_ENABLE(exec-xterm) */ -#define OPT_FIFO_LINES 1 /* CF_ARG_ENABLE(fifo-lines) */ #define OPT_GRAPHICS 1 /* CF_ARG_ENABLE(graphics) */ /* #undef OPT_HIGHLIGHT_COLOR */ /* CF_ARG_DISABLE(highlighting) */ /* #undef OPT_HP_FUNC_KEYS */ /* CF_ARG_ENABLE(hp-fkeys) */