--- rxvt-unicode/src/xdefaults.C 2005/02/03 10:24:10 1.49 +++ rxvt-unicode/src/xdefaults.C 2006/01/16 09:28:17 1.79 @@ -6,7 +6,7 @@ * Copyright (c) 1994 Robert Nation * - original version * Copyright (c) 1997,1998 mj olesen - * Copyright (c) 2003-2004 Marc Lehmann + * Copyright (c) 2003-2006 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,10 +22,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------* - * get resources from ~/.Xdefaults or ~/.Xresources with the memory-saving - * default or with XGetDefault() (#define USE_XGETDEFAULT) - *----------------------------------------------------------------------*/ #include "../config.h" /* NECESSARY */ #include "rxvt.h" /* NECESSARY */ @@ -35,9 +31,12 @@ #include "keyboard.h" #endif -/* #define DEBUG_RESOURCES */ +/* place holders used for parsing command-line options */ +#define Optflag_Reverse 0x40000000UL +#define Optflag_Boolean 0x80000000UL +#define Optflag_mask 0x3fffffffUL -static const char *const xnames[2] = { ".Xdefaults", ".Xresources" }; +/* #define DEBUG_RESOURCES */ /*{{{ monolithic option/resource structure: */ /* @@ -60,7 +59,7 @@ /* BOOL () - regular boolean `-/+' flag */ #define BOOL(rsp, kw, opt, flag, desc) \ - { (Opt_Boolean| (flag)), (rsp), (kw), (opt), NULL, (desc)} + { (Optflag_Boolean | (flag)), (rsp), (kw), (opt), NULL, (desc)} /* SWCH () - `-' flag */ #define SWCH(opt, flag, desc) \ @@ -70,10 +69,10 @@ #define optList_strlen(i) \ (optList[i].flag ? 0 : (optList[i].arg ? strlen (optList[i].arg) : 1)) #define optList_isBool(i) \ - (optList[i].flag & Opt_Boolean) + (optList[i].flag & Optflag_Boolean) #define optList_isReverse(i) \ - (optList[i].flag & Opt_Reverse) -#define optList_size() \ + (optList[i].flag & Optflag_Reverse) +#define optList_size \ (sizeof (optList) / sizeof (optList[0])) static const struct @@ -98,7 +97,7 @@ BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"), BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"), BOOL (Rs_pastableTabs, "pastableTabs", "ptab", Opt_pastableTabs, "tab characters are pastable"), -#ifdef HAVE_SCROLLBARS +#if HAVE_SCROLLBARS RSTRG (Rs_scrollstyle, "scrollstyle", "mode"), BOOL (Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"), BOOL (Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, "scrollbar right"), @@ -107,21 +106,21 @@ STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"), #endif BOOL (Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, NULL), - BOOL (Rs_scrollTtyOutput, NULL, "si", Opt_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), + BOOL (Rs_scrollTtyOutput, NULL, "si", Optflag_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress"), BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, "scroll-with-buffer"), -#ifdef TRANSPARENT +#if TRANSPARENT BOOL (Rs_transparent, "inheritPixmap", "ip", Opt_transparent, "inherit parent pixmap"), - BOOL (Rs_transparent_all, "inheritPixmapforce", "ipf", Opt_transparent_all, "forcefully inherit root pixmap"), SWCH ("tr", Opt_transparent, NULL), -#if TINTING +# if TINTING STRG (Rs_color + Color_tint, "tintColor", "tint", "color", "tint color"), +# endif #endif +#if OFF_FOCUS_FADING + STRG (Rs_fade, "fading", "fade", "%", "fade colors x% percent when rxvt-unicode is losing focus"), + STRG (Rs_color + Color_fade, "fadeColor", "fadecolor", "color", "target color for off-focus fading"), #endif -#ifdef OFF_FOCUS_FADING - STRG (Rs_fade, "fading", "fade", "%", "make colors x% darker when rxvt-unicode is losing focus."), -#endif -#ifdef TINTING +#if TINTING STRG (Rs_shade, "shading", "sh", "%", "shade background by x% when tinting."), #endif BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"), @@ -140,8 +139,9 @@ #if ENABLE_FRILLS BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection"), BOOL (Rs_insecure, "insecure", "insecure", Opt_insecure, "enable possibly insecure escape sequences"), + BOOL (Rs_cursorUnderline, "cursorUnderline", "uc", Opt_cursorUnderline, "underline cursor"), #endif -#ifdef CURSOR_BLINK +#if CURSOR_BLINK BOOL (Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"), #endif #ifdef POINTER_BLANK @@ -157,7 +157,6 @@ RSTRG (Rs_color + minCOLOR + 5, "color5", "color"), RSTRG (Rs_color + minCOLOR + 6, "color6", "color"), RSTRG (Rs_color + minCOLOR + 7, "color7", "color"), -#ifndef NO_BRIGHTCOLOR RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"), RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"), RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"), @@ -166,7 +165,6 @@ RSTRG (Rs_color + minBrightCOLOR + 5, "color13", "color"), RSTRG (Rs_color + minBrightCOLOR + 6, "color14", "color"), RSTRG (Rs_color + minBrightCOLOR + 7, "color15", "color"), -#endif /* NO_BRIGHTCOLOR */ #ifndef NO_BOLD_UNDERLINE_REVERSE RSTRG (Rs_color + Color_BD, "colorBD", "color"), RSTRG (Rs_color + Color_IT, "colorIT", "color"), @@ -206,6 +204,7 @@ STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"), STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"), + BOOL (Rs_intensityStyles, "intensityStyles", "is", Opt_intensityStyles, "font styles imply intensity changes"), #endif #ifdef USE_XIM STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), @@ -218,12 +217,19 @@ STRG (Rs_title, NULL, "T", NULL, NULL), /* short form */ STRG (Rs_iconName, "iconName", "n", "string", "icon name for window"), STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"), +#if ENABLE_XEMBED + STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"), +#endif #if ENABLE_FRILLS + RSTRG (Rs_transient_for, "transient-for", "windowid"), + STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), + BOOL (Rs_hold, "hold", "hold", Opt_hold, "retain window after shell exit"), STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), + BOOL (Rs_skipBuiltinGlyphs, "skipBuiltinGlyphs", "sbg", Opt_skipBuiltinGlyphs, "do not use internal glyphs"), STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), #endif #ifdef POINTER_BLANK @@ -248,7 +254,13 @@ BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, "enable secondary screen"), BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, "enable secondary screen scroll"), #endif -#if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT) +#if ENABLE_PERL + RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),TODO + RSTRG (Rs_perl_eval, "perl-eval", "perl-eval"), // "string", "code to be evaluated after all extensions have been loaded"),TODO + RSTRG (Rs_perl_ext_1, "perl-ext-common", "string"), //, "colon-separated list of perl extensions to enable"),TODO + STRG (Rs_perl_ext_2, "perl-ext", "pe", "string", "colon-separated list of perl extensions to enable for this instance"), +#endif +#ifndef NO_RESOURCES INFO ("xrm", "string", "X resource"), #endif INFO ("e", "command arg ...", "command to execute") @@ -263,6 +275,9 @@ static const char releasestring[] = "rxvt-unicode (" RXVTNAME ") v" VERSION " - released: " DATE "\n"; static const char optionsstring[] = "options: " +#if ENABLE_PERL + "perl," +#endif #if XFT "xft," #endif @@ -355,9 +370,6 @@ #if EIGHT_BIT_CONTROLS "8bitctrls," #endif -#if !defined(NO_STRINGS) - "strings," -#endif #if defined(ENABLE_FRILLS) "frills," #endif @@ -384,12 +396,6 @@ #endif #if defined(NO_RESOURCES) "NoResources" -#else -# if defined(USE_XGETDEFAULT) - "XGetDefaults" -# else - ".Xdefaults" -# endif #endif "\nUsage: "; /* Usage */ @@ -409,7 +415,7 @@ case 0: /* brief listing */ rxvt_log (" [-help] [--help]\n"); - for (col = 1, i = 0; i < optList_size (); i++) + for (col = 1, i = 0; i < optList_size; i++) if (optList[i].desc != NULL) { int len = 0; @@ -442,7 +448,7 @@ case 1: /* full command-line listing */ rxvt_log (" [options] [-e command args]\n\nwhere options include:\n"); - for (i = 0; i < optList_size (); i++) + for (i = 0; i < optList_size; i++) if (optList[i].desc != NULL) { #ifdef DEBUG_STRICT @@ -463,7 +469,7 @@ rxvt_log (" [options] [-e command args]\n\n" "where resources (long-options) include:\n"); - for (i = 0; i < optList_size (); i++) + for (i = 0; i < optList_size; i++) if (optList[i].kw != NULL) rxvt_log (" %s: %*s%s\n", optList[i].kw, @@ -494,8 +500,8 @@ for (i = 1; i < argc; i++) { - unsigned int entry, longopt = 0; - const char *flag, *opt; + unsigned int entry, longopt = 0; + const char *flag, *opt; opt = argv[i]; #ifdef DEBUG_RESOURCES @@ -526,13 +532,13 @@ rxvt_usage (0); /* feature: always try to match long-options */ - for (entry = 0; entry < optList_size (); entry++) + for (entry = 0; entry < optList_size; entry++) if ((optList[entry].kw && !strcmp (opt, optList[entry].kw)) || (!longopt && optList[entry].opt && !strcmp (opt, optList[entry].opt))) break; - if (entry < optList_size ()) + if (entry < optList_size) { if (optList_isReverse (entry)) flag = flag == On ? Off : On; @@ -555,10 +561,7 @@ fprintf (stderr, "boolean (%s,%s) = %s\n", optList[entry].opt, optList[entry].kw, flag); #endif - if (flag == On) - options |= (optList[entry].flag); - else - options &= ~ (optList[entry].flag); + set_option (optList[entry].flag & Optflag_mask, flag == On); if (optList[entry].doff != -1) rs[optList[entry].doff] = flag; @@ -677,7 +680,7 @@ return 0; str += n; /* skip `keysym.' */ - if ((pmodend = strchr (str, ':')) < str) + if (!(pmodend = strchr (str, ':'))) return -1; } else @@ -765,364 +768,111 @@ } # endif /* KEYSYM_RESOURCE */ +#endif /* NO_RESOURCES */ -# ifndef USE_XGETDEFAULT -/*{{{ rxvt_get_xdefaults () */ -/* - * the matching algorithm used for memory-save fake resources - */ -void -rxvt_term::get_xdefaults (FILE *stream, const char *name) +static char * +get_res (XrmDatabase database, const char *program, const char *option) { - unsigned int len; - char *str, buffer[256]; - - if (stream == NULL) - return; - - len = strlen (name); - while ((str = fgets (buffer, sizeof (buffer), stream)) != NULL) - { - unsigned int entry, n; - - while (*str && isspace (*str)) - str++; /* leading whitespace */ + char resource[512]; + char *type; + XrmValue result; - if ((str[len] != '*' && str[len] != '.') - || (len && strncmp (str, name, len))) - continue; - str += (len + 1); /* skip `name*' or `name.' */ + snprintf (resource, sizeof (resource), "%s.%s", program, option); + XrmGetResource (database, resource, resource, &type, &result); -# ifdef KEYSYM_RESOURCE - if (!parse_keysym (str, NULL)) -# endif /* KEYSYM_RESOURCE */ - for (entry = 0; entry < optList_size (); entry++) - { - const char *kw = optList[entry].kw; + return result.addr; +} - if (kw == NULL) - continue; +const char * +rxvt_term::x_resource (const char *name) +{ + XrmDatabase database = XrmGetDatabase (display->display); - n = strlen (kw); - if (str[n] == ':' && rxvt_Str_match (str, kw)) - { - /* skip `keyword:' */ - str += n + 1; - rxvt_Str_trim (str); - n = strlen (str); - if (n && rs[optList[entry].doff] == NULL) - { - /* not already set */ - int s; - char *p = 0; - - for (int o = 0;;) - { - p = (char *)rxvt_realloc (p, o + n + 1); - memcpy (p + o, str, n); - o += n; - p[o] = 0; - - if (o == 0 || p[o - 1] != '\\') // continuation line - break; - - o--; // eat "\" - - if ((str = fgets (buffer, sizeof (buffer), stream)) == NULL) - break; - - rxvt_Str_trim (str); - n = strlen (str); - } - - rs[optList[entry].doff] = p; - allocated.push_back (p); - - if (optList_isBool (entry)) - { - s = strcasecmp (str, "TRUE") == 0 - || strcasecmp (str, "YES") == 0 - || strcasecmp (str, "ON") == 0 - || strcasecmp (str, "1") == 0; - - if (optList_isReverse (entry)) - s = !s; - - if (s) - options |= optList[entry].flag; - else - options &= ~optList[entry].flag; - } - } + const char *p = get_res (database, rs[Rs_name], name); + const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name); - break; - } - } + if (p == NULL || (p0 && strcmp (p, p0) == 0)) + { + p = get_res (database, RESCLASS, name); +#ifdef RESFALLBACK + if (p == NULL || (p0 && strcmp (p, p0) == 0)) + p = get_res (database, RESFALLBACK, name); +#endif } - rewind (stream); -} + if (p == NULL && p0) + p = p0; -/*}}} */ -# endif /* ! USE_XGETDEFAULT */ -#endif /* NO_RESOURCES */ + return p; +} -/*{{{ read the resources files */ -/* - * using XGetDefault () or the hand-rolled replacement - */ -/* ARGSUSED */ void -rxvt_term::extract_resources (Display *display __attribute__ ((unused)), const char *name) +rxvt_term::extract_resources () { #ifndef NO_RESOURCES + /* + * Query resources for options that affect us + */ + for (int entry = 0; entry < optList_size; entry++) + { + int s; + const char *kw = optList[entry].kw; -# if defined XAPPLOADDIR -# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) - /* Compute the path of the possibly available localized Rxvt file */ - char *localepath = NULL; - - if (locale != NULL) - { /* XXX: must limit length of string */ - localepath = (char *)rxvt_malloc (256); - sprintf (localepath, XAPPLOADDIRLOCALE "/" RESCLASS, - (int) (258 - sizeof (XAPPLOADDIRLOCALE) - sizeof (RESCLASS)), - locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ - } + if (kw == NULL || rs[optList[entry].doff] != NULL) + continue; // previously set - { -# endif -# endif + const char *p = x_resource (kw); -# ifdef USE_XGETDEFAULT - /* - * get resources using the X library function - */ - int entry; - -# ifdef XrmEnumOneLevel - int i; - char *displayResource, *xe; - XrmName name_prefix[3]; - XrmClass class_prefix[3]; - XrmDatabase database, rdb1; - char fname[1024]; - - XrmInitialize (); - database = NULL; - - /* Get any Xserver defaults */ - - displayResource = XResourceManagerString (display); - if (displayResource != NULL) - database = XrmGetStringDatabase (displayResource); + if (p) + { + p = strdup (p); + allocated.push_back ((void *)p); + rs[optList[entry].doff] = p; -# ifdef HAVE_EXTRA_XRESOURCE_FILES - /* Add in ~/.Xdefaults or ~/.Xresources */ - { - char *ptr; + if (optList_isBool (entry)) + { + s = strcasecmp (p, "TRUE") == 0 + || strcasecmp (p, "YES") == 0 + || strcasecmp (p, "ON") == 0 + || strcasecmp (p, "1") == 0; - if ((ptr = (char *)getenv ("HOME")) == NULL) - ptr = "."; + if (optList_isReverse (entry)) + s = !s; - for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++) - { - sprintf (fname, "%-.*s/%s", sizeof (fname) - strlen (xnames[i]) - 2, - ptr, xnames[i]); - if ((rdb1 = XrmGetFileDatabase (fname))) - { - XrmMergeDatabases (rdb1, &database); -# ifndef HAVE_BOTH_XRESOURCE_FILES - break; -# endif + set_option (optList[entry].flag & Optflag_mask, s); } } } -# endif - - /* Add in XENVIRONMENT file */ - - if ((xe = (char *)getenv ("XENVIRONMENT")) != NULL - && (rdb1 = XrmGetFileDatabase (xe)) != NULL) - XrmMergeDatabases (rdb1, &database); - - /* Add in Rxvt file */ -# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) - if (localepath == NULL || (rdb1 = XrmGetFileDatabase (localepath)) == NULL) -# endif - rdb1 = XrmGetFileDatabase (XAPPLOADDIR "/" RESCLASS); - - if (rdb1 != NULL) - XrmMergeDatabases (rdb1, &database); - - /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */ - if ((xe = (char *)getenv ("XAPPLRESDIR")) != NULL) - { - sprintf (fname, "%-.*s/" RESCLASS, sizeof (fname) - - sizeof (RESCLASS) - 2, xe); - if ((rdb1 = XrmGetFileDatabase (fname)) != NULL) - XrmMergeDatabases (rdb1, &database); - } - - XrmSetDatabase (display, database); -# endif - - /* - * Query resources for options that affect us - */ - for (entry = 0; entry < optList_size (); entry++) - { - int s; - char *p, *p0; - const char *kw = optList[entry].kw; - - if (kw == NULL || rs[optList[entry].doff] != NULL) - continue; /* previously set */ - - p = XGetDefault (display, name, kw); - p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); - if (p == NULL || (p0 && strcmp (p, p0) == 0)) - { - p = XGetDefault (display, RESCLASS, kw); -#ifdef RESFALLBACK - if (p == NULL || (p0 && strcmp (p, p0) == 0)) - p = XGetDefault (display, RESFALLBACK, kw); -#endif - } - - if (p == NULL && p0) - p = p0; - - if (p) - { - rs[optList[entry].doff] = p; - - if (optList_isBool (entry)) - { - s = strcasecmp (p, "TRUE") == 0 - || strcasecmp (p, "YES") == 0 - || strcasecmp (p, "ON") == 0 - || strcasecmp (p, "1") == 0; - if (optList_isReverse (entry)) - s = !s; - if (s) - options |= (optList[entry].flag); - else - options &= ~ (optList[entry].flag); - } - } - } - - /* - * [R5 or later]: enumerate the resource database - */ -# ifdef XrmEnumOneLevel -# ifdef KEYSYM_RESOURCE - name_prefix[0] = XrmStringToName (name); - name_prefix[1] = XrmStringToName ("keysym"); - name_prefix[2] = NULLQUARK; - class_prefix[0] = XrmStringToName (RESCLASS); - class_prefix[1] = XrmStringToName ("Keysym"); - class_prefix[2] = NULLQUARK; - /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ - XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, - XrmEnumOneLevel, rxvt_define_key, NULL); -# ifdef RESFALLBACK - name_prefix[0] = XrmStringToName (RESFALLBACK); - name_prefix[1] = XrmStringToName ("keysym"); - class_prefix[0] = XrmStringToName (RESFALLBACK); - class_prefix[1] = XrmStringToName ("Keysym"); - /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ - XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, - XrmEnumOneLevel, rxvt_define_key, NULL); -# endif -# endif -# endif - -# else /* USE_XGETDEFAULT */ - /* get resources the hard way, but save lots of memory */ - FILE *fd = NULL; - char *home; - - if ((home = getenv ("HOME")) != NULL) - { - unsigned int i, len = strlen (home) + 2; - char *f = NULL; - - for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++) - { - f = (char *)rxvt_realloc (f, len + strlen (xnames[i])); - - sprintf (f, "%s/%s", home, xnames[i]); - if ((fd = fopen (f, "r")) != NULL) - break; - } - - free (f); - } - /* - * The normal order to match resources is the following: - * @ global resources (partial match, ~/.Xdefaults) - * @ application file resources (XAPPLOADDIR/Rxvt) - * @ class resources (~/.Xdefaults) - * @ private resources (~/.Xdefaults) - * - * However, for the hand-rolled resources, the matching algorithm - * checks if a resource string value has already been allocated - * and won't overwrite it with (in this case) a less specific - * resource value. - * - * This avoids multiple allocation. Also, when we've called this - * routine command-line string options have already been applied so we - * needn't to allocate for those resources. - * - * So, search in resources from most to least specific. - * - * Also, use a special sub-class so that we can use either or both of - * "XTerm" and "Rxvt" as class names. - */ - - get_xdefaults (fd, name); - get_xdefaults (fd, RESCLASS); -# ifdef RESFALLBACK - get_xdefaults (fd, RESFALLBACK); -# endif - -# if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR) - { - FILE *ad = NULL; - -# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) - if (localepath == NULL || (ad = fopen (localepath, "r")) == NULL) + /* + * [R5 or later]: enumerate the resource database + */ +# ifdef KEYSYM_RESOURCE + XrmDatabase database = XrmGetDatabase (display->display); + XrmName name_prefix[3]; + XrmClass class_prefix[3]; + + name_prefix[0] = XrmStringToName (rs[Rs_name]); + name_prefix[1] = XrmStringToName ("keysym"); + name_prefix[2] = NULLQUARK; + class_prefix[0] = XrmStringToName (RESCLASS); + class_prefix[1] = XrmStringToName ("Keysym"); + class_prefix[2] = NULLQUARK; + /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ + XrmEnumerateDatabase (database, name_prefix, class_prefix, + XrmEnumOneLevel, rxvt_define_key, NULL); +# ifdef RESFALLBACK + name_prefix[0] = XrmStringToName (RESFALLBACK); + name_prefix[1] = XrmStringToName ("keysym"); + class_prefix[0] = XrmStringToName (RESFALLBACK); + class_prefix[1] = XrmStringToName ("Keysym"); + /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ + XrmEnumerateDatabase (database, name_prefix, class_prefix, + XrmEnumOneLevel, rxvt_define_key, NULL); # endif - ad = fopen (XAPPLOADDIR "/" RESCLASS, "r"); - if (ad != NULL) - { - get_xdefaults (ad, RESCLASS); - get_xdefaults (ad, ""); - fclose (ad); - } - } -# endif /* XAPPLOADDIR */ - - get_xdefaults (fd, ""); /* partial match */ - if (fd != NULL) - fclose (fd); -# endif /* USE_XGETDEFAULT */ - -# if defined XAPPLOADDIR -# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) - - } - - /* Free the path of the possibly available localized Rxvt file */ - free (localepath); # endif -# endif #endif /* NO_RESOURCES */ } -/*}}} */ /*----------------------- end-of-file (C source) -----------------------*/