From 342ce6675fd02aca8fca5177fad5d18ccf724231 Mon Sep 17 00:00:00 2001 From: ayin Date: Thu, 22 Nov 2007 15:07:10 +0000 Subject: [PATCH] The removal of rxvt own parsing caused an inconsistency for keysym directives between resources and command line options, because the former are subjected to xlib parsing while the latter are not. Fix it by generating resources from the command line options and merging them later in the resource database. --- src/main.C | 3 +++ src/rxvt.h | 3 +++ src/xdefaults.C | 11 +++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main.C b/src/main.C index f1fbd4e7..445ddaa1 100644 --- a/src/main.C +++ b/src/main.C @@ -311,6 +311,9 @@ rxvt_term::~rxvt_term () #ifdef KEYSYM_RESOURCE delete keyboard; #endif +#ifndef NO_RESOURCES + XrmDestroyDatabase (option_db); +#endif } // child has exited, usually destroys diff --git a/src/rxvt.h b/src/rxvt.h index 8d818245..7aa0a0d9 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1013,6 +1013,9 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { #ifdef KEYSYM_RESOURCE keyboard_manager *keyboard; #endif +#ifndef NO_RESOURCES + XrmDatabase option_db; +#endif const char *rs[NUM_RESOURCES]; /* command input buffering */ diff --git a/src/xdefaults.C b/src/xdefaults.C index 93f19c80..a3d0afc1 100644 --- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -567,7 +567,12 @@ rxvt_term::get_options (int argc, const char *const *argv) else if (!strncmp (opt, "keysym.", sizeof ("keysym.") - 1)) { if (i+1 < argc) - parse_keysym (opt + sizeof ("keysym.") - 1, argv[++i]); + { + char *res = (char *)malloc (strlen (opt) + strlen (argv[++i]) + 6); + sprintf (res, "*.%s: %s\n", opt, argv[i]); + XrmPutLineResource (&option_db, res); + free (res); + } } #endif else @@ -802,6 +807,9 @@ void rxvt_term::extract_resources () { #ifndef NO_RESOURCES + XrmDatabase database = XrmGetDatabase (dpy); + XrmMergeDatabases (option_db, &database); + option_db = NULL; /* * Query resources for options that affect us */ @@ -840,7 +848,6 @@ rxvt_term::extract_resources () * [R5 or later]: enumerate the resource database */ # ifdef KEYSYM_RESOURCE - XrmDatabase database = XrmGetDatabase (dpy); XrmName name_prefix[3]; XrmClass class_prefix[3]; -- 2.34.1