changeset 3170:647229114f47

* xfns.c: Make resource manager work correctly even when Vinvocation_name has periods and asterisks in it. (Vxrdb_name): New variable. (Fx_get_resource): Use it instead of Vinvocation_name. (Fx_open_connection): Initialize it to a copy of Vinvocation_name, with the dots and stars replaced by hyphens. (syms_of_xfns): staticpro it here. * xfns.c (Fx_get_resource): Use the proper format string when the attribute has been specified.
author Jim Blandy <jimb@redhat.com>
date Thu, 27 May 1993 05:09:02 +0000
parents ff7e4f44269d
children f26d9c469926
files src/xfns.c
diffstat 1 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Thu May 27 05:01:09 1993 +0000
+++ b/src/xfns.c	Thu May 27 05:09:02 1993 +0000
@@ -54,6 +54,9 @@
 /* The class of this X application.  */
 #define EMACS_CLASS "Emacs"
 
+/* The name we're using for this X application.  */
+Lisp_Object Vxrdb_name;
+
 /* Title name and application name for X stuff. */
 extern char *x_id_name;
 
@@ -1104,7 +1107,7 @@
     {
       /* Allocate space for the components, the dots which separate them,
 	 and the final '\0'.  */
-      name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
+      name_key = (char *) alloca (XSTRING (Vxrdb_name)->size
 				  + XSTRING (attribute)->size
 				  + 2);
       class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
@@ -1112,7 +1115,7 @@
 				   + 2);
 
       sprintf (name_key, "%s.%s",
-	       XSTRING (Vinvocation_name)->data,
+	       XSTRING (Vxrdb_name)->data,
 	       XSTRING (attribute)->data);
       sprintf (class_key, "%s.%s",
 	       EMACS_CLASS,
@@ -1120,7 +1123,7 @@
     }
   else
     {
-      name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
+      name_key = (char *) alloca (XSTRING (Vxrdb_name)->size
 				  + XSTRING (component)->size
 				  + XSTRING (attribute)->size
 				  + 3);
@@ -1131,10 +1134,10 @@
 				   + 3);
 
       sprintf (name_key, "%s.%s.%s",
-	       XSTRING (Vinvocation_name)->data,
+	       XSTRING (Vxrdb_name)->data,
 	       XSTRING (component)->data,
 	       XSTRING (attribute)->data);
-      sprintf (class_key, "%s.%s",
+      sprintf (class_key, "%s.%s.%s",
 	       EMACS_CLASS,
 	       XSTRING (class)->data,
 	       XSTRING (subclass)->data);
@@ -3415,6 +3418,19 @@
   x_current_display->db = xrdb;
 #endif
 
+  /* Make a version of Vinvocation_name suitable for use in xrdb
+     queries - i.e. containing no dots or asterisks.  */
+  Vxrdb_name = Fcopy_sequence (Vinvocation_name);
+  {
+    int i;
+    int len = XSTRING (Vxrdb_name)->size;
+    char *data = XSTRING (Vxrdb_name)->data;
+    
+    for (i = 0; i < len; i++)
+      if (data[i] == '.' || data[i] == '*')
+	data[i] = '-';
+  }
+
   x_screen = DefaultScreenOfDisplay (x_current_display);
 
   screen_visual = select_visual (x_screen, &n_planes);
@@ -3567,6 +3583,8 @@
 unless you set the mouse color.");
   Vx_pointer_shape = Qnil;
 
+  staticpro (&Vxrdb_name);
+
 #if 0
   DEFVAR_INT ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape,
 	      "The shape of the pointer when not over text.");