diff options
| author | Richard M. Stallman | 1997-05-12 18:58:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-05-12 18:58:20 +0000 |
| commit | abb4b7ec87986568cb49fde5b01c61c7e7ab325d (patch) | |
| tree | 25e81bebb3dee656654b68603ebcff9ead1befc5 | |
| parent | cec68fcb05ab34c1ba2af45ccf5673673671c1a5 (diff) | |
| download | emacs-abb4b7ec87986568cb49fde5b01c61c7e7ab325d.tar.gz emacs-abb4b7ec87986568cb49fde5b01c61c7e7ab325d.zip | |
(Fx_create_frame): Get X resources from the display
we are making the frame on.
(x_get_arg): New arg DPYINFO. Callers changed.
(display_x_get_resource): New function.
| -rw-r--r-- | src/xfns.c | 116 |
1 files changed, 94 insertions, 22 deletions
diff --git a/src/xfns.c b/src/xfns.c index bbc83952bc6..c93b0816bbb 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -2166,6 +2166,73 @@ and the class is `Emacs.CLASS.SUBCLASS'.") | |||
| 2166 | return Qnil; | 2166 | return Qnil; |
| 2167 | } | 2167 | } |
| 2168 | 2168 | ||
| 2169 | /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */ | ||
| 2170 | |||
| 2171 | static Lisp_Object | ||
| 2172 | display_x_get_resource (dpyinfo, attribute, class, component, subclass) | ||
| 2173 | struct x_display_info *dpyinfo; | ||
| 2174 | Lisp_Object attribute, class, component, subclass; | ||
| 2175 | { | ||
| 2176 | register char *value; | ||
| 2177 | char *name_key; | ||
| 2178 | char *class_key; | ||
| 2179 | |||
| 2180 | check_x (); | ||
| 2181 | |||
| 2182 | CHECK_STRING (attribute, 0); | ||
| 2183 | CHECK_STRING (class, 0); | ||
| 2184 | |||
| 2185 | if (!NILP (component)) | ||
| 2186 | CHECK_STRING (component, 1); | ||
| 2187 | if (!NILP (subclass)) | ||
| 2188 | CHECK_STRING (subclass, 2); | ||
| 2189 | if (NILP (component) != NILP (subclass)) | ||
| 2190 | error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | ||
| 2191 | |||
| 2192 | validate_x_resource_name (); | ||
| 2193 | |||
| 2194 | /* Allocate space for the components, the dots which separate them, | ||
| 2195 | and the final '\0'. Make them big enough for the worst case. */ | ||
| 2196 | name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | ||
| 2197 | + (STRINGP (component) | ||
| 2198 | ? XSTRING (component)->size : 0) | ||
| 2199 | + XSTRING (attribute)->size | ||
| 2200 | + 3); | ||
| 2201 | |||
| 2202 | class_key = (char *) alloca (XSTRING (Vx_resource_class)->size | ||
| 2203 | + XSTRING (class)->size | ||
| 2204 | + (STRINGP (subclass) | ||
| 2205 | ? XSTRING (subclass)->size : 0) | ||
| 2206 | + 3); | ||
| 2207 | |||
| 2208 | /* Start with emacs.FRAMENAME for the name (the specific one) | ||
| 2209 | and with `Emacs' for the class key (the general one). */ | ||
| 2210 | strcpy (name_key, XSTRING (Vx_resource_name)->data); | ||
| 2211 | strcpy (class_key, XSTRING (Vx_resource_class)->data); | ||
| 2212 | |||
| 2213 | strcat (class_key, "."); | ||
| 2214 | strcat (class_key, XSTRING (class)->data); | ||
| 2215 | |||
| 2216 | if (!NILP (component)) | ||
| 2217 | { | ||
| 2218 | strcat (class_key, "."); | ||
| 2219 | strcat (class_key, XSTRING (subclass)->data); | ||
| 2220 | |||
| 2221 | strcat (name_key, "."); | ||
| 2222 | strcat (name_key, XSTRING (component)->data); | ||
| 2223 | } | ||
| 2224 | |||
| 2225 | strcat (name_key, "."); | ||
| 2226 | strcat (name_key, XSTRING (attribute)->data); | ||
| 2227 | |||
| 2228 | value = x_get_string_resource (dpyinfo->xrdb, name_key, class_key); | ||
| 2229 | |||
| 2230 | if (value != (char *) 0) | ||
| 2231 | return build_string (value); | ||
| 2232 | else | ||
| 2233 | return Qnil; | ||
| 2234 | } | ||
| 2235 | |||
| 2169 | /* Used when C code wants a resource value. */ | 2236 | /* Used when C code wants a resource value. */ |
| 2170 | 2237 | ||
| 2171 | char * | 2238 | char * |
| @@ -2210,7 +2277,8 @@ enum resource_types | |||
| 2210 | and don't let it get stored in any Lisp-visible variables! */ | 2277 | and don't let it get stored in any Lisp-visible variables! */ |
| 2211 | 2278 | ||
| 2212 | static Lisp_Object | 2279 | static Lisp_Object |
| 2213 | x_get_arg (alist, param, attribute, class, type) | 2280 | x_get_arg (dpyinfo, alist, param, attribute, class, type) |
| 2281 | struct x_display_info *dpyinfo; | ||
| 2214 | Lisp_Object alist, param; | 2282 | Lisp_Object alist, param; |
| 2215 | char *attribute; | 2283 | char *attribute; |
| 2216 | char *class; | 2284 | char *class; |
| @@ -2226,9 +2294,10 @@ x_get_arg (alist, param, attribute, class, type) | |||
| 2226 | 2294 | ||
| 2227 | if (attribute) | 2295 | if (attribute) |
| 2228 | { | 2296 | { |
| 2229 | tem = Fx_get_resource (build_string (attribute), | 2297 | tem = display_x_get_resource (dpyinfo, |
| 2230 | build_string (class), | 2298 | build_string (attribute), |
| 2231 | Qnil, Qnil); | 2299 | build_string (class), |
| 2300 | Qnil, Qnil); | ||
| 2232 | 2301 | ||
| 2233 | if (NILP (tem)) | 2302 | if (NILP (tem)) |
| 2234 | return Qunbound; | 2303 | return Qunbound; |
| @@ -2287,7 +2356,8 @@ x_get_and_record_arg (f, alist, param, attribute, class, type) | |||
| 2287 | { | 2356 | { |
| 2288 | Lisp_Object value; | 2357 | Lisp_Object value; |
| 2289 | 2358 | ||
| 2290 | value = x_get_arg (alist, param, attribute, class, type); | 2359 | value = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, param, |
| 2360 | attribute, class, type); | ||
| 2291 | if (! NILP (value)) | 2361 | if (! NILP (value)) |
| 2292 | store_frame_param (f, param, value); | 2362 | store_frame_param (f, param, value); |
| 2293 | 2363 | ||
| @@ -2312,7 +2382,7 @@ x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) | |||
| 2312 | { | 2382 | { |
| 2313 | Lisp_Object tem; | 2383 | Lisp_Object tem; |
| 2314 | 2384 | ||
| 2315 | tem = x_get_arg (alist, prop, xprop, xclass, type); | 2385 | tem = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, prop, xprop, xclass, type); |
| 2316 | if (EQ (tem, Qunbound)) | 2386 | if (EQ (tem, Qunbound)) |
| 2317 | tem = deflt; | 2387 | tem = deflt; |
| 2318 | x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); | 2388 | x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); |
| @@ -2395,6 +2465,7 @@ x_figure_window_size (f, parms) | |||
| 2395 | int height, width, left, top; | 2465 | int height, width, left, top; |
| 2396 | register int geometry; | 2466 | register int geometry; |
| 2397 | long window_prompting = 0; | 2467 | long window_prompting = 0; |
| 2468 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 2398 | 2469 | ||
| 2399 | /* Default values if we fall through. | 2470 | /* Default values if we fall through. |
| 2400 | Actually, if that happens we should get | 2471 | Actually, if that happens we should get |
| @@ -2406,9 +2477,9 @@ x_figure_window_size (f, parms) | |||
| 2406 | f->output_data.x->top_pos = 0; | 2477 | f->output_data.x->top_pos = 0; |
| 2407 | f->output_data.x->left_pos = 0; | 2478 | f->output_data.x->left_pos = 0; |
| 2408 | 2479 | ||
| 2409 | tem0 = x_get_arg (parms, Qheight, 0, 0, number); | 2480 | tem0 = x_get_arg (dpyinfo, parms, Qheight, 0, 0, number); |
| 2410 | tem1 = x_get_arg (parms, Qwidth, 0, 0, number); | 2481 | tem1 = x_get_arg (dpyinfo, parms, Qwidth, 0, 0, number); |
| 2411 | tem2 = x_get_arg (parms, Quser_size, 0, 0, number); | 2482 | tem2 = x_get_arg (dpyinfo, parms, Quser_size, 0, 0, number); |
| 2412 | if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | 2483 | if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
| 2413 | { | 2484 | { |
| 2414 | if (!EQ (tem0, Qunbound)) | 2485 | if (!EQ (tem0, Qunbound)) |
| @@ -2436,9 +2507,9 @@ x_figure_window_size (f, parms) | |||
| 2436 | f->output_data.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); | 2507 | f->output_data.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); |
| 2437 | f->output_data.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); | 2508 | f->output_data.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); |
| 2438 | 2509 | ||
| 2439 | tem0 = x_get_arg (parms, Qtop, 0, 0, number); | 2510 | tem0 = x_get_arg (dpyinfo, parms, Qtop, 0, 0, number); |
| 2440 | tem1 = x_get_arg (parms, Qleft, 0, 0, number); | 2511 | tem1 = x_get_arg (dpyinfo, parms, Qleft, 0, 0, number); |
| 2441 | tem2 = x_get_arg (parms, Quser_position, 0, 0, number); | 2512 | tem2 = x_get_arg (dpyinfo, parms, Quser_position, 0, 0, number); |
| 2442 | if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | 2513 | if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
| 2443 | { | 2514 | { |
| 2444 | if (EQ (tem0, Qminus)) | 2515 | if (EQ (tem0, Qminus)) |
| @@ -2960,6 +3031,7 @@ x_icon (f, parms) | |||
| 2960 | Lisp_Object parms; | 3031 | Lisp_Object parms; |
| 2961 | { | 3032 | { |
| 2962 | Lisp_Object icon_x, icon_y; | 3033 | Lisp_Object icon_x, icon_y; |
| 3034 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 2963 | 3035 | ||
| 2964 | /* Set the position of the icon. Note that twm groups all | 3036 | /* Set the position of the icon. Note that twm groups all |
| 2965 | icons in an icon window. */ | 3037 | icons in an icon window. */ |
| @@ -2980,7 +3052,7 @@ x_icon (f, parms) | |||
| 2980 | 3052 | ||
| 2981 | /* Start up iconic or window? */ | 3053 | /* Start up iconic or window? */ |
| 2982 | x_wm_set_window_state | 3054 | x_wm_set_window_state |
| 2983 | (f, (EQ (x_get_arg (parms, Qvisibility, 0, 0, symbol), Qicon) | 3055 | (f, (EQ (x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, symbol), Qicon) |
| 2984 | ? IconicState | 3056 | ? IconicState |
| 2985 | : NormalState)); | 3057 | : NormalState)); |
| 2986 | 3058 | ||
| @@ -3098,7 +3170,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3098 | until we know if this frame has a specified name. */ | 3170 | until we know if this frame has a specified name. */ |
| 3099 | Vx_resource_name = Vinvocation_name; | 3171 | Vx_resource_name = Vinvocation_name; |
| 3100 | 3172 | ||
| 3101 | display = x_get_arg (parms, Qdisplay, 0, 0, string); | 3173 | display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, string); |
| 3102 | if (EQ (display, Qunbound)) | 3174 | if (EQ (display, Qunbound)) |
| 3103 | display = Qnil; | 3175 | display = Qnil; |
| 3104 | dpyinfo = check_x_display_info (display); | 3176 | dpyinfo = check_x_display_info (display); |
| @@ -3108,7 +3180,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3108 | kb = &the_only_kboard; | 3180 | kb = &the_only_kboard; |
| 3109 | #endif | 3181 | #endif |
| 3110 | 3182 | ||
| 3111 | name = x_get_arg (parms, Qname, "name", "Name", string); | 3183 | name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", string); |
| 3112 | if (!STRINGP (name) | 3184 | if (!STRINGP (name) |
| 3113 | && ! EQ (name, Qunbound) | 3185 | && ! EQ (name, Qunbound) |
| 3114 | && ! NILP (name)) | 3186 | && ! NILP (name)) |
| @@ -3118,7 +3190,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3118 | Vx_resource_name = name; | 3190 | Vx_resource_name = name; |
| 3119 | 3191 | ||
| 3120 | /* See if parent window is specified. */ | 3192 | /* See if parent window is specified. */ |
| 3121 | parent = x_get_arg (parms, Qparent_id, NULL, NULL, number); | 3193 | parent = x_get_arg (dpyinfo, parms, Qparent_id, NULL, NULL, number); |
| 3122 | if (EQ (parent, Qunbound)) | 3194 | if (EQ (parent, Qunbound)) |
| 3123 | parent = Qnil; | 3195 | parent = Qnil; |
| 3124 | if (! NILP (parent)) | 3196 | if (! NILP (parent)) |
| @@ -3129,7 +3201,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3129 | it to make_frame_without_minibuffer. */ | 3201 | it to make_frame_without_minibuffer. */ |
| 3130 | frame = Qnil; | 3202 | frame = Qnil; |
| 3131 | GCPRO4 (parms, parent, name, frame); | 3203 | GCPRO4 (parms, parent, name, frame); |
| 3132 | tem = x_get_arg (parms, Qminibuffer, "minibuffer", "Minibuffer", symbol); | 3204 | tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer", symbol); |
| 3133 | if (EQ (tem, Qnone) || NILP (tem)) | 3205 | if (EQ (tem, Qnone) || NILP (tem)) |
| 3134 | f = make_frame_without_minibuffer (Qnil, kb, display); | 3206 | f = make_frame_without_minibuffer (Qnil, kb, display); |
| 3135 | else if (EQ (tem, Qonly)) | 3207 | else if (EQ (tem, Qonly)) |
| @@ -3153,7 +3225,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3153 | f->output_data.x->icon_bitmap = -1; | 3225 | f->output_data.x->icon_bitmap = -1; |
| 3154 | 3226 | ||
| 3155 | f->icon_name | 3227 | f->icon_name |
| 3156 | = x_get_arg (parms, Qicon_name, "iconName", "Title", string); | 3228 | = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", string); |
| 3157 | if (! STRINGP (f->icon_name)) | 3229 | if (! STRINGP (f->icon_name)) |
| 3158 | f->icon_name = Qnil; | 3230 | f->icon_name = Qnil; |
| 3159 | 3231 | ||
| @@ -3213,7 +3285,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3213 | if (!NILP (tem)) | 3285 | if (!NILP (tem)) |
| 3214 | font = Fcdr (tem); | 3286 | font = Fcdr (tem); |
| 3215 | if (! STRINGP (font)) | 3287 | if (! STRINGP (font)) |
| 3216 | font = x_get_arg (parms, Qfont, "font", "Font", string); | 3288 | font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", string); |
| 3217 | 3289 | ||
| 3218 | BLOCK_INPUT; | 3290 | BLOCK_INPUT; |
| 3219 | /* First, try whatever font the caller has specified. */ | 3291 | /* First, try whatever font the caller has specified. */ |
| @@ -3260,7 +3332,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3260 | { | 3332 | { |
| 3261 | Lisp_Object value; | 3333 | Lisp_Object value; |
| 3262 | 3334 | ||
| 3263 | value = x_get_arg (parms, Qinternal_border_width, | 3335 | value = x_get_arg (dpyinfo, parms, Qinternal_border_width, |
| 3264 | "internalBorder", "internalBorder", number); | 3336 | "internalBorder", "internalBorder", number); |
| 3265 | if (! EQ (value, Qunbound)) | 3337 | if (! EQ (value, Qunbound)) |
| 3266 | parms = Fcons (Fcons (Qinternal_border_width, value), | 3338 | parms = Fcons (Fcons (Qinternal_border_width, value), |
| @@ -3348,7 +3420,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3348 | x_wm_set_size_hint (f, window_prompting, 0); | 3420 | x_wm_set_size_hint (f, window_prompting, 0); |
| 3349 | UNBLOCK_INPUT; | 3421 | UNBLOCK_INPUT; |
| 3350 | 3422 | ||
| 3351 | tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean); | 3423 | tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, boolean); |
| 3352 | f->no_split = minibuffer_only || EQ (tem, Qt); | 3424 | f->no_split = minibuffer_only || EQ (tem, Qt); |
| 3353 | 3425 | ||
| 3354 | UNGCPRO; | 3426 | UNGCPRO; |
| @@ -3370,7 +3442,7 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 3370 | { | 3442 | { |
| 3371 | Lisp_Object visibility; | 3443 | Lisp_Object visibility; |
| 3372 | 3444 | ||
| 3373 | visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol); | 3445 | visibility = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, symbol); |
| 3374 | if (EQ (visibility, Qunbound)) | 3446 | if (EQ (visibility, Qunbound)) |
| 3375 | visibility = Qt; | 3447 | visibility = Qt; |
| 3376 | 3448 | ||