Mercurial > hg > xemacs-beta
comparison src/device-x.c @ 259:11cf20601dec r20-5b28
Import from CVS: tag r20-5b28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:23:02 +0200 |
parents | 157b30c96d03 |
children | 727739f917cb |
comparison
equal
deleted
inserted
replaced
258:58424f6abf56 | 259:11cf20601dec |
---|---|
222 DEVICE_CLASS (d) = Qcolor; | 222 DEVICE_CLASS (d) = Qcolor; |
223 } | 223 } |
224 } | 224 } |
225 else | 225 else |
226 DEVICE_CLASS (d) = Qmono; | 226 DEVICE_CLASS (d) = Qmono; |
227 } | |
228 | |
229 static int | |
230 have_xemacs_resources_in_xrdb(char *disp_name) | |
231 { | |
232 Display *dpy; | |
233 char *xdefs, *key; | |
234 int len, found; | |
235 | |
236 /* | |
237 ** This function figures out whether the user has any resources of the | |
238 ** form "XEmacs.foo" or "XEmacs*foo". | |
239 ** | |
240 ** Currently we only consult the display's global resources; to look | |
241 ** for screen specific resources, we would need to also consult: | |
242 ** xdefs = XScreenResourceString(ScreenOfDisplay(dpy, scrno)); | |
243 */ | |
244 | |
245 key = "XEmacs"; | |
246 len = strlen(key); | |
247 | |
248 dpy = XOpenDisplay(disp_name); | |
249 | |
250 if (!dpy) return 0; | |
251 | |
252 xdefs = XResourceManagerString(dpy); /* don't free - owned by X */ | |
253 for (found = 0; xdefs && *xdefs; ) { | |
254 if (strncmp(xdefs, key, len) == 0 && | |
255 (xdefs[len] == '*' || xdefs[len] == '.')) { | |
256 found = 1; | |
257 break; | |
258 } | |
259 | |
260 while (*xdefs && *xdefs++ != '\n') /* find start of next entry.. */ | |
261 ; | |
262 } | |
263 | |
264 XCloseDisplay(dpy); | |
265 return found; | |
227 } | 266 } |
228 | 267 |
229 static void | 268 static void |
230 x_init_device (struct device *d, Lisp_Object props) | 269 x_init_device (struct device *d, Lisp_Object props) |
231 { | 270 { |
249 | 288 |
250 allocate_x_device_struct (d); | 289 allocate_x_device_struct (d); |
251 | 290 |
252 make_argc_argv (Vx_initial_argv_list, &argc, &argv); | 291 make_argc_argv (Vx_initial_argv_list, &argc, &argv); |
253 | 292 |
293 GET_C_STRING_CTEXT_DATA_ALLOCA (display, disp_name); | |
294 | |
254 if (STRINGP (Vx_emacs_application_class) && | 295 if (STRINGP (Vx_emacs_application_class) && |
255 XSTRING_LENGTH (Vx_emacs_application_class) > 0) | 296 XSTRING_LENGTH (Vx_emacs_application_class) > 0) |
256 GET_C_STRING_CTEXT_DATA_ALLOCA (Vx_emacs_application_class, app_class); | 297 GET_C_STRING_CTEXT_DATA_ALLOCA (Vx_emacs_application_class, app_class); |
257 else | 298 else { |
258 app_class = "Emacs"; | 299 app_class = (NILP(Vx_emacs_application_class) && |
259 | 300 have_xemacs_resources_in_xrdb(disp_name)) |
260 GET_C_STRING_CTEXT_DATA_ALLOCA (display, disp_name); | 301 ? "XEmacs" |
302 : "Emacs"; | |
303 /* need to update Vx_emacs_application_class: */ | |
304 Vx_emacs_application_class = build_string(app_class); | |
305 } | |
261 | 306 |
262 slow_down_interrupts (); | 307 slow_down_interrupts (); |
263 /* The Xt code can't deal with signals here. Yuck. */ | 308 /* The Xt code can't deal with signals here. Yuck. */ |
264 dpy = DEVICE_X_DISPLAY (d) = | 309 dpy = DEVICE_X_DISPLAY (d) = |
265 XtOpenDisplay (Xt_app_con, disp_name, NULL, app_class, emacs_options, | 310 XtOpenDisplay (Xt_app_con, disp_name, NULL, app_class, emacs_options, |
1611 This controls, among other things, the name of the `app-defaults' file | 1656 This controls, among other things, the name of the `app-defaults' file |
1612 that XEmacs will use. For changes to this variable to take effect, they | 1657 that XEmacs will use. For changes to this variable to take effect, they |
1613 must be made before the connection to the X server is initialized, that is, | 1658 must be made before the connection to the X server is initialized, that is, |
1614 this variable may only be changed before emacs is dumped, or by setting it | 1659 this variable may only be changed before emacs is dumped, or by setting it |
1615 in the file lisp/term/x-win.el. | 1660 in the file lisp/term/x-win.el. |
1661 | |
1662 If this variable is nil before the connection to the X server is first | |
1663 initialized (which it is by default), the X resource database will be | |
1664 consulted and the value will be set according to whether any resources | |
1665 are found for the application class `XEmacs'. If the user has set any | |
1666 resources for the XEmacs application class, the XEmacs process will use | |
1667 the application class `XEmacs'. Otherwise, the XEmacs process will use | |
1668 the application class `Emacs' which is backwards compatible to previous | |
1669 XEmacs versions but may conflict with resources intended for GNU Emacs. | |
1616 */ ); | 1670 */ ); |
1617 Vx_emacs_application_class = Fpurecopy (build_string ("Emacs")); | 1671 Vx_emacs_application_class = Qnil; |
1618 | 1672 |
1619 DEFVAR_LISP ("x-initial-argv-list", &Vx_initial_argv_list /* | 1673 DEFVAR_LISP ("x-initial-argv-list", &Vx_initial_argv_list /* |
1620 You don't want to know. | 1674 You don't want to know. |
1621 This is used during startup to communicate the remaining arguments in | 1675 This is used during startup to communicate the remaining arguments in |
1622 `command-line-args-left' to the C code, which passes the args to | 1676 `command-line-args-left' to the C code, which passes the args to |