The removal of rxvt own parsing caused an inconsistency for keysym
authorayin <ayin>
Thu, 22 Nov 2007 15:07:10 +0000 (15:07 +0000)
committerayin <ayin>
Thu, 22 Nov 2007 15:07:10 +0000 (15:07 +0000)
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
src/rxvt.h
src/xdefaults.C

index f1fbd4e7414d64b8a87df59e3b582d854d343c71..445ddaa19e4d8ec8d75125aa948d5e140ac8c265 100644 (file)
@@ -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
index 8d818245c2596e2e0ac4fa53aa4d8ace66d85a6f..7aa0a0d9b3dcdb6ea3fd9f058e38e12b08f643e5 100644 (file)
@@ -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 */
index 93f19c80a4c885bab9c6b938be28a70f943fbf07..a3d0afc14dfa07c48153efeac9b57b71d53791fd 100644 (file)
@@ -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];