--- rxvt-unicode/src/xdefaults.C 2010/01/06 12:10:44 1.142 +++ rxvt-unicode/src/xdefaults.C 2011/12/02 09:02:05 1.158 @@ -6,7 +6,7 @@ * Copyright (c) 1994 Robert Nation * - original version * Copyright (c) 1997,1998 mj olesen - * Copyright (c) 2003-2006 Marc Lehmann + * Copyright (c) 2003-2006 Marc Lehmann * Copyright (c) 2007 Emanuele Giaquinta * * This program is free software; you can redistribute it and/or modify @@ -71,8 +71,6 @@ (optList[i].flag & Optflag_Boolean) #define optList_isReverse(i) \ (optList[i].flag & Optflag_Reverse) -#define optList_size \ - (sizeof (optList) / sizeof (optList[0])) static const struct { @@ -114,6 +112,7 @@ BOOL (Rs_transparent, "transparent", "tr", Opt_transparent, 0, "inherit parent pixmap"), STRG (Rs_color + Color_tint, "tintColor", "tint", "color", "tint color"), STRG (Rs_shade, "shading", "sh", "number", "shade background by number %."), + STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "gaussian blur radii to apply to the root background"), #endif #if OFF_FOCUS_FADING STRG (Rs_fade, "fading", "fade", "number", "fade colors by number % when losing focus"), @@ -179,6 +178,7 @@ #endif #ifdef OPTION_HC STRG (Rs_color + Color_HC, "highlightColor", "hc", "color", "highlight color"), + RSTRG (Rs_color + Color_HTC, "highlightTextColor", "color"), #endif #ifndef NO_CURSORCOLOR STRG (Rs_color + Color_cursor, "cursorColor", "cr", "color", "cursor color"), @@ -191,6 +191,9 @@ #ifdef BG_IMAGE_FROM_FILE RSTRG (Rs_path, "path", "search path"), STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"), +# if ENABLE_EWMH + STRG (Rs_iconfile, "iconFile", "icon", "file", "path to application icon image"), +# endif #endif /* fonts: command-line option = resource name */ STRG (Rs_font, "font", "fn", "fontname", "normal text font"), @@ -265,10 +268,6 @@ #endif #ifdef HAVE_AFTERIMAGE STRG (Rs_blendtype, "blendType", "blt", "string", "background image blending type - alpha, tint, etc..."), - STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "gaussian blur radii to apply to the root background"), -# if ENABLE_EWMH - STRG (Rs_iconfile, "iconFile", "icon", "file", "path to application icon image"), -# endif #endif INFO ("e", "command arg ...", "command to execute") }; @@ -329,6 +328,9 @@ #if HAVE_AFTERIMAGE "afterimage," #endif +#if HAVE_PIXBUF + "pixbuf," +#endif #if defined(USE_XIM) "XIM," #endif @@ -397,7 +399,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 < ecb_array_length (optList); i++) if (optList[i].desc != NULL) { int len = 0; @@ -405,7 +407,7 @@ if (optList[i].arg) len = strlen (optList[i].arg) + 1; assert (optList[i].opt != NULL); - len += 4 + strlen (optList[i].opt) + (optList_isBool (i) ? 2: 0); + len += 4 + strlen (optList[i].opt) + (optList_isBool (i) ? 2 : 0); col += len; if (col > 79) { @@ -425,7 +427,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 < ecb_array_length (optList); i++) if (optList[i].desc != NULL) { assert (optList[i].opt != NULL); @@ -444,7 +446,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 < ecb_array_length (optList); i++) if (optList[i].kw != NULL) rxvt_log (" %s: %*s%s\n", optList[i].kw, @@ -461,7 +463,6 @@ rxvt_log ("\n\n"); rxvt_exit_failure (); - /* NOTREACHED */ } /*}}} */ @@ -508,13 +509,13 @@ rxvt_usage (0); /* feature: always try to match long-options */ - for (entry = 0; entry < optList_size; entry++) + for (entry = 0; entry < ecb_array_length (optList); 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 < ecb_array_length (optList)) { if (optList_isReverse (entry)) flag = !flag; @@ -522,7 +523,7 @@ if (optList_isString (entry)) { /* - * special cases are handled in main.c:main () to allow + * special cases are handled in init_resources () to allow * X resources to set these values before we settle for * default values */ @@ -556,10 +557,9 @@ { if (i+1 < argc) { - char *res = (char *)malloc (strlen (opt) + strlen (argv[++i]) + 6); + char *res = rxvt_temp_buf (strlen (opt) + strlen (argv[++i]) + 6); sprintf (res, "*.%s: %s\n", opt, argv[i]); XrmPutLineResource (&option_db, res); - free (res); } } #endif @@ -586,14 +586,13 @@ * "rxvt" "keysym" "0xFF01" * value will be a string */ -/* ARGSUSED */ -int -rxvt_define_key (XrmDatabase *database UNUSED, - XrmBindingList bindings UNUSED, +static int +rxvt_define_key (XrmDatabase *database ecb_unused, + XrmBindingList bindings ecb_unused, XrmQuarkList quarks, - XrmRepresentation *type UNUSED, + XrmRepresentation *type ecb_unused, XrmValue *value, - XPointer closure UNUSED) + XPointer closure ecb_unused) { int last; @@ -666,7 +665,7 @@ { unsigned int i; - for (i=0; i < sizeof (keysym_vocabulary) / sizeof (keysym_vocabulary_t); ++i) + for (i = 0; i < ecb_array_length (keysym_vocabulary); ++i) { if (strncmp (str, keysym_vocabulary [i].name, keysym_vocabulary [i].len) == 0) { @@ -676,7 +675,7 @@ } } - if (i >= sizeof (keysym_vocabulary) / sizeof (keysym_vocabulary_t)) + if (i >= ecb_array_length (keysym_vocabulary)) return -1; if (*str == '-') @@ -691,9 +690,11 @@ sym = strtol (str, &end, 16); if (*end) return -1; - } + } - keyboard->register_user_translation (sym, state, arg); + wchar_t *ws = rxvt_mbstowcs (arg); + keyboard->register_user_translation (sym, state, ws); + free (ws); return 1; } @@ -746,7 +747,7 @@ /* * Query resources for options that affect us */ - for (int entry = 0; entry < optList_size; entry++) + for (int entry = 0; entry < ecb_array_length (optList); entry++) { int s; const char *kw = optList[entry].kw; @@ -794,10 +795,7 @@ 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"); + name_prefix[0] = class_prefix[0] = XrmStringToName (RESFALLBACK); /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ XrmEnumerateDatabase (database, name_prefix, class_prefix, XrmEnumOneLevel, rxvt_define_key, NULL);