diff options
| author | Jim Blandy | 1993-05-27 05:09:02 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-27 05:09:02 +0000 |
| commit | ac63d3d6db0c0b2d547013d676c4cf81a19ad82c (patch) | |
| tree | 20a5b8c7a4e0ef3938bc637663c2542fd5bd3b33 /src | |
| parent | b22fda6fe560c4b53a46ad18cf666d8f808828f9 (diff) | |
| download | emacs-ac63d3d6db0c0b2d547013d676c4cf81a19ad82c.tar.gz emacs-ac63d3d6db0c0b2d547013d676c4cf81a19ad82c.zip | |
* 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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/xfns.c b/src/xfns.c index 54ce8bb266d..7f8f659bd21 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -54,6 +54,9 @@ static XrmDatabase xrdb; | |||
| 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 | 56 | ||
| 57 | /* The name we're using for this X application. */ | ||
| 58 | Lisp_Object Vxrdb_name; | ||
| 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 | ||
| @@ -1104,7 +1107,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 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) |
| @@ -1112,7 +1115,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 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, |
| @@ -1120,7 +1123,7 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 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); |
| @@ -1131,10 +1134,10 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 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); |
| @@ -3415,6 +3418,19 @@ arg XRM_STRING is a string of resources in xrdb format.") | |||
| 3415 | x_current_display->db = xrdb; | 3418 | x_current_display->db = xrdb; |
| 3416 | #endif | 3419 | #endif |
| 3417 | 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 | } | ||
| 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); |
| @@ -3567,6 +3583,8 @@ 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."); |