Mercurial > emacs
comparison src/xfns.c @ 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 | ffe66ae9bfb3 |
children | c3c1b1ceab05 |
comparison
equal
deleted
inserted
replaced
3169:ff7e4f44269d | 3170:647229114f47 |
---|---|
51 /* X Resource data base */ | 51 /* X Resource data base */ |
52 static XrmDatabase xrdb; | 52 static XrmDatabase xrdb; |
53 | 53 |
54 /* The class of this X application. */ | 54 /* The class of this X application. */ |
55 #define EMACS_CLASS "Emacs" | 55 #define EMACS_CLASS "Emacs" |
56 | |
57 /* The name we're using for this X application. */ | |
58 Lisp_Object Vxrdb_name; | |
56 | 59 |
57 /* Title name and application name for X stuff. */ | 60 /* Title name and application name for X stuff. */ |
58 extern char *x_id_name; | 61 extern char *x_id_name; |
59 | 62 |
60 /* The background and shape of the mouse pointer, and shape when not | 63 /* The background and shape of the mouse pointer, and shape when not |
1102 | 1105 |
1103 if (NILP (component)) | 1106 if (NILP (component)) |
1104 { | 1107 { |
1105 /* Allocate space for the components, the dots which separate them, | 1108 /* Allocate space for the components, the dots which separate them, |
1106 and the final '\0'. */ | 1109 and the final '\0'. */ |
1107 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size | 1110 name_key = (char *) alloca (XSTRING (Vxrdb_name)->size |
1108 + XSTRING (attribute)->size | 1111 + XSTRING (attribute)->size |
1109 + 2); | 1112 + 2); |
1110 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | 1113 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) |
1111 + XSTRING (class)->size | 1114 + XSTRING (class)->size |
1112 + 2); | 1115 + 2); |
1113 | 1116 |
1114 sprintf (name_key, "%s.%s", | 1117 sprintf (name_key, "%s.%s", |
1115 XSTRING (Vinvocation_name)->data, | 1118 XSTRING (Vxrdb_name)->data, |
1116 XSTRING (attribute)->data); | 1119 XSTRING (attribute)->data); |
1117 sprintf (class_key, "%s.%s", | 1120 sprintf (class_key, "%s.%s", |
1118 EMACS_CLASS, | 1121 EMACS_CLASS, |
1119 XSTRING (class)->data); | 1122 XSTRING (class)->data); |
1120 } | 1123 } |
1121 else | 1124 else |
1122 { | 1125 { |
1123 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size | 1126 name_key = (char *) alloca (XSTRING (Vxrdb_name)->size |
1124 + XSTRING (component)->size | 1127 + XSTRING (component)->size |
1125 + XSTRING (attribute)->size | 1128 + XSTRING (attribute)->size |
1126 + 3); | 1129 + 3); |
1127 | 1130 |
1128 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | 1131 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) |
1129 + XSTRING (class)->size | 1132 + XSTRING (class)->size |
1130 + XSTRING (subclass)->size | 1133 + XSTRING (subclass)->size |
1131 + 3); | 1134 + 3); |
1132 | 1135 |
1133 sprintf (name_key, "%s.%s.%s", | 1136 sprintf (name_key, "%s.%s.%s", |
1134 XSTRING (Vinvocation_name)->data, | 1137 XSTRING (Vxrdb_name)->data, |
1135 XSTRING (component)->data, | 1138 XSTRING (component)->data, |
1136 XSTRING (attribute)->data); | 1139 XSTRING (attribute)->data); |
1137 sprintf (class_key, "%s.%s", | 1140 sprintf (class_key, "%s.%s.%s", |
1138 EMACS_CLASS, | 1141 EMACS_CLASS, |
1139 XSTRING (class)->data, | 1142 XSTRING (class)->data, |
1140 XSTRING (subclass)->data); | 1143 XSTRING (subclass)->data); |
1141 } | 1144 } |
1142 | 1145 |
3412 #ifdef HAVE_X11R5 | 3415 #ifdef HAVE_X11R5 |
3413 XrmSetDatabase (x_current_display, xrdb); | 3416 XrmSetDatabase (x_current_display, xrdb); |
3414 #else | 3417 #else |
3415 x_current_display->db = xrdb; | 3418 x_current_display->db = xrdb; |
3416 #endif | 3419 #endif |
3420 | |
3421 /* Make a version of Vinvocation_name suitable for use in xrdb | |
3422 queries - i.e. containing no dots or asterisks. */ | |
3423 Vxrdb_name = Fcopy_sequence (Vinvocation_name); | |
3424 { | |
3425 int i; | |
3426 int len = XSTRING (Vxrdb_name)->size; | |
3427 char *data = XSTRING (Vxrdb_name)->data; | |
3428 | |
3429 for (i = 0; i < len; i++) | |
3430 if (data[i] == '.' || data[i] == '*') | |
3431 data[i] = '-'; | |
3432 } | |
3417 | 3433 |
3418 x_screen = DefaultScreenOfDisplay (x_current_display); | 3434 x_screen = DefaultScreenOfDisplay (x_current_display); |
3419 | 3435 |
3420 screen_visual = select_visual (x_screen, &n_planes); | 3436 screen_visual = select_visual (x_screen, &n_planes); |
3421 x_screen_planes = n_planes; | 3437 x_screen_planes = n_planes; |
3565 "The shape of the pointer when over text.\n\ | 3581 "The shape of the pointer when over text.\n\ |
3566 Changing the value does not affect existing frames\n\ | 3582 Changing the value does not affect existing frames\n\ |
3567 unless you set the mouse color."); | 3583 unless you set the mouse color."); |
3568 Vx_pointer_shape = Qnil; | 3584 Vx_pointer_shape = Qnil; |
3569 | 3585 |
3586 staticpro (&Vxrdb_name); | |
3587 | |
3570 #if 0 | 3588 #if 0 |
3571 DEFVAR_INT ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape, | 3589 DEFVAR_INT ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape, |
3572 "The shape of the pointer when not over text."); | 3590 "The shape of the pointer when not over text."); |
3573 #endif | 3591 #endif |
3574 Vx_nontext_pointer_shape = Qnil; | 3592 Vx_nontext_pointer_shape = Qnil; |