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 f1fbd4e..445ddaa 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 8d81824..7aa0a0d 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 93f19c8..a3d0afc 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];