428
|
1 /* Device functions for X windows.
|
|
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
|
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
442
|
24 /* 7-8-00 !!#### This file needs definite Mule review. */
|
|
25
|
428
|
26 /* Original authors: Jamie Zawinski and the FSF */
|
|
27 /* Rewritten by Ben Wing and Chuck Thompson. */
|
|
28
|
|
29 #include <config.h>
|
|
30 #include "lisp.h"
|
|
31
|
|
32 #include "console-x.h"
|
|
33 #include "xintrinsicp.h" /* CoreP.h needs this */
|
|
34 #include <X11/CoreP.h> /* Numerous places access the fields of
|
|
35 a core widget directly. We could
|
|
36 use XtGetValues(), but ... */
|
|
37 #include "xgccache.h"
|
|
38 #include <X11/Shell.h>
|
|
39 #include "xmu.h"
|
|
40 #include "glyphs-x.h"
|
|
41 #include "objects-x.h"
|
|
42
|
|
43 #include "buffer.h"
|
|
44 #include "elhash.h"
|
|
45 #include "events.h"
|
|
46 #include "faces.h"
|
|
47 #include "frame.h"
|
|
48 #include "redisplay.h"
|
|
49 #include "sysdep.h"
|
|
50 #include "window.h"
|
|
51
|
|
52 #include "sysfile.h"
|
|
53 #include "systime.h"
|
|
54
|
442
|
55 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D)
|
440
|
56 #include "sysdll.h"
|
442
|
57 #endif /* HAVE_SHLIB and LWLIB_USES_ATHENA and not HAVE_ATHENA_3D */
|
440
|
58
|
428
|
59 #ifdef HAVE_OFFIX_DND
|
|
60 #include "offix.h"
|
|
61 #endif
|
|
62
|
|
63 Lisp_Object Vdefault_x_device;
|
|
64 #if defined(MULE) && (defined(LWLIB_MENUBARS_MOTIF) || defined(HAVE_XIM) || defined (USE_XFONTSET))
|
|
65 Lisp_Object Vx_app_defaults_directory;
|
|
66 #endif
|
|
67
|
|
68 /* Qdisplay in general.c */
|
|
69 Lisp_Object Qx_error;
|
|
70 Lisp_Object Qinit_pre_x_win, Qinit_post_x_win;
|
|
71
|
|
72 /* The application class of Emacs. */
|
|
73 Lisp_Object Vx_emacs_application_class;
|
|
74
|
|
75 Lisp_Object Vx_initial_argv_list; /* #### ugh! */
|
|
76
|
|
77 static XrmOptionDescRec emacs_options[] =
|
|
78 {
|
|
79 {"-geometry", ".geometry", XrmoptionSepArg, NULL},
|
|
80 {"-iconic", ".iconic", XrmoptionNoArg, "yes"},
|
|
81
|
|
82 {"-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL},
|
|
83 {"-ib", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL},
|
|
84 {"-scrollbar-width", "*EmacsFrame.scrollBarWidth", XrmoptionSepArg, NULL},
|
|
85 {"-scrollbar-height", "*EmacsFrame.scrollBarHeight", XrmoptionSepArg, NULL},
|
|
86
|
|
87 {"-privatecolormap", ".privateColormap", XrmoptionNoArg, "yes"},
|
|
88 {"-visual", ".EmacsVisual", XrmoptionSepArg, NULL},
|
|
89
|
|
90 /* #### Beware! If the type of the shell changes, update this. */
|
|
91 {"-T", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL},
|
|
92 {"-wn", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL},
|
|
93 {"-title", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL},
|
|
94
|
|
95 {"-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL},
|
|
96 {"-in", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL},
|
|
97 {"-mc", "*pointerColor", XrmoptionSepArg, NULL},
|
|
98 {"-cr", "*cursorColor", XrmoptionSepArg, NULL},
|
|
99 {"-fontset", "*FontSet", XrmoptionSepArg, NULL},
|
|
100 };
|
|
101
|
|
102 /* Functions to synchronize mirroring resources and specifiers */
|
|
103 int in_resource_setting;
|
|
104
|
|
105 /************************************************************************/
|
|
106 /* helper functions */
|
|
107 /************************************************************************/
|
|
108
|
|
109 /* JH 97/11/25 removed the static declaration because I need it during setup in event-Xt... */
|
|
110 struct device * get_device_from_display_1 (Display *dpy);
|
|
111 struct device *
|
|
112 get_device_from_display_1 (Display *dpy)
|
|
113 {
|
|
114 Lisp_Object devcons, concons;
|
|
115
|
|
116 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
117 {
|
|
118 struct device *d = XDEVICE (XCAR (devcons));
|
|
119 if (DEVICE_X_P (d) && DEVICE_X_DISPLAY (d) == dpy)
|
|
120 return d;
|
|
121 }
|
|
122
|
|
123 return 0;
|
|
124 }
|
|
125
|
|
126 struct device *
|
|
127 get_device_from_display (Display *dpy)
|
|
128 {
|
|
129 struct device *d = get_device_from_display_1 (dpy);
|
|
130
|
|
131 #if !defined(INFODOCK)
|
|
132 # define FALLBACK_RESOURCE_NAME "xemacs"
|
|
133 # else
|
|
134 # define FALLBACK_RESOURCE_NAME "infodock"
|
|
135 #endif
|
|
136
|
|
137 if (!d) {
|
|
138 /* This isn't one of our displays. Let's crash? */
|
|
139 stderr_out
|
|
140 ("\n%s: Fatal X Condition. Asked about display we don't own: \"%s\"\n",
|
|
141 (STRINGP (Vinvocation_name) ?
|
|
142 (char *) XSTRING_DATA (Vinvocation_name) : FALLBACK_RESOURCE_NAME),
|
|
143 DisplayString (dpy) ? DisplayString (dpy) : "???");
|
|
144 abort();
|
|
145 }
|
|
146
|
|
147 #undef FALLBACK_RESOURCE_NAME
|
|
148
|
|
149 return d;
|
|
150 }
|
|
151
|
|
152 struct device *
|
|
153 decode_x_device (Lisp_Object device)
|
|
154 {
|
|
155 XSETDEVICE (device, decode_device (device));
|
|
156 CHECK_X_DEVICE (device);
|
|
157 return XDEVICE (device);
|
|
158 }
|
|
159
|
|
160 static Display *
|
|
161 get_x_display (Lisp_Object device)
|
|
162 {
|
|
163 return DEVICE_X_DISPLAY (decode_x_device (device));
|
|
164 }
|
|
165
|
|
166
|
|
167 /************************************************************************/
|
|
168 /* initializing an X connection */
|
|
169 /************************************************************************/
|
|
170
|
|
171 static void
|
|
172 allocate_x_device_struct (struct device *d)
|
|
173 {
|
|
174 d->device_data = xnew_and_zero (struct x_device);
|
|
175 }
|
|
176
|
|
177 static void
|
|
178 Xatoms_of_device_x (struct device *d)
|
|
179 {
|
|
180 Display *D = DEVICE_X_DISPLAY (d);
|
|
181
|
|
182 DEVICE_XATOM_WM_PROTOCOLS (d) = XInternAtom (D, "WM_PROTOCOLS", False);
|
|
183 DEVICE_XATOM_WM_DELETE_WINDOW(d) = XInternAtom (D, "WM_DELETE_WINDOW",False);
|
|
184 DEVICE_XATOM_WM_SAVE_YOURSELF(d) = XInternAtom (D, "WM_SAVE_YOURSELF",False);
|
|
185 DEVICE_XATOM_WM_TAKE_FOCUS (d) = XInternAtom (D, "WM_TAKE_FOCUS", False);
|
|
186 DEVICE_XATOM_WM_STATE (d) = XInternAtom (D, "WM_STATE", False);
|
|
187 }
|
|
188
|
|
189 static void
|
|
190 sanity_check_geometry_resource (Display *dpy)
|
|
191 {
|
|
192 char *app_name, *app_class, *s;
|
|
193 char buf1 [255], buf2 [255];
|
|
194 char *type;
|
|
195 XrmValue value;
|
|
196 XtGetApplicationNameAndClass (dpy, &app_name, &app_class);
|
|
197 strcpy (buf1, app_name);
|
|
198 strcpy (buf2, app_class);
|
|
199 for (s = buf1; *s; s++) if (*s == '.') *s = '_';
|
|
200 strcat (buf1, "._no_._such_._resource_.geometry");
|
|
201 strcat (buf2, "._no_._such_._resource_.Geometry");
|
|
202 if (XrmGetResource (XtDatabase (dpy), buf1, buf2, &type, &value) == True)
|
|
203 {
|
|
204 warn_when_safe (Qgeometry, Qerror,
|
|
205 "\n"
|
|
206 "Apparently \"%s*geometry: %s\" or \"%s*geometry: %s\" was\n"
|
|
207 "specified in the resource database. Specifying \"*geometry\" will make\n"
|
|
208 "XEmacs (and most other X programs) malfunction in obscure ways. (i.e.\n"
|
|
209 "the Xt or Xm libraries will probably crash, which is a very bad thing.)\n"
|
|
210 "You should always use \".geometry\" or \"*EmacsFrame.geometry\" instead.\n",
|
|
211 app_name, (char *) value.addr,
|
|
212 app_class, (char *) value.addr);
|
|
213 suppress_early_error_handler_backtrace = 1;
|
563
|
214 syntax_error ("Invalid geometry resource", Qunbound);
|
428
|
215 }
|
|
216 }
|
|
217
|
|
218 static void
|
|
219 x_init_device_class (struct device *d)
|
|
220 {
|
|
221 if (DEVICE_X_DEPTH(d) > 2)
|
|
222 {
|
|
223 switch (DEVICE_X_VISUAL(d)->class)
|
|
224 {
|
|
225 case StaticGray:
|
|
226 case GrayScale:
|
|
227 DEVICE_CLASS (d) = Qgrayscale;
|
|
228 break;
|
|
229 default:
|
|
230 DEVICE_CLASS (d) = Qcolor;
|
|
231 }
|
|
232 }
|
|
233 else
|
|
234 DEVICE_CLASS (d) = Qmono;
|
|
235 }
|
|
236
|
|
237 /*
|
|
238 * Figure out what application name to use for xemacs
|
|
239 *
|
|
240 * Since we have decomposed XtOpenDisplay into XOpenDisplay and
|
|
241 * XtDisplayInitialize, we no longer get this for free.
|
|
242 *
|
|
243 * If there is a `-name' argument in argv, use that.
|
|
244 * Otherwise use the last component of argv[0].
|
|
245 *
|
|
246 * I have removed the gratuitous use of getenv("RESOURCE_NAME")
|
|
247 * which was in X11R5, but left the matching of any prefix of `-name'.
|
|
248 * Finally, if all else fails, return `xemacs', as it is more
|
|
249 * appropriate (X11R5 returns `main').
|
|
250 */
|
442
|
251 static Extbyte *
|
|
252 compute_x_app_name (int argc, Extbyte **argv)
|
428
|
253 {
|
|
254 int i;
|
442
|
255 Extbyte *ptr;
|
428
|
256
|
|
257 for (i = 1; i < argc - 1; i++)
|
|
258 if (!strncmp(argv[i], "-name", max (2, strlen (argv[1]))))
|
|
259 return argv[i+1];
|
|
260
|
|
261 if (argc > 0 && argv[0] && *argv[0])
|
|
262 return (ptr = strrchr (argv[0], '/')) ? ++ptr : argv[0];
|
|
263
|
|
264 return "xemacs";
|
|
265 }
|
|
266
|
|
267 /*
|
|
268 * This function figures out whether the user has any resources of the
|
|
269 * form "XEmacs.foo" or "XEmacs*foo".
|
|
270 *
|
|
271 * Currently we only consult the display's global resources; to look
|
|
272 * for screen specific resources, we would need to also consult:
|
|
273 * xdefs = XScreenResourceString(ScreenOfDisplay(dpy, scrno));
|
|
274 */
|
|
275 static int
|
|
276 have_xemacs_resources_in_xrdb (Display *dpy)
|
|
277 {
|
|
278 char *xdefs, *key;
|
|
279 int len;
|
|
280
|
|
281 #ifdef INFODOCK
|
|
282 key = "InfoDock";
|
|
283 #else
|
|
284 key = "XEmacs";
|
|
285 #endif
|
|
286 len = strlen (key);
|
|
287
|
|
288 if (!dpy)
|
|
289 return 0;
|
|
290
|
|
291 xdefs = XResourceManagerString (dpy); /* don't free - owned by X */
|
|
292 while (xdefs && *xdefs)
|
|
293 {
|
|
294 if (strncmp (xdefs, key, len) == 0 &&
|
|
295 (xdefs[len] == '*' || xdefs[len] == '.'))
|
|
296 return 1;
|
|
297
|
|
298 while (*xdefs && *xdefs++ != '\n') /* find start of next entry.. */
|
|
299 ;
|
|
300 }
|
|
301
|
|
302 return 0;
|
|
303 }
|
|
304
|
|
305 /* Only the characters [-_A-Za-z0-9] are allowed in the individual
|
|
306 components of a resource. Convert invalid characters to `-' */
|
|
307
|
|
308 static char valid_resource_char_p[256];
|
|
309
|
647
|
310 /* #### not just char * here; may be fixed in my Mule ws */
|
428
|
311 static void
|
665
|
312 validify_resource_component (char *str, Bytecount len)
|
428
|
313 {
|
|
314 for (; len; len--, str++)
|
|
315 if (!valid_resource_char_p[(unsigned char) (*str)])
|
|
316 *str = '-';
|
|
317 }
|
|
318
|
|
319 static void
|
|
320 Dynarr_add_validified_lisp_string (char_dynarr *cda, Lisp_Object str)
|
|
321 {
|
|
322 Bytecount len = XSTRING_LENGTH (str);
|
|
323 Dynarr_add_many (cda, (char *) XSTRING_DATA (str), len);
|
|
324 validify_resource_component (Dynarr_atp (cda, Dynarr_length (cda) - len), len);
|
|
325 }
|
|
326
|
|
327 #if 0
|
|
328 /* compare visual info for qsorting */
|
|
329 static int
|
|
330 x_comp_visual_info (const void *elem1, const void *elem2)
|
|
331 {
|
|
332 XVisualInfo *left, *right;
|
|
333
|
|
334 left = (XVisualInfo *)elem1;
|
|
335 right = (XVisualInfo *)elem2;
|
|
336
|
|
337 if ( left == NULL )
|
|
338 return -1;
|
|
339 if ( right == NULL )
|
|
340 return 1;
|
|
341
|
|
342 if ( left->depth > right->depth ) {
|
|
343 return 1;
|
|
344 }
|
|
345 else if ( left->depth == right->depth ) {
|
|
346 if ( left->colormap_size > right->colormap_size )
|
|
347 return 1;
|
|
348 if ( left->class > right->class )
|
|
349 return 1;
|
|
350 else if ( left->class < right->class )
|
|
351 return -1;
|
|
352 else
|
|
353 return 0;
|
|
354 }
|
|
355 else {
|
|
356 return -1;
|
|
357 }
|
|
358
|
|
359 }
|
|
360 #endif /* if 0 */
|
|
361
|
|
362 #define XXX_IMAGE_LIBRARY_IS_SOMEWHAT_BROKEN
|
|
363 static Visual *
|
|
364 x_try_best_visual_class (Screen *screen, int scrnum, int visual_class)
|
|
365 {
|
|
366 Display *dpy = DisplayOfScreen (screen);
|
|
367 XVisualInfo vi_in;
|
|
368 XVisualInfo *vi_out = NULL;
|
|
369 int out_count;
|
|
370
|
|
371 vi_in.class = visual_class;
|
|
372 vi_in.screen = scrnum;
|
|
373 vi_out = XGetVisualInfo (dpy, (VisualClassMask | VisualScreenMask),
|
|
374 &vi_in, &out_count);
|
|
375 if ( vi_out )
|
|
376 {
|
|
377 int i, best;
|
|
378 Visual *visual;
|
|
379 for (i = 0, best = 0; i < out_count; i++)
|
|
380 /* It's better if it's deeper, or if it's the same depth with
|
|
381 more cells (does that ever happen? Well, it could...)
|
|
382 NOTE: don't allow pseudo color to get larger than 8! */
|
|
383 if (((vi_out [i].depth > vi_out [best].depth) ||
|
|
384 ((vi_out [i].depth == vi_out [best].depth) &&
|
|
385 (vi_out [i].colormap_size > vi_out [best].colormap_size)))
|
|
386 #ifdef XXX_IMAGE_LIBRARY_IS_SOMEWHAT_BROKEN
|
|
387 /* For now, the image library doesn't like PseudoColor visuals
|
|
388 of depths other than 1 or 8. Depths greater than 8 only occur
|
|
389 on machines which have TrueColor anyway, so probably we'll end
|
|
390 up using that (it is the one that `Best' would pick) but if a
|
|
391 PseudoColor visual is explicitly specified, pick the 8 bit one.
|
|
392 */
|
|
393 && (visual_class != PseudoColor ||
|
|
394 vi_out [i].depth == 1 ||
|
|
395 vi_out [i].depth == 8)
|
|
396 #endif
|
|
397
|
|
398 /* SGI has 30-bit deep visuals. Ignore them.
|
|
399 (We only have 24-bit data anyway.)
|
|
400 */
|
|
401 && (vi_out [i].depth <= 24)
|
|
402 )
|
|
403 best = i;
|
|
404 visual = vi_out[best].visual;
|
|
405 XFree ((char *) vi_out);
|
|
406 return visual;
|
|
407 }
|
|
408 else
|
|
409 return 0;
|
|
410 }
|
|
411
|
|
412 static int
|
|
413 x_get_visual_depth (Display *dpy, Visual *visual)
|
|
414 {
|
|
415 XVisualInfo vi_in;
|
|
416 XVisualInfo *vi_out;
|
|
417 int out_count, d;
|
|
418
|
|
419 vi_in.visualid = XVisualIDFromVisual (visual);
|
|
420 vi_out = XGetVisualInfo (dpy, /*VisualScreenMask|*/VisualIDMask,
|
|
421 &vi_in, &out_count);
|
|
422 if (! vi_out) abort ();
|
|
423 d = vi_out [0].depth;
|
|
424 XFree ((char *) vi_out);
|
|
425 return d;
|
|
426 }
|
|
427
|
|
428 static Visual *
|
|
429 x_try_best_visual (Display *dpy, int scrnum)
|
|
430 {
|
|
431 Visual *visual = NULL;
|
|
432 Screen *screen = ScreenOfDisplay (dpy, scrnum);
|
|
433 if ((visual = x_try_best_visual_class (screen, scrnum, TrueColor))
|
|
434 && x_get_visual_depth (dpy, visual) >= 16 )
|
|
435 return visual;
|
|
436 if ((visual = x_try_best_visual_class (screen, scrnum, PseudoColor)))
|
|
437 return visual;
|
|
438 if ((visual = x_try_best_visual_class (screen, scrnum, TrueColor)))
|
|
439 return visual;
|
|
440 #ifdef DIRECTCOLOR_WORKS
|
|
441 if ((visual = x_try_best_visual_class (screen, scrnum, DirectColor)))
|
|
442 return visual;
|
|
443 #endif
|
|
444
|
|
445 visual = DefaultVisualOfScreen (screen);
|
|
446 if ( x_get_visual_depth (dpy, visual) >= 8 )
|
|
447 return visual;
|
|
448
|
|
449 if ((visual = x_try_best_visual_class (screen, scrnum, StaticGray)))
|
|
450 return visual;
|
|
451 if ((visual = x_try_best_visual_class (screen, scrnum, GrayScale)))
|
|
452 return visual;
|
|
453 return DefaultVisualOfScreen (screen);
|
|
454 }
|
|
455
|
|
456
|
|
457 static void
|
|
458 x_init_device (struct device *d, Lisp_Object props)
|
|
459 {
|
|
460 Lisp_Object display;
|
|
461 Lisp_Object device;
|
|
462 Display *dpy;
|
|
463 Widget app_shell;
|
|
464 int argc;
|
442
|
465 Extbyte **argv;
|
|
466 const char *app_class;
|
|
467 const char *app_name;
|
|
468 const char *disp_name;
|
428
|
469 Visual *visual = NULL;
|
|
470 int depth = 8; /* shut up the compiler */
|
|
471 Colormap cmap;
|
|
472 int screen;
|
|
473 /* */
|
|
474 int best_visual_found = 0;
|
|
475
|
442
|
476 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D)
|
440
|
477 /*
|
|
478 * In order to avoid the lossage with flat Athena widgets dynamically
|
|
479 * linking to one of the ThreeD variants, using the dynamic symbol helpers
|
|
480 * to look for symbols that shouldn't be there and refusing to run if they
|
|
481 * are seems a less toxic idea than having XEmacs crash when we try and
|
|
482 * use a subclass of a widget that has changed size.
|
|
483 *
|
|
484 * It's ugly, I know, and not going to work everywhere. It seems better to
|
|
485 * do our damnedest to try and tell the user what to expect rather than
|
|
486 * simply blow up though.
|
|
487 *
|
|
488 * All the ThreeD variants I have access to define the following function
|
|
489 * symbols in the shared library. The flat Xaw library does not define them:
|
|
490 *
|
|
491 * Xaw3dComputeBottomShadowRGB
|
|
492 * Xaw3dComputeTopShadowRGB
|
|
493 *
|
|
494 * So far only Linux has shown this problem. This seems to be portable to
|
|
495 * all the distributions (certainly all the ones I checked - Debian and
|
|
496 * Redhat)
|
|
497 *
|
|
498 * This will only work, sadly, with dlopen() -- the other dynamic linkers
|
|
499 * are simply not capable of doing what is needed. :/
|
|
500 */
|
|
501
|
|
502 {
|
|
503 /* Get a dll handle to the main process. */
|
|
504 dll_handle xaw_dll_handle = dll_open (NULL);
|
|
505
|
|
506 /* Did that fail? If so, continue without error.
|
|
507 * We could die here but, well, that's unfriendly and all -- plus I feel
|
|
508 * better about some crashing somewhere rather than preventing a perfectly
|
|
509 * good configuration working just because dll_open failed.
|
|
510 */
|
|
511 if (xaw_dll_handle != NULL)
|
|
512 {
|
|
513 /* Look for the Xaw3d function */
|
|
514 dll_func xaw_function_handle =
|
|
515 dll_function (xaw_dll_handle, "Xaw3dComputeTopShadowRGB");
|
|
516
|
|
517 /* If we found it, warn the user in big, nasty, unfriendly letters */
|
|
518 if (xaw_function_handle != NULL)
|
|
519 {
|
|
520 warn_when_safe (Qdevice, Qerror, "\n"
|
|
521 "It seems that XEmacs is built dynamically linked to the flat Athena widget\n"
|
|
522 "library but it finds a 3D Athena variant with the same name at runtime.\n"
|
|
523 "\n"
|
|
524 "This WILL cause your XEmacs process to dump core at some point.\n"
|
|
525 "You should not continue to use this binary without resolving this issue.\n"
|
|
526 "\n"
|
|
527 "This can be solved with the xaw-wrappers package under Debian\n"
|
|
528 "(register XEmacs as incompatible with all 3d widget sets, see\n"
|
|
529 "update-xaw-wrappers(8) and .../doc/xaw-wrappers/README.packagers). It\n"
|
|
530 "can be verified by checking the runtime path in /etc/ld.so.conf and by\n"
|
|
531 "using `ldd /path/to/xemacs' under other Linux distributions. One\n"
|
|
532 "solution is to use LD_PRELOAD or LD_LIBRARY_PATH to force ld.so to\n"
|
|
533 "load the flat Athena widget library instead of the aliased 3D widget\n"
|
|
534 "library (see ld.so(8) for use of these environment variables).\n\n"
|
|
535 );
|
|
536
|
|
537 }
|
|
538
|
|
539 /* Otherwise release the handle to the library
|
|
540 * No error catch here; I can't think of a way to recover anyhow.
|
|
541 */
|
|
542 dll_close (xaw_dll_handle);
|
|
543 }
|
|
544 }
|
442
|
545 #endif /* HAVE_SHLIB and LWLIB_USES_ATHENA and not HAVE_ATHENA_3D */
|
440
|
546
|
|
547
|
428
|
548 XSETDEVICE (device, d);
|
|
549 display = DEVICE_CONNECTION (d);
|
|
550
|
|
551 allocate_x_device_struct (d);
|
|
552
|
|
553 make_argc_argv (Vx_initial_argv_list, &argc, &argv);
|
|
554
|
442
|
555 LISP_STRING_TO_EXTERNAL (display, disp_name, Qctext);
|
428
|
556
|
|
557 /*
|
|
558 * Break apart the old XtOpenDisplay call into XOpenDisplay and
|
|
559 * XtDisplayInitialize so we can figure out whether there
|
|
560 * are any XEmacs resources in the resource database before
|
|
561 * we initialize Xt. This is so we can automagically support
|
|
562 * both `Emacs' and `XEmacs' application classes.
|
|
563 */
|
|
564 slow_down_interrupts ();
|
|
565 /* May not be needed but XtOpenDisplay could not deal with signals here. */
|
|
566 dpy = DEVICE_X_DISPLAY (d) = XOpenDisplay (disp_name);
|
|
567 speed_up_interrupts ();
|
|
568
|
|
569 if (dpy == 0)
|
|
570 {
|
|
571 suppress_early_error_handler_backtrace = 1;
|
563
|
572 gui_error ("X server not responding\n", display);
|
428
|
573 }
|
|
574
|
|
575 if (STRINGP (Vx_emacs_application_class) &&
|
|
576 XSTRING_LENGTH (Vx_emacs_application_class) > 0)
|
442
|
577 LISP_STRING_TO_EXTERNAL (Vx_emacs_application_class, app_class, Qctext);
|
428
|
578 else
|
|
579 {
|
|
580 app_class = (NILP (Vx_emacs_application_class) &&
|
|
581 have_xemacs_resources_in_xrdb (dpy))
|
|
582 #ifdef INFODOCK
|
|
583 ? "InfoDock"
|
|
584 #else
|
|
585 ? "XEmacs"
|
|
586 #endif
|
|
587 : "Emacs";
|
|
588 /* need to update Vx_emacs_application_class: */
|
|
589 Vx_emacs_application_class = build_string (app_class);
|
|
590 }
|
|
591
|
|
592 slow_down_interrupts ();
|
|
593 /* May not be needed but XtOpenDisplay could not deal with signals here.
|
|
594 Yuck. */
|
|
595 XtDisplayInitialize (Xt_app_con, dpy, compute_x_app_name (argc, argv),
|
|
596 app_class, emacs_options,
|
442
|
597 XtNumber (emacs_options), &argc, (char **) argv);
|
428
|
598 speed_up_interrupts ();
|
|
599
|
|
600 screen = DefaultScreen (dpy);
|
|
601 if (NILP (Vdefault_x_device))
|
|
602 Vdefault_x_device = device;
|
|
603
|
|
604 #ifdef MULE
|
|
605 #if defined(LWLIB_MENUBARS_MOTIF) || defined(HAVE_XIM) || defined (USE_XFONTSET)
|
|
606 {
|
|
607 /* Read in locale-specific resources from
|
|
608 data-directory/app-defaults/$LANG/Emacs.
|
|
609 This is in addition to the standard app-defaults files, and
|
|
610 does not override resources defined elsewhere */
|
442
|
611 const char *data_dir;
|
428
|
612 char *path;
|
|
613 XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */
|
442
|
614 const char *locale = XrmLocaleOfDatabase (db);
|
428
|
615
|
|
616 if (STRINGP (Vx_app_defaults_directory) &&
|
|
617 XSTRING_LENGTH (Vx_app_defaults_directory) > 0)
|
|
618 {
|
442
|
619 LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, Qfile_name);
|
428
|
620 path = (char *)alloca (strlen (data_dir) + strlen (locale) + 7);
|
|
621 sprintf (path, "%s%s/Emacs", data_dir, locale);
|
|
622 if (!access (path, R_OK))
|
|
623 XrmCombineFileDatabase (path, &db, False);
|
|
624 }
|
|
625 else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0)
|
|
626 {
|
442
|
627 LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name);
|
428
|
628 path = (char *)alloca (strlen (data_dir) + 13 + strlen (locale) + 7);
|
|
629 sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale);
|
|
630 if (!access (path, R_OK))
|
|
631 XrmCombineFileDatabase (path, &db, False);
|
|
632 }
|
|
633 }
|
|
634 #endif /* LWLIB_MENUBARS_MOTIF or HAVE_XIM USE_XFONTSET */
|
|
635 #endif /* MULE */
|
|
636
|
|
637 if (NILP (DEVICE_NAME (d)))
|
|
638 DEVICE_NAME (d) = display;
|
|
639
|
|
640 /* We're going to modify the string in-place, so be a nice XEmacs */
|
|
641 DEVICE_NAME (d) = Fcopy_sequence (DEVICE_NAME (d));
|
|
642 /* colons and periods can't appear in individual elements of resource
|
|
643 strings */
|
|
644
|
|
645 XtGetApplicationNameAndClass (dpy, (char **) &app_name, (char **) &app_class);
|
|
646 /* search for a matching visual if requested by the user, or setup the display default */
|
|
647 {
|
|
648 int resource_name_length = max (sizeof (".emacsVisual"),
|
|
649 sizeof (".privateColormap"));
|
|
650 char *buf1 = alloca_array (char, strlen (app_name) + resource_name_length);
|
|
651 char *buf2 = alloca_array (char, strlen (app_class) + resource_name_length);
|
|
652 char *type;
|
|
653 XrmValue value;
|
|
654
|
|
655 sprintf (buf1, "%s.emacsVisual", app_name);
|
|
656 sprintf (buf2, "%s.EmacsVisual", app_class);
|
|
657 if (XrmGetResource (XtDatabase (dpy), buf1, buf2, &type, &value) == True)
|
|
658 {
|
|
659 int cnt = 0;
|
|
660 int vis_class = PseudoColor;
|
|
661 XVisualInfo vinfo;
|
|
662 char *str = (char*) value.addr;
|
|
663
|
|
664 #define CHECK_VIS_CLASS(visual_class) \
|
|
665 else if (memcmp (str, #visual_class, sizeof (#visual_class) - 1) == 0) \
|
|
666 cnt = sizeof (#visual_class) - 1, vis_class = visual_class
|
|
667
|
|
668 if (1)
|
|
669 ;
|
|
670 CHECK_VIS_CLASS (StaticGray);
|
|
671 CHECK_VIS_CLASS (StaticColor);
|
|
672 CHECK_VIS_CLASS (TrueColor);
|
|
673 CHECK_VIS_CLASS (GrayScale);
|
|
674 CHECK_VIS_CLASS (PseudoColor);
|
|
675 CHECK_VIS_CLASS (DirectColor);
|
|
676
|
|
677 if (cnt)
|
|
678 {
|
|
679 depth = atoi (str + cnt);
|
|
680 if (depth == 0)
|
|
681 {
|
|
682 stderr_out ("Invalid Depth specification in %s... ignoring...\n", str);
|
|
683 }
|
|
684 else
|
|
685 {
|
|
686 if (XMatchVisualInfo (dpy, screen, depth, vis_class, &vinfo))
|
|
687 {
|
|
688 visual = vinfo.visual;
|
|
689 }
|
|
690 else
|
|
691 {
|
|
692 stderr_out ("Can't match the requested visual %s... using defaults\n", str);
|
|
693 }
|
|
694 }
|
|
695 }
|
|
696 else
|
|
697 {
|
|
698 stderr_out( "Invalid Visual specification in %s... ignoring.\n", str);
|
|
699 }
|
|
700 }
|
|
701 if (visual == NULL)
|
|
702 {
|
|
703 /*
|
|
704 visual = DefaultVisual(dpy, screen);
|
|
705 depth = DefaultDepth(dpy, screen);
|
|
706 */
|
|
707 visual = x_try_best_visual (dpy, screen);
|
|
708 depth = x_get_visual_depth (dpy, visual);
|
|
709 best_visual_found = (visual != DefaultVisual (dpy, screen));
|
|
710 }
|
|
711
|
|
712 /* If we've got the same visual as the default and it's PseudoColor,
|
|
713 check to see if the user specified that we need a private colormap */
|
|
714 if (visual == DefaultVisual (dpy, screen))
|
|
715 {
|
|
716 sprintf (buf1, "%s.privateColormap", app_name);
|
|
717 sprintf (buf2, "%s.PrivateColormap", app_class);
|
|
718 if ((visual->class == PseudoColor) &&
|
|
719 (XrmGetResource (XtDatabase (dpy), buf1, buf2, &type, &value) == True))
|
|
720 {
|
|
721 cmap = XCopyColormapAndFree (dpy, DefaultColormap (dpy, screen));
|
|
722 }
|
|
723 else
|
|
724 {
|
|
725 cmap = DefaultColormap (dpy, screen);
|
|
726 }
|
|
727 }
|
|
728 else
|
|
729 {
|
|
730 if ( best_visual_found )
|
|
731 {
|
|
732 cmap = XCreateColormap (dpy, RootWindow (dpy, screen), visual, AllocNone);
|
|
733 }
|
|
734 else
|
|
735 {
|
|
736 /* We have to create a matching colormap anyway...
|
440
|
737 #### think about using standard colormaps (need the Xmu libs?) */
|
428
|
738 cmap = XCreateColormap(dpy, RootWindow(dpy, screen), visual, AllocNone);
|
|
739 XInstallColormap(dpy, cmap);
|
|
740 }
|
|
741 }
|
|
742 }
|
|
743
|
|
744 DEVICE_X_VISUAL (d) = visual;
|
|
745 DEVICE_X_COLORMAP (d) = cmap;
|
|
746 DEVICE_X_DEPTH (d) = depth;
|
|
747 validify_resource_component ((char *) XSTRING_DATA (DEVICE_NAME (d)),
|
|
748 XSTRING_LENGTH (DEVICE_NAME (d)));
|
|
749
|
|
750 {
|
|
751 Arg al[3];
|
|
752 XtSetArg (al[0], XtNvisual, visual);
|
|
753 XtSetArg (al[1], XtNdepth, depth);
|
|
754 XtSetArg (al[2], XtNcolormap, cmap);
|
|
755
|
|
756 app_shell = XtAppCreateShell (NULL, app_class,
|
|
757 applicationShellWidgetClass,
|
|
758 dpy, al, countof (al));
|
|
759 }
|
|
760
|
|
761 DEVICE_XT_APP_SHELL (d) = app_shell;
|
|
762
|
|
763 #ifdef HAVE_XIM
|
|
764 XIM_init_device(d);
|
|
765 #endif /* HAVE_XIM */
|
|
766
|
|
767 /* Realize the app_shell so that its window exists for GC creation purposes,
|
|
768 and set it to the size of the root window for child placement purposes */
|
|
769 {
|
|
770 Arg al[5];
|
|
771 XtSetArg (al[0], XtNmappedWhenManaged, False);
|
|
772 XtSetArg (al[1], XtNx, 0);
|
|
773 XtSetArg (al[2], XtNy, 0);
|
|
774 XtSetArg (al[3], XtNwidth, WidthOfScreen (ScreenOfDisplay (dpy, screen)));
|
|
775 XtSetArg (al[4], XtNheight, HeightOfScreen (ScreenOfDisplay (dpy, screen)));
|
|
776 XtSetValues (app_shell, al, countof (al));
|
|
777 XtRealizeWidget (app_shell);
|
|
778 }
|
|
779
|
|
780 #ifdef HAVE_WMCOMMAND
|
|
781 {
|
|
782 int new_argc;
|
442
|
783 Extbyte **new_argv;
|
428
|
784 make_argc_argv (Vcommand_line_args, &new_argc, &new_argv);
|
442
|
785 XSetCommand (XtDisplay (app_shell), XtWindow (app_shell),
|
|
786 (char **) new_argv, new_argc);
|
428
|
787 free_argc_argv (new_argv);
|
|
788 }
|
|
789 #endif /* HAVE_WMCOMMAND */
|
|
790
|
|
791
|
|
792 #ifdef HAVE_OFFIX_DND
|
|
793 DndInitialize ( app_shell );
|
|
794 #endif
|
|
795
|
|
796 Vx_initial_argv_list = make_arg_list (argc, argv);
|
|
797 free_argc_argv (argv);
|
|
798
|
|
799 DEVICE_X_WM_COMMAND_FRAME (d) = Qnil;
|
|
800
|
|
801 sanity_check_geometry_resource (dpy);
|
|
802
|
|
803 /* In event-Xt.c */
|
|
804 x_init_modifier_mapping (d);
|
|
805
|
|
806 DEVICE_INFD (d) = DEVICE_OUTFD (d) = ConnectionNumber (dpy);
|
|
807 init_baud_rate (d);
|
|
808 init_one_device (d);
|
|
809
|
|
810 DEVICE_X_GC_CACHE (d) = make_gc_cache (dpy, XtWindow(app_shell));
|
|
811 DEVICE_X_GRAY_PIXMAP (d) = None;
|
|
812 Xatoms_of_device_x (d);
|
440
|
813 Xatoms_of_select_x (d);
|
428
|
814 Xatoms_of_objects_x (d);
|
|
815 x_init_device_class (d);
|
|
816
|
|
817 /* Run the elisp side of the X device initialization. */
|
|
818 call0 (Qinit_pre_x_win);
|
|
819 }
|
|
820
|
|
821 static void
|
|
822 x_finish_init_device (struct device *d, Lisp_Object props)
|
|
823 {
|
|
824 call0 (Qinit_post_x_win);
|
|
825 }
|
|
826
|
|
827 static void
|
|
828 x_mark_device (struct device *d)
|
|
829 {
|
|
830 mark_object (DEVICE_X_WM_COMMAND_FRAME (d));
|
|
831 mark_object (DEVICE_X_DATA (d)->x_keysym_map_hash_table);
|
|
832 }
|
|
833
|
|
834
|
|
835 /************************************************************************/
|
|
836 /* closing an X connection */
|
|
837 /************************************************************************/
|
|
838
|
|
839 static void
|
|
840 free_x_device_struct (struct device *d)
|
|
841 {
|
|
842 xfree (d->device_data);
|
|
843 }
|
|
844
|
|
845 static void
|
|
846 x_delete_device (struct device *d)
|
|
847 {
|
|
848 Lisp_Object device;
|
|
849 Display *display;
|
|
850 #ifdef FREE_CHECKING
|
|
851 extern void (*__free_hook) (void *);
|
|
852 int checking_free;
|
|
853 #endif
|
|
854
|
|
855 XSETDEVICE (device, d);
|
|
856 display = DEVICE_X_DISPLAY (d);
|
|
857
|
|
858 if (display)
|
|
859 {
|
|
860 #ifdef FREE_CHECKING
|
|
861 checking_free = (__free_hook != 0);
|
|
862
|
|
863 /* Disable strict free checking, to avoid bug in X library */
|
|
864 if (checking_free)
|
|
865 disable_strict_free_check ();
|
|
866 #endif
|
|
867
|
|
868 free_gc_cache (DEVICE_X_GC_CACHE (d));
|
|
869 if (DEVICE_X_DATA (d)->x_modifier_keymap)
|
|
870 XFreeModifiermap (DEVICE_X_DATA (d)->x_modifier_keymap);
|
|
871 if (DEVICE_X_DATA (d)->x_keysym_map)
|
|
872 XFree ((char *) DEVICE_X_DATA (d)->x_keysym_map);
|
|
873
|
|
874 if (DEVICE_XT_APP_SHELL (d))
|
|
875 {
|
|
876 XtDestroyWidget (DEVICE_XT_APP_SHELL (d));
|
|
877 DEVICE_XT_APP_SHELL (d) = NULL;
|
|
878 }
|
|
879
|
|
880 XtCloseDisplay (display);
|
|
881 DEVICE_X_DISPLAY (d) = 0;
|
|
882 #ifdef FREE_CHECKING
|
|
883 if (checking_free)
|
|
884 enable_strict_free_check ();
|
|
885 #endif
|
|
886 }
|
|
887
|
|
888 if (EQ (device, Vdefault_x_device))
|
|
889 {
|
|
890 Lisp_Object devcons, concons;
|
|
891 /* #### handle deleting last X device */
|
|
892 Vdefault_x_device = Qnil;
|
|
893 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
894 {
|
|
895 if (DEVICE_X_P (XDEVICE (XCAR (devcons))) &&
|
|
896 !EQ (device, XCAR (devcons)))
|
|
897 {
|
|
898 Vdefault_x_device = XCAR (devcons);
|
|
899 goto double_break;
|
|
900 }
|
|
901 }
|
|
902 }
|
|
903 double_break:
|
|
904 free_x_device_struct (d);
|
|
905 }
|
|
906
|
|
907
|
|
908 /************************************************************************/
|
|
909 /* handle X errors */
|
|
910 /************************************************************************/
|
|
911
|
442
|
912 const char *
|
428
|
913 x_event_name (int event_type)
|
|
914 {
|
442
|
915 static const char *events[] =
|
428
|
916 {
|
|
917 "0: ERROR!",
|
|
918 "1: REPLY",
|
|
919 "KeyPress",
|
|
920 "KeyRelease",
|
|
921 "ButtonPress",
|
|
922 "ButtonRelease",
|
|
923 "MotionNotify",
|
|
924 "EnterNotify",
|
|
925 "LeaveNotify",
|
|
926 "FocusIn",
|
|
927 "FocusOut",
|
|
928 "KeymapNotify",
|
|
929 "Expose",
|
|
930 "GraphicsExpose",
|
|
931 "NoExpose",
|
|
932 "VisibilityNotify",
|
|
933 "CreateNotify",
|
|
934 "DestroyNotify",
|
|
935 "UnmapNotify",
|
|
936 "MapNotify",
|
|
937 "MapRequest",
|
|
938 "ReparentNotify",
|
|
939 "ConfigureNotify",
|
|
940 "ConfigureRequest",
|
|
941 "GravityNotify",
|
|
942 "ResizeRequest",
|
|
943 "CirculateNotify",
|
|
944 "CirculateRequest",
|
|
945 "PropertyNotify",
|
|
946 "SelectionClear",
|
|
947 "SelectionRequest",
|
|
948 "SelectionNotify",
|
|
949 "ColormapNotify",
|
|
950 "ClientMessage",
|
|
951 "MappingNotify",
|
|
952 "LASTEvent"
|
|
953 };
|
|
954
|
|
955 if (event_type < 0 || event_type >= countof (events))
|
|
956 return NULL;
|
|
957 return events [event_type];
|
|
958 }
|
|
959
|
|
960 /* Handling errors.
|
|
961
|
|
962 If an X error occurs which we are not expecting, we have no alternative
|
|
963 but to print it to stderr. It would be nice to stuff it into a pop-up
|
|
964 buffer, or to print it in the minibuffer, but that's not possible, because
|
|
965 one is not allowed to do any I/O on the display connection from an error
|
|
966 handler. The guts of Xlib expect these functions to either return or exit.
|
|
967
|
|
968 However, there are occasions when we might expect an error to reasonably
|
|
969 occur. The interface to this is as follows:
|
|
970
|
|
971 Before calling some X routine which may error, call
|
|
972 expect_x_error (dpy);
|
|
973
|
|
974 Just after calling the X routine, call either:
|
|
975
|
|
976 x_error_occurred_p (dpy);
|
|
977
|
|
978 to ask whether an error happened (and was ignored), or:
|
|
979
|
|
980 signal_if_x_error (dpy, resumable_p);
|
|
981
|
|
982 which will call Fsignal() with args appropriate to the X error, if there
|
|
983 was one. (Resumable_p is whether the debugger should be allowed to
|
|
984 continue from the call to signal.)
|
|
985
|
|
986 You must call one of these two routines immediately after calling the X
|
|
987 routine; think of them as bookends like BLOCK_INPUT and UNBLOCK_INPUT.
|
|
988 */
|
|
989
|
|
990 static int error_expected;
|
|
991 static int error_occurred;
|
|
992 static XErrorEvent last_error;
|
|
993
|
|
994 /* OVERKILL! */
|
|
995
|
|
996 #ifdef EXTERNAL_WIDGET
|
|
997 static Lisp_Object
|
|
998 x_error_handler_do_enqueue (Lisp_Object frame)
|
|
999 {
|
|
1000 enqueue_magic_eval_event (io_error_delete_frame, frame);
|
|
1001 return Qt;
|
|
1002 }
|
|
1003
|
|
1004 static Lisp_Object
|
|
1005 x_error_handler_error (Lisp_Object data, Lisp_Object dummy)
|
|
1006 {
|
|
1007 return Qnil;
|
|
1008 }
|
|
1009 #endif /* EXTERNAL_WIDGET */
|
|
1010
|
|
1011 int
|
|
1012 x_error_handler (Display *disp, XErrorEvent *event)
|
|
1013 {
|
|
1014 if (error_expected)
|
|
1015 {
|
|
1016 error_expected = 0;
|
|
1017 error_occurred = 1;
|
|
1018 last_error = *event;
|
|
1019 }
|
|
1020 else
|
|
1021 {
|
|
1022 #ifdef EXTERNAL_WIDGET
|
|
1023 struct frame *f;
|
|
1024 struct device *d = get_device_from_display (disp);
|
|
1025
|
|
1026 if ((event->error_code == BadWindow ||
|
|
1027 event->error_code == BadDrawable)
|
|
1028 && ((f = x_any_window_to_frame (d, event->resourceid)) != 0))
|
|
1029 {
|
|
1030 Lisp_Object frame;
|
|
1031
|
|
1032 /* one of the windows comprising one of our frames has died.
|
|
1033 This occurs particularly with ExternalShell frames when the
|
|
1034 client that owns the ExternalShell's window dies.
|
|
1035
|
|
1036 We cannot do any I/O on the display connection so we need
|
|
1037 to enqueue an eval event so that the deletion happens
|
|
1038 later.
|
|
1039
|
|
1040 Furthermore, we need to trap any errors (out-of-memory) that
|
|
1041 may occur when Fenqueue_eval_event is called.
|
|
1042 */
|
|
1043
|
|
1044 if (f->being_deleted)
|
|
1045 return 0;
|
|
1046 XSETFRAME (frame, f);
|
|
1047 if (!NILP (condition_case_1 (Qerror, x_error_handler_do_enqueue,
|
|
1048 frame, x_error_handler_error, Qnil)))
|
|
1049 {
|
|
1050 f->being_deleted = 1;
|
|
1051 f->visible = 0;
|
|
1052 }
|
|
1053 return 0;
|
|
1054 }
|
|
1055 #endif /* EXTERNAL_WIDGET */
|
|
1056
|
|
1057 stderr_out ("\n%s: ",
|
|
1058 (STRINGP (Vinvocation_name)
|
|
1059 ? (char *) XSTRING_DATA (Vinvocation_name)
|
|
1060 : "xemacs"));
|
|
1061 XmuPrintDefaultErrorMessage (disp, event, stderr);
|
|
1062 }
|
|
1063 return 0;
|
|
1064 }
|
|
1065
|
|
1066 void
|
|
1067 expect_x_error (Display *dpy)
|
|
1068 {
|
|
1069 assert (!error_expected);
|
|
1070 XSync (dpy, 0); /* handle pending errors before setting flag */
|
|
1071 error_expected = 1;
|
|
1072 error_occurred = 0;
|
|
1073 }
|
|
1074
|
|
1075 int
|
|
1076 x_error_occurred_p (Display *dpy)
|
|
1077 {
|
|
1078 int val;
|
|
1079 XSync (dpy, 0); /* handle pending errors before setting flag */
|
|
1080 val = error_occurred;
|
|
1081 error_expected = 0;
|
|
1082 error_occurred = 0;
|
|
1083 return val;
|
|
1084 }
|
|
1085
|
|
1086 int
|
|
1087 signal_if_x_error (Display *dpy, int resumable_p)
|
|
1088 {
|
|
1089 char buf[1024];
|
|
1090 Lisp_Object data;
|
|
1091 if (! x_error_occurred_p (dpy))
|
|
1092 return 0;
|
|
1093 data = Qnil;
|
|
1094 sprintf (buf, "0x%X", (unsigned int) last_error.resourceid);
|
|
1095 data = Fcons (build_string (buf), data);
|
|
1096 {
|
|
1097 char num [32];
|
|
1098 sprintf (num, "%d", last_error.request_code);
|
|
1099 XGetErrorDatabaseText (last_error.display, "XRequest", num, "",
|
|
1100 buf, sizeof (buf));
|
|
1101 if (! *buf)
|
|
1102 sprintf (buf, "Request-%d", last_error.request_code);
|
|
1103 data = Fcons (build_string (buf), data);
|
|
1104 }
|
|
1105 XGetErrorText (last_error.display, last_error.error_code, buf, sizeof (buf));
|
|
1106 data = Fcons (build_string (buf), data);
|
|
1107 again:
|
|
1108 Fsignal (Qx_error, data);
|
|
1109 if (! resumable_p) goto again;
|
|
1110 return 1;
|
|
1111 }
|
|
1112
|
|
1113 int
|
|
1114 x_IO_error_handler (Display *disp)
|
|
1115 {
|
|
1116 /* This function can GC */
|
|
1117 Lisp_Object dev;
|
|
1118 struct device *d = get_device_from_display_1 (disp);
|
|
1119
|
|
1120 assert (d != NULL);
|
|
1121 XSETDEVICE (dev, d);
|
|
1122
|
|
1123 if (NILP (find_nonminibuffer_frame_not_on_device (dev)))
|
|
1124 {
|
|
1125 /* We're going down. */
|
|
1126 stderr_out
|
|
1127 ("\n%s: Fatal I/O Error %d (%s) on display connection \"%s\"\n",
|
|
1128 (STRINGP (Vinvocation_name) ?
|
|
1129 (char *) XSTRING_DATA (Vinvocation_name) : "xemacs"),
|
|
1130 errno, strerror (errno), DisplayString (disp));
|
|
1131 stderr_out
|
|
1132 (" after %lu requests (%lu known processed) with %d events remaining.\n",
|
|
1133 NextRequest (disp) - 1, LastKnownRequestProcessed (disp),
|
|
1134 QLength (disp));
|
|
1135 /* assert (!_Xdebug); */
|
|
1136 }
|
|
1137 else
|
|
1138 {
|
|
1139 warn_when_safe
|
|
1140 (Qx, Qcritical,
|
|
1141 "I/O Error %d (%s) on display connection\n"
|
|
1142 " \"%s\" after after %lu requests (%lu known processed)\n"
|
|
1143 " with %d events remaining.\n"
|
|
1144 " Throwing to top level.\n",
|
|
1145 errno, strerror (errno), DisplayString (disp),
|
|
1146 NextRequest (disp) - 1, LastKnownRequestProcessed (disp),
|
|
1147 QLength (disp));
|
|
1148 }
|
|
1149
|
|
1150 /* According to X specs, we should not return from this function, or
|
|
1151 Xlib might just decide to exit(). So we mark the offending
|
|
1152 console for deletion and throw to top level. */
|
|
1153 if (d)
|
|
1154 enqueue_magic_eval_event (io_error_delete_device, dev);
|
|
1155 DEVICE_X_BEING_DELETED (d) = 1;
|
|
1156 Fthrow (Qtop_level, Qnil);
|
|
1157
|
|
1158 return 0; /* not reached */
|
|
1159 }
|
|
1160
|
|
1161 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /*
|
|
1162 With a true arg, make the connection to the X server synchronous.
|
|
1163 With false, make it asynchronous. Synchronous connections are much slower,
|
|
1164 but are useful for debugging. (If you get X errors, make the connection
|
|
1165 synchronous, and use a debugger to set a breakpoint on `x_error_handler'.
|
|
1166 Your backtrace of the C stack will now be useful. In asynchronous mode,
|
|
1167 the stack above `x_error_handler' isn't helpful because of buffering.)
|
|
1168 If DEVICE is not specified, the selected device is assumed.
|
|
1169
|
|
1170 Calling this function is the same as calling the C function `XSynchronize',
|
|
1171 or starting the program with the `-sync' command line argument.
|
|
1172 */
|
|
1173 (arg, device))
|
|
1174 {
|
|
1175 struct device *d = decode_x_device (device);
|
|
1176
|
|
1177 XSynchronize (DEVICE_X_DISPLAY (d), !NILP (arg));
|
|
1178
|
|
1179 if (!NILP (arg))
|
|
1180 message ("X connection is synchronous");
|
|
1181 else
|
|
1182 message ("X connection is asynchronous");
|
|
1183
|
|
1184 return arg;
|
|
1185 }
|
|
1186
|
|
1187
|
|
1188 /************************************************************************/
|
|
1189 /* X resources */
|
|
1190 /************************************************************************/
|
|
1191
|
|
1192 #if 0 /* bah humbug. The whole "widget == resource" stuff is such
|
|
1193 a crock of shit that I'm just going to ignore it all. */
|
|
1194
|
|
1195 /* If widget is NULL, we are retrieving device or global face data. */
|
|
1196
|
|
1197 static void
|
|
1198 construct_name_list (Display *display, Widget widget, char *fake_name,
|
|
1199 char *fake_class, char *name, char *class)
|
|
1200 {
|
|
1201 char *stack [100][2];
|
|
1202 Widget this;
|
|
1203 int count = 0;
|
|
1204 char *name_tail, *class_tail;
|
|
1205
|
|
1206 if (widget)
|
|
1207 {
|
|
1208 for (this = widget; this; this = XtParent (this))
|
|
1209 {
|
|
1210 stack [count][0] = this->core.name;
|
|
1211 stack [count][1] = XtClass (this)->core_class.class_name;
|
|
1212 count++;
|
|
1213 }
|
|
1214 count--;
|
|
1215 }
|
|
1216 else if (fake_name && fake_class)
|
|
1217 {
|
|
1218 stack [count][0] = fake_name;
|
|
1219 stack [count][1] = fake_class;
|
|
1220 count++;
|
|
1221 }
|
|
1222
|
|
1223 /* The root widget is an application shell; resource lookups use the
|
|
1224 specified application name and application class in preference to
|
|
1225 the name/class of that widget (which is argv[0] / "ApplicationShell").
|
|
1226 Generally the app name and class will be argv[0] / "Emacs" but
|
|
1227 the former can be set via the -name command-line option, and the
|
|
1228 latter can be set by changing `x-emacs-application-class' in
|
|
1229 lisp/term/x-win.el.
|
|
1230 */
|
|
1231 XtGetApplicationNameAndClass (display,
|
|
1232 &stack [count][0],
|
|
1233 &stack [count][1]);
|
|
1234
|
|
1235 name [0] = 0;
|
|
1236 class [0] = 0;
|
|
1237
|
|
1238 name_tail = name;
|
|
1239 class_tail = class;
|
|
1240 for (; count >= 0; count--)
|
|
1241 {
|
|
1242 strcat (name_tail, stack [count][0]);
|
|
1243 for (; *name_tail; name_tail++)
|
|
1244 if (*name_tail == '.') *name_tail = '_';
|
|
1245 strcat (name_tail, ".");
|
|
1246 name_tail++;
|
|
1247
|
|
1248 strcat (class_tail, stack [count][1]);
|
|
1249 for (; *class_tail; class_tail++)
|
|
1250 if (*class_tail == '.') *class_tail = '_';
|
|
1251 strcat (class_tail, ".");
|
|
1252 class_tail++;
|
|
1253 }
|
|
1254 }
|
|
1255
|
|
1256 #endif /* 0 */
|
|
1257
|
442
|
1258 /* strcasecmp() is not sufficiently portable or standard,
|
|
1259 and it's easier just to write our own. */
|
|
1260 static int
|
|
1261 ascii_strcasecmp (const char *s1, const char *s2)
|
|
1262 {
|
|
1263 while (1)
|
|
1264 {
|
|
1265 char c1 = *s1++;
|
|
1266 char c2 = *s2++;
|
|
1267 if (c1 >= 'A' && c1 <= 'Z') c1 += 'a' - 'A';
|
|
1268 if (c2 >= 'A' && c2 <= 'Z') c2 += 'a' - 'A';
|
|
1269 if (c1 != c2) return c1 - c2;
|
|
1270 if (c1 == '\0') return 0;
|
|
1271 }
|
|
1272 }
|
|
1273
|
428
|
1274 static char_dynarr *name_char_dynarr;
|
|
1275 static char_dynarr *class_char_dynarr;
|
|
1276
|
|
1277 /* Given a locale and device specification from x-get-resource or
|
|
1278 x-get-resource-prefix, return the resource prefix and display to
|
|
1279 fetch the resource on. */
|
|
1280
|
|
1281 static void
|
|
1282 x_get_resource_prefix (Lisp_Object locale, Lisp_Object device,
|
|
1283 Display **display_out, char_dynarr *name,
|
|
1284 char_dynarr *class)
|
|
1285 {
|
|
1286 if (NILP (locale))
|
|
1287 locale = Qglobal;
|
|
1288 if (NILP (Fvalid_specifier_locale_p (locale)))
|
563
|
1289 invalid_argument ("Invalid locale", locale);
|
428
|
1290 if (WINDOWP (locale))
|
|
1291 /* #### I can't come up with any coherent way of naming windows.
|
|
1292 By relative position? That seems tricky because windows
|
|
1293 can change position, be split, etc. By order of creation?
|
|
1294 That seems less than useful. */
|
563
|
1295 signal_error (Qunimplemented,
|
|
1296 "Windows currently can't be resourced", locale);
|
428
|
1297
|
|
1298 if (!NILP (device) && !DEVICEP (device))
|
|
1299 CHECK_DEVICE (device);
|
|
1300 if (DEVICEP (device) && !DEVICE_X_P (XDEVICE (device)))
|
|
1301 device = Qnil;
|
|
1302 if (NILP (device))
|
|
1303 {
|
|
1304 device = DFW_DEVICE (locale);
|
|
1305 if (DEVICEP (device) && !DEVICE_X_P (XDEVICE (device)))
|
|
1306 device = Qnil;
|
|
1307 if (NILP (device))
|
|
1308 device = Vdefault_x_device;
|
|
1309 if (NILP (device))
|
|
1310 {
|
|
1311 *display_out = 0;
|
|
1312 return;
|
|
1313 }
|
|
1314 }
|
|
1315
|
|
1316 *display_out = DEVICE_X_DISPLAY (XDEVICE (device));
|
|
1317
|
|
1318 {
|
|
1319 char *appname, *appclass;
|
|
1320 int name_len, class_len;
|
|
1321 XtGetApplicationNameAndClass (*display_out, &appname, &appclass);
|
|
1322 name_len = strlen (appname);
|
|
1323 class_len = strlen (appclass);
|
|
1324 Dynarr_add_many (name , appname, name_len);
|
|
1325 Dynarr_add_many (class, appclass, class_len);
|
|
1326 validify_resource_component (Dynarr_atp (name, 0), name_len);
|
|
1327 validify_resource_component (Dynarr_atp (class, 0), class_len);
|
|
1328 }
|
|
1329
|
|
1330 if (EQ (locale, Qglobal))
|
|
1331 return;
|
|
1332 if (BUFFERP (locale))
|
|
1333 {
|
|
1334 Dynarr_add_literal_string (name, ".buffer.");
|
|
1335 /* we know buffer is live; otherwise we got an error above. */
|
|
1336 Dynarr_add_validified_lisp_string (name, Fbuffer_name (locale));
|
|
1337 Dynarr_add_literal_string (class, ".EmacsLocaleType.EmacsBuffer");
|
|
1338 }
|
|
1339 else if (FRAMEP (locale))
|
|
1340 {
|
|
1341 Dynarr_add_literal_string (name, ".frame.");
|
|
1342 /* we know frame is live; otherwise we got an error above. */
|
|
1343 Dynarr_add_validified_lisp_string (name, Fframe_name (locale));
|
|
1344 Dynarr_add_literal_string (class, ".EmacsLocaleType.EmacsFrame");
|
|
1345 }
|
|
1346 else
|
|
1347 {
|
|
1348 assert (DEVICEP (locale));
|
|
1349 Dynarr_add_literal_string (name, ".device.");
|
|
1350 /* we know device is live; otherwise we got an error above. */
|
|
1351 Dynarr_add_validified_lisp_string (name, Fdevice_name (locale));
|
|
1352 Dynarr_add_literal_string (class, ".EmacsLocaleType.EmacsDevice");
|
|
1353 }
|
|
1354 return;
|
|
1355 }
|
|
1356
|
|
1357 DEFUN ("x-get-resource", Fx_get_resource, 3, 6, 0, /*
|
|
1358 Retrieve an X resource from the resource manager.
|
|
1359
|
|
1360 The first arg is the name of the resource to retrieve, such as "font".
|
|
1361 The second arg is the class of the resource to retrieve, such as "Font".
|
|
1362 The third arg must be one of the symbols 'string, 'integer, 'natnum, or
|
|
1363 'boolean, specifying the type of object that the database is searched for.
|
|
1364 The fourth arg is the locale to search for the resources on, and can
|
|
1365 currently be a buffer, a frame, a device, or 'global. If omitted, it
|
|
1366 defaults to 'global.
|
|
1367 The fifth arg is the device to search for the resources on. (The resource
|
|
1368 database for a particular device is constructed by combining non-device-
|
|
1369 specific resources such as any command-line resources specified and any
|
|
1370 app-defaults files found [or the fallback resources supplied by XEmacs,
|
|
1371 if no app-defaults file is found] with device-specific resources such as
|
|
1372 those supplied using xrdb.) If omitted, it defaults to the device of
|
|
1373 LOCALE, if a device can be derived (i.e. if LOCALE is a frame or device),
|
|
1374 and otherwise defaults to the value of `default-x-device'.
|
|
1375 The sixth arg NOERROR, if non-nil, means do not signal an error if a
|
|
1376 bogus resource specification was retrieved (e.g. if a non-integer was
|
|
1377 given when an integer was requested). In this case, a warning is issued
|
442
|
1378 instead, unless NOERROR is t, in which case no warning is issued.
|
428
|
1379
|
|
1380 The resource names passed to this function are looked up relative to the
|
|
1381 locale.
|
|
1382
|
|
1383 If you want to search for a subresource, you just need to specify the
|
|
1384 resource levels in NAME and CLASS. For example, NAME could be
|
|
1385 "modeline.attributeFont", and CLASS "Face.AttributeFont".
|
|
1386
|
|
1387 Specifically,
|
|
1388
|
|
1389 1) If LOCALE is a buffer, a call
|
|
1390
|
|
1391 (x-get-resource "foreground" "Foreground" 'string SOME-BUFFER)
|
|
1392
|
|
1393 is an interface to a C call something like
|
|
1394
|
|
1395 XrmGetResource (db, "xemacs.buffer.BUFFER-NAME.foreground",
|
|
1396 "Emacs.EmacsLocaleType.EmacsBuffer.Foreground",
|
|
1397 "String");
|
|
1398
|
|
1399 2) If LOCALE is a frame, a call
|
|
1400
|
|
1401 (x-get-resource "foreground" "Foreground" 'string SOME-FRAME)
|
|
1402
|
|
1403 is an interface to a C call something like
|
|
1404
|
|
1405 XrmGetResource (db, "xemacs.frame.FRAME-NAME.foreground",
|
|
1406 "Emacs.EmacsLocaleType.EmacsFrame.Foreground",
|
|
1407 "String");
|
|
1408
|
|
1409 3) If LOCALE is a device, a call
|
|
1410
|
|
1411 (x-get-resource "foreground" "Foreground" 'string SOME-DEVICE)
|
|
1412
|
|
1413 is an interface to a C call something like
|
|
1414
|
|
1415 XrmGetResource (db, "xemacs.device.DEVICE-NAME.foreground",
|
|
1416 "Emacs.EmacsLocaleType.EmacsDevice.Foreground",
|
|
1417 "String");
|
|
1418
|
|
1419 4) If LOCALE is 'global, a call
|
|
1420
|
|
1421 (x-get-resource "foreground" "Foreground" 'string 'global)
|
|
1422
|
|
1423 is an interface to a C call something like
|
|
1424
|
|
1425 XrmGetResource (db, "xemacs.foreground",
|
|
1426 "Emacs.Foreground",
|
|
1427 "String");
|
|
1428
|
|
1429 Note that for 'global, no prefix is added other than that of the
|
|
1430 application itself; thus, you can use this locale to retrieve
|
|
1431 arbitrary application resources, if you really want to.
|
|
1432
|
|
1433 The returned value of this function is nil if the queried resource is not
|
|
1434 found. If the third arg is `string', a string is returned, and if it is
|
|
1435 `integer', an integer is returned. If the third arg is `boolean', then the
|
|
1436 returned value is the list (t) for true, (nil) for false, and is nil to
|
430
|
1437 mean ``unspecified''.
|
428
|
1438 */
|
444
|
1439 (name, class, type, locale, device, noerror))
|
428
|
1440 {
|
|
1441 char* name_string, *class_string;
|
|
1442 char *raw_result;
|
|
1443 XrmDatabase db;
|
|
1444 Display *display;
|
578
|
1445 Error_Behavior errb = decode_error_behavior_flag (noerror);
|
428
|
1446
|
|
1447 CHECK_STRING (name);
|
|
1448 CHECK_STRING (class);
|
|
1449 CHECK_SYMBOL (type);
|
|
1450
|
|
1451 Dynarr_reset (name_char_dynarr);
|
|
1452 Dynarr_reset (class_char_dynarr);
|
|
1453
|
|
1454 x_get_resource_prefix (locale, device, &display,
|
|
1455 name_char_dynarr, class_char_dynarr);
|
|
1456 if (!display)
|
|
1457 return Qnil;
|
|
1458
|
|
1459 db = XtDatabase (display);
|
|
1460
|
|
1461 Dynarr_add (name_char_dynarr, '.');
|
|
1462 Dynarr_add_lisp_string (name_char_dynarr, name);
|
|
1463 Dynarr_add (class_char_dynarr, '.');
|
|
1464 Dynarr_add_lisp_string (class_char_dynarr, class);
|
|
1465 Dynarr_add (name_char_dynarr, '\0');
|
|
1466 Dynarr_add (class_char_dynarr, '\0');
|
|
1467
|
|
1468 name_string = Dynarr_atp (name_char_dynarr, 0);
|
|
1469 class_string = Dynarr_atp (class_char_dynarr, 0);
|
|
1470
|
|
1471 {
|
|
1472 XrmValue xrm_value;
|
|
1473 XrmName namelist[100];
|
|
1474 XrmClass classlist[100];
|
|
1475 XrmName *namerest = namelist;
|
|
1476 XrmClass *classrest = classlist;
|
|
1477 XrmRepresentation xrm_type;
|
|
1478 XrmRepresentation string_quark;
|
|
1479 int result;
|
|
1480 XrmStringToNameList (name_string, namelist);
|
|
1481 XrmStringToClassList (class_string, classlist);
|
|
1482 string_quark = XrmStringToQuark ("String");
|
|
1483
|
|
1484 /* ensure that they have the same length */
|
|
1485 while (namerest[0] && classrest[0])
|
|
1486 namerest++, classrest++;
|
|
1487 if (namerest[0] || classrest[0])
|
563
|
1488 {
|
|
1489 maybe_signal_error_2
|
|
1490 (Qstructure_formation_error,
|
|
1491 "class list and name list must be the same length", name, class,
|
|
1492 Qresource, errb);
|
|
1493 return Qnil;
|
|
1494 }
|
428
|
1495 result = XrmQGetResource (db, namelist, classlist, &xrm_type, &xrm_value);
|
|
1496
|
|
1497 if (result != True || xrm_type != string_quark)
|
|
1498 return Qnil;
|
|
1499 raw_result = (char *) xrm_value.addr;
|
|
1500 }
|
|
1501
|
|
1502 if (EQ (type, Qstring))
|
|
1503 return build_string (raw_result);
|
|
1504 else if (EQ (type, Qboolean))
|
|
1505 {
|
442
|
1506 if (!ascii_strcasecmp (raw_result, "off") ||
|
|
1507 !ascii_strcasecmp (raw_result, "false") ||
|
|
1508 !ascii_strcasecmp (raw_result, "no"))
|
428
|
1509 return Fcons (Qnil, Qnil);
|
442
|
1510 if (!ascii_strcasecmp (raw_result, "on") ||
|
|
1511 !ascii_strcasecmp (raw_result, "true") ||
|
|
1512 !ascii_strcasecmp (raw_result, "yes"))
|
428
|
1513 return Fcons (Qt, Qnil);
|
563
|
1514 return maybe_signal_continuable_error_2
|
|
1515 (Qinvalid_operation, "Can't convert to a Boolean",
|
|
1516 build_string (name_string), build_string (raw_result), Qresource,
|
|
1517 errb);
|
428
|
1518 }
|
|
1519 else if (EQ (type, Qinteger) || EQ (type, Qnatnum))
|
|
1520 {
|
|
1521 int i;
|
|
1522 char c;
|
|
1523 if (1 != sscanf (raw_result, "%d%c", &i, &c))
|
563
|
1524 return maybe_signal_continuable_error_2
|
|
1525 (Qinvalid_operation, "Can't convert to an integer",
|
|
1526 build_string (name_string), build_string (raw_result), Qresource,
|
|
1527 errb);
|
428
|
1528 else if (EQ (type, Qnatnum) && i < 0)
|
563
|
1529 return maybe_signal_continuable_error_2
|
|
1530 (Qinvalid_argument, "Invalid numerical value for resource",
|
|
1531 make_int (i), build_string (name_string), Qresource, errb);
|
428
|
1532 else
|
|
1533 return make_int (i);
|
|
1534 }
|
|
1535 else
|
|
1536 {
|
|
1537 return maybe_signal_continuable_error
|
563
|
1538 (Qwrong_type_argument, "Should be string, integer, natnum or boolean",
|
|
1539 type, Qresource, errb);
|
428
|
1540 }
|
|
1541 }
|
|
1542
|
|
1543 DEFUN ("x-get-resource-prefix", Fx_get_resource_prefix, 1, 2, 0, /*
|
|
1544 Return the resource prefix for LOCALE on DEVICE.
|
|
1545 The resource prefix is the strings used to prefix resources if
|
|
1546 the LOCALE and DEVICE arguments were passed to `x-get-resource'.
|
|
1547 The returned value is a cons of a name prefix and a class prefix.
|
|
1548 For example, if LOCALE is a frame, the returned value might be
|
|
1549 \("xemacs.frame.FRAME-NAME" . "Emacs.EmacsLocaleType.EmacsFrame").
|
|
1550 If no valid X device for resourcing can be obtained, this function
|
|
1551 returns nil. (In such a case, `x-get-resource' would always return nil.)
|
|
1552 */
|
|
1553 (locale, device))
|
|
1554 {
|
|
1555 Display *display;
|
|
1556
|
|
1557 Dynarr_reset (name_char_dynarr );
|
|
1558 Dynarr_reset (class_char_dynarr);
|
|
1559
|
|
1560 x_get_resource_prefix (locale, device, &display,
|
|
1561 name_char_dynarr, class_char_dynarr);
|
|
1562 if (!display)
|
|
1563 return Qnil;
|
|
1564
|
665
|
1565 return Fcons (make_string ((Intbyte *) Dynarr_atp (name_char_dynarr, 0),
|
428
|
1566 Dynarr_length (name_char_dynarr)),
|
665
|
1567 make_string ((Intbyte *) Dynarr_atp (class_char_dynarr, 0),
|
428
|
1568 Dynarr_length (class_char_dynarr)));
|
|
1569 }
|
|
1570
|
|
1571 DEFUN ("x-put-resource", Fx_put_resource, 1, 2, 0, /*
|
|
1572 Add a resource to the resource database for DEVICE.
|
|
1573 RESOURCE-LINE specifies the resource to add and should be a
|
|
1574 standard resource specification.
|
|
1575 */
|
|
1576 (resource_line, device))
|
|
1577 {
|
|
1578 struct device *d = decode_device (device);
|
|
1579 char *str, *colon_pos;
|
|
1580
|
|
1581 CHECK_STRING (resource_line);
|
|
1582 str = (char *) XSTRING_DATA (resource_line);
|
|
1583 if (!(colon_pos = strchr (str, ':')) || strchr (str, '\n'))
|
|
1584 invalid:
|
563
|
1585 syntax_error ("Invalid resource line", resource_line);
|
647
|
1586 if ((int) strspn (str,
|
|
1587 /* Only the following chars are allowed before the colon */
|
|
1588 " \t.*?abcdefghijklmnopqrstuvwxyz"
|
|
1589 "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-")
|
|
1590 != colon_pos - str)
|
428
|
1591 goto invalid;
|
|
1592
|
|
1593 if (DEVICE_X_P (d))
|
|
1594 {
|
|
1595 XrmDatabase db = XtDatabase (DEVICE_X_DISPLAY (d));
|
|
1596 XrmPutLineResource (&db, str);
|
|
1597 }
|
|
1598
|
|
1599 return Qnil;
|
|
1600 }
|
|
1601
|
|
1602
|
|
1603 /************************************************************************/
|
|
1604 /* display information functions */
|
|
1605 /************************************************************************/
|
|
1606
|
|
1607 DEFUN ("default-x-device", Fdefault_x_device, 0, 0, 0, /*
|
|
1608 Return the default X device for resourcing.
|
|
1609 This is the first-created X device that still exists.
|
|
1610 */
|
|
1611 ())
|
|
1612 {
|
|
1613 return Vdefault_x_device;
|
|
1614 }
|
|
1615
|
|
1616 DEFUN ("x-display-visual-class", Fx_display_visual_class, 0, 1, 0, /*
|
|
1617 Return the visual class of the X display DEVICE is using.
|
|
1618 This can be altered from the default at startup using the XResource "EmacsVisual".
|
|
1619 The returned value will be one of the symbols `static-gray', `gray-scale',
|
|
1620 `static-color', `pseudo-color', `true-color', or `direct-color'.
|
|
1621 */
|
|
1622 (device))
|
|
1623 {
|
|
1624 Visual *vis = DEVICE_X_VISUAL (decode_x_device (device));
|
|
1625 switch (vis->class)
|
|
1626 {
|
|
1627 case StaticGray: return intern ("static-gray");
|
|
1628 case GrayScale: return intern ("gray-scale");
|
|
1629 case StaticColor: return intern ("static-color");
|
|
1630 case PseudoColor: return intern ("pseudo-color");
|
|
1631 case TrueColor: return intern ("true-color");
|
|
1632 case DirectColor: return intern ("direct-color");
|
|
1633 default:
|
563
|
1634 invalid_state ("display has an unknown visual class", Qunbound);
|
428
|
1635 return Qnil; /* suppress compiler warning */
|
|
1636 }
|
|
1637 }
|
|
1638
|
|
1639 DEFUN ("x-display-visual-depth", Fx_display_visual_depth, 0, 1, 0, /*
|
|
1640 Return the bitplane depth of the visual the X display DEVICE is using.
|
|
1641 */
|
|
1642 (device))
|
|
1643 {
|
|
1644 return make_int (DEVICE_X_DEPTH (decode_x_device (device)));
|
|
1645 }
|
|
1646
|
|
1647 static Lisp_Object
|
|
1648 x_device_system_metrics (struct device *d,
|
|
1649 enum device_metrics m)
|
|
1650 {
|
|
1651 Display *dpy = DEVICE_X_DISPLAY (d);
|
|
1652
|
|
1653 switch (m)
|
|
1654 {
|
|
1655 case DM_size_device:
|
|
1656 return Fcons (make_int (DisplayWidth (dpy, DefaultScreen (dpy))),
|
|
1657 make_int (DisplayHeight (dpy, DefaultScreen (dpy))));
|
|
1658 case DM_size_device_mm:
|
|
1659 return Fcons (make_int (DisplayWidthMM (dpy, DefaultScreen (dpy))),
|
|
1660 make_int (DisplayHeightMM (dpy, DefaultScreen (dpy))));
|
|
1661 case DM_num_bit_planes:
|
|
1662 return make_int (DisplayPlanes (dpy, DefaultScreen (dpy)));
|
|
1663 case DM_num_color_cells:
|
|
1664 return make_int (DisplayCells (dpy, DefaultScreen (dpy)));
|
|
1665 default: /* No such device metric property for X devices */
|
|
1666 return Qunbound;
|
|
1667 }
|
|
1668 }
|
|
1669
|
|
1670 DEFUN ("x-server-vendor", Fx_server_vendor, 0, 1, 0, /*
|
|
1671 Return the vendor ID string of the X server DEVICE is on.
|
|
1672 Return the empty string if the vendor ID string cannot be determined.
|
|
1673 */
|
|
1674 (device))
|
|
1675 {
|
|
1676 Display *dpy = get_x_display (device);
|
|
1677 char *vendor = ServerVendor (dpy);
|
|
1678
|
|
1679 return build_string (vendor ? vendor : "");
|
|
1680 }
|
|
1681
|
|
1682 DEFUN ("x-server-version", Fx_server_version, 0, 1, 0, /*
|
|
1683 Return the version numbers of the X server DEVICE is on.
|
|
1684 The returned value is a list of three integers: the major and minor
|
|
1685 version numbers of the X Protocol in use, and the vendor-specific release
|
|
1686 number. See also `x-server-vendor'.
|
|
1687 */
|
|
1688 (device))
|
|
1689 {
|
|
1690 Display *dpy = get_x_display (device);
|
|
1691
|
|
1692 return list3 (make_int (ProtocolVersion (dpy)),
|
|
1693 make_int (ProtocolRevision (dpy)),
|
|
1694 make_int (VendorRelease (dpy)));
|
|
1695 }
|
|
1696
|
|
1697 DEFUN ("x-valid-keysym-name-p", Fx_valid_keysym_name_p, 1, 1, 0, /*
|
|
1698 Return true if KEYSYM names a keysym that the X library knows about.
|
|
1699 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
|
|
1700 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system.
|
|
1701 */
|
|
1702 (keysym))
|
|
1703 {
|
442
|
1704 const char *keysym_ext;
|
428
|
1705
|
|
1706 CHECK_STRING (keysym);
|
442
|
1707 LISP_STRING_TO_EXTERNAL (keysym, keysym_ext, Qctext);
|
428
|
1708
|
|
1709 return XStringToKeysym (keysym_ext) ? Qt : Qnil;
|
|
1710 }
|
|
1711
|
|
1712 DEFUN ("x-keysym-hash-table", Fx_keysym_hash_table, 0, 1, 0, /*
|
440
|
1713 Return a hash table containing a key for all keysyms on DEVICE.
|
|
1714 DEVICE must be an X11 display device. See `x-keysym-on-keyboard-p'.
|
428
|
1715 */
|
|
1716 (device))
|
|
1717 {
|
|
1718 struct device *d = decode_device (device);
|
|
1719 if (!DEVICE_X_P (d))
|
563
|
1720 gui_error ("Not an X device", device);
|
428
|
1721
|
|
1722 return DEVICE_X_DATA (d)->x_keysym_map_hash_table;
|
|
1723 }
|
|
1724
|
|
1725 DEFUN ("x-keysym-on-keyboard-sans-modifiers-p", Fx_keysym_on_keyboard_sans_modifiers_p,
|
|
1726 1, 2, 0, /*
|
|
1727 Return true if KEYSYM names a key on the keyboard of DEVICE.
|
|
1728 More precisely, return true if pressing a physical key
|
|
1729 on the keyboard of DEVICE without any modifier keys generates KEYSYM.
|
|
1730 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
|
|
1731 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system.
|
|
1732 The keysym name can be provided in two forms:
|
|
1733 - if keysym is a string, it must be the name as known to X windows.
|
|
1734 - if keysym is a symbol, it must be the name as known to XEmacs.
|
|
1735 The two names differ in capitalization and underscoring.
|
|
1736 */
|
|
1737 (keysym, device))
|
|
1738 {
|
|
1739 struct device *d = decode_device (device);
|
|
1740 if (!DEVICE_X_P (d))
|
563
|
1741 gui_error ("Not an X device", device);
|
428
|
1742
|
|
1743 return (EQ (Qsans_modifiers,
|
|
1744 Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), Qnil)) ?
|
|
1745 Qt : Qnil);
|
|
1746 }
|
|
1747
|
|
1748
|
|
1749 DEFUN ("x-keysym-on-keyboard-p", Fx_keysym_on_keyboard_p, 1, 2, 0, /*
|
|
1750 Return true if KEYSYM names a key on the keyboard of DEVICE.
|
|
1751 More precisely, return true if some keystroke (possibly including modifiers)
|
|
1752 on the keyboard of DEVICE keys generates KEYSYM.
|
|
1753 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
|
|
1754 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system.
|
|
1755 The keysym name can be provided in two forms:
|
|
1756 - if keysym is a string, it must be the name as known to X windows.
|
|
1757 - if keysym is a symbol, it must be the name as known to XEmacs.
|
|
1758 The two names differ in capitalization and underscoring.
|
|
1759 */
|
|
1760 (keysym, device))
|
|
1761 {
|
|
1762 struct device *d = decode_device (device);
|
|
1763 if (!DEVICE_X_P (d))
|
563
|
1764 gui_error ("Not an X device", device);
|
428
|
1765
|
|
1766 return (NILP (Fgethash (keysym, DEVICE_X_KEYSYM_MAP_HASH_TABLE (d), Qnil)) ?
|
|
1767 Qnil : Qt);
|
|
1768 }
|
|
1769
|
|
1770
|
|
1771 /************************************************************************/
|
|
1772 /* grabs and ungrabs */
|
|
1773 /************************************************************************/
|
|
1774
|
|
1775 DEFUN ("x-grab-pointer", Fx_grab_pointer, 0, 3, 0, /*
|
|
1776 Grab the pointer and restrict it to its current window.
|
|
1777 If optional DEVICE argument is nil, the default device will be used.
|
|
1778 If optional CURSOR argument is non-nil, change the pointer shape to that
|
|
1779 until `x-ungrab-pointer' is called (it should be an object returned by the
|
|
1780 `make-cursor-glyph' function).
|
|
1781 If the second optional argument IGNORE-KEYBOARD is non-nil, ignore all
|
|
1782 keyboard events during the grab.
|
|
1783 Returns t if the grab is successful, nil otherwise.
|
|
1784 */
|
|
1785 (device, cursor, ignore_keyboard))
|
|
1786 {
|
|
1787 Window w;
|
|
1788 int pointer_mode, result;
|
|
1789 struct device *d = decode_x_device (device);
|
|
1790
|
|
1791 if (!NILP (cursor))
|
|
1792 {
|
|
1793 CHECK_POINTER_GLYPH (cursor);
|
|
1794 cursor = glyph_image_instance (cursor, device, ERROR_ME, 0);
|
|
1795 }
|
|
1796
|
|
1797 if (!NILP (ignore_keyboard))
|
|
1798 pointer_mode = GrabModeSync;
|
|
1799 else
|
|
1800 pointer_mode = GrabModeAsync;
|
|
1801
|
|
1802 w = XtWindow (FRAME_X_TEXT_WIDGET (device_selected_frame (d)));
|
|
1803
|
|
1804 /* #### Possibly this needs to gcpro the cursor somehow, but it doesn't
|
|
1805 seem to cause a problem if XFreeCursor is called on a cursor in use
|
|
1806 in a grab; I suppose the X server counts the grab as a reference
|
|
1807 and doesn't free it until it exits? */
|
|
1808 result = XGrabPointer (DEVICE_X_DISPLAY (d), w,
|
|
1809 False,
|
|
1810 ButtonMotionMask |
|
|
1811 ButtonPressMask |
|
|
1812 ButtonReleaseMask |
|
|
1813 PointerMotionHintMask,
|
|
1814 GrabModeAsync, /* Keep pointer events flowing */
|
|
1815 pointer_mode, /* Stall keyboard events */
|
|
1816 w, /* Stay in this window */
|
|
1817 (NILP (cursor) ? 0
|
|
1818 : XIMAGE_INSTANCE_X_CURSOR (cursor)),
|
|
1819 CurrentTime);
|
|
1820 return (result == GrabSuccess) ? Qt : Qnil;
|
|
1821 }
|
|
1822
|
|
1823 DEFUN ("x-ungrab-pointer", Fx_ungrab_pointer, 0, 1, 0, /*
|
|
1824 Release a pointer grab made with `x-grab-pointer'.
|
|
1825 If optional first arg DEVICE is nil the default device is used.
|
|
1826 If it is t the pointer will be released on all X devices.
|
|
1827 */
|
|
1828 (device))
|
|
1829 {
|
|
1830 if (!EQ (device, Qt))
|
|
1831 {
|
|
1832 Display *dpy = get_x_display (device);
|
|
1833 XUngrabPointer (dpy, CurrentTime);
|
|
1834 }
|
|
1835 else
|
|
1836 {
|
|
1837 Lisp_Object devcons, concons;
|
|
1838
|
|
1839 DEVICE_LOOP_NO_BREAK (devcons, concons)
|
|
1840 {
|
|
1841 struct device *d = XDEVICE (XCAR (devcons));
|
|
1842
|
|
1843 if (DEVICE_X_P (d))
|
|
1844 XUngrabPointer (DEVICE_X_DISPLAY (d), CurrentTime);
|
|
1845 }
|
|
1846 }
|
|
1847
|
|
1848 return Qnil;
|
|
1849 }
|
|
1850
|
|
1851 DEFUN ("x-grab-keyboard", Fx_grab_keyboard, 0, 1, 0, /*
|
|
1852 Grab the keyboard on the given device (defaulting to the selected one).
|
|
1853 So long as the keyboard is grabbed, all keyboard events will be delivered
|
|
1854 to emacs -- it is not possible for other X clients to eavesdrop on them.
|
|
1855 Ungrab the keyboard with `x-ungrab-keyboard' (use an unwind-protect).
|
|
1856 Returns t if the grab is successful, nil otherwise.
|
|
1857 */
|
|
1858 (device))
|
|
1859 {
|
|
1860 struct device *d = decode_x_device (device);
|
|
1861 Window w = XtWindow (FRAME_X_TEXT_WIDGET (device_selected_frame (d)));
|
|
1862 Display *dpy = DEVICE_X_DISPLAY (d);
|
|
1863 Status status;
|
|
1864 XSync (dpy, False);
|
|
1865 status = XGrabKeyboard (dpy, w, True,
|
|
1866 /* I don't really understand sync-vs-async
|
|
1867 grabs, but this is what xterm does. */
|
|
1868 GrabModeAsync, GrabModeAsync,
|
|
1869 /* Use the timestamp of the last user action
|
|
1870 read by emacs proper; xterm uses CurrentTime
|
|
1871 but there's a comment that says "wrong"...
|
|
1872 (Despite the name this is the time of the
|
|
1873 last key or mouse event.) */
|
|
1874 DEVICE_X_MOUSE_TIMESTAMP (d));
|
|
1875 if (status == GrabSuccess)
|
|
1876 {
|
|
1877 /* The XUngrabKeyboard should generate a FocusIn back to this
|
|
1878 window but it doesn't unless we explicitly set focus to the
|
|
1879 window first (which should already have it. The net result
|
|
1880 is that without this call when x-ungrab-keyboard is called
|
|
1881 the selected frame ends up not having focus. */
|
|
1882 XSetInputFocus (dpy, w, RevertToParent, DEVICE_X_MOUSE_TIMESTAMP (d));
|
|
1883 return Qt;
|
|
1884 }
|
|
1885 else
|
|
1886 return Qnil;
|
|
1887 }
|
|
1888
|
|
1889 DEFUN ("x-ungrab-keyboard", Fx_ungrab_keyboard, 0, 1, 0, /*
|
|
1890 Release a keyboard grab made with `x-grab-keyboard'.
|
|
1891 */
|
|
1892 (device))
|
|
1893 {
|
|
1894 Display *dpy = get_x_display (device);
|
|
1895 XUngrabKeyboard (dpy, CurrentTime);
|
|
1896 return Qnil;
|
|
1897 }
|
|
1898
|
|
1899 DEFUN ("x-get-font-path", Fx_get_font_path, 0, 1, 0, /*
|
|
1900 Get the X Server's font path.
|
|
1901
|
|
1902 See also `x-set-font-path'.
|
|
1903 */
|
|
1904 (device))
|
|
1905 {
|
|
1906 Display *dpy = get_x_display (device);
|
|
1907 int ndirs_return;
|
442
|
1908 const char **directories = (const char **) XGetFontPath (dpy, &ndirs_return);
|
428
|
1909 Lisp_Object font_path = Qnil;
|
|
1910
|
|
1911 if (!directories)
|
563
|
1912 gui_error ("Can't get X font path", device);
|
428
|
1913
|
|
1914 while (ndirs_return--)
|
|
1915 font_path = Fcons (build_ext_string (directories[ndirs_return],
|
440
|
1916 Qfile_name),
|
|
1917 font_path);
|
428
|
1918
|
|
1919 return font_path;
|
|
1920 }
|
|
1921
|
|
1922 DEFUN ("x-set-font-path", Fx_set_font_path, 1, 2, 0, /*
|
|
1923 Set the X Server's font path to FONT-PATH.
|
|
1924
|
|
1925 There is only one font path per server, not one per client. Use this
|
|
1926 sparingly. It uncaches all of the X server's font information.
|
|
1927
|
|
1928 Font directories should end in the path separator and should contain
|
|
1929 a file called fonts.dir usually created with the program mkfontdir.
|
|
1930
|
|
1931 Setting the FONT-PATH to nil tells the X server to use the default
|
|
1932 font path.
|
|
1933
|
|
1934 See also `x-get-font-path'.
|
|
1935 */
|
|
1936 (font_path, device))
|
|
1937 {
|
|
1938 Display *dpy = get_x_display (device);
|
|
1939 Lisp_Object path_entry;
|
442
|
1940 const char **directories;
|
428
|
1941 int i=0,ndirs=0;
|
|
1942
|
|
1943 EXTERNAL_LIST_LOOP (path_entry, font_path)
|
|
1944 {
|
|
1945 CHECK_STRING (XCAR (path_entry));
|
|
1946 ndirs++;
|
|
1947 }
|
|
1948
|
442
|
1949 directories = alloca_array (const char *, ndirs);
|
428
|
1950
|
|
1951 EXTERNAL_LIST_LOOP (path_entry, font_path)
|
|
1952 {
|
442
|
1953 LISP_STRING_TO_EXTERNAL (XCAR (path_entry), directories[i++], Qfile_name);
|
428
|
1954 }
|
|
1955
|
|
1956 expect_x_error (dpy);
|
|
1957 XSetFontPath (dpy, (char **) directories, ndirs);
|
|
1958 signal_if_x_error (dpy, 1/*resumable_p*/);
|
|
1959
|
|
1960 return Qnil;
|
|
1961 }
|
|
1962
|
|
1963
|
|
1964 /************************************************************************/
|
|
1965 /* initialization */
|
|
1966 /************************************************************************/
|
|
1967
|
|
1968 void
|
|
1969 syms_of_device_x (void)
|
|
1970 {
|
|
1971 DEFSUBR (Fx_debug_mode);
|
|
1972 DEFSUBR (Fx_get_resource);
|
|
1973 DEFSUBR (Fx_get_resource_prefix);
|
|
1974 DEFSUBR (Fx_put_resource);
|
|
1975
|
|
1976 DEFSUBR (Fdefault_x_device);
|
|
1977 DEFSUBR (Fx_display_visual_class);
|
|
1978 DEFSUBR (Fx_display_visual_depth);
|
|
1979 DEFSUBR (Fx_server_vendor);
|
|
1980 DEFSUBR (Fx_server_version);
|
|
1981 DEFSUBR (Fx_valid_keysym_name_p);
|
|
1982 DEFSUBR (Fx_keysym_hash_table);
|
|
1983 DEFSUBR (Fx_keysym_on_keyboard_p);
|
|
1984 DEFSUBR (Fx_keysym_on_keyboard_sans_modifiers_p);
|
|
1985
|
|
1986 DEFSUBR (Fx_grab_pointer);
|
|
1987 DEFSUBR (Fx_ungrab_pointer);
|
|
1988 DEFSUBR (Fx_grab_keyboard);
|
|
1989 DEFSUBR (Fx_ungrab_keyboard);
|
|
1990
|
|
1991 DEFSUBR (Fx_get_font_path);
|
|
1992 DEFSUBR (Fx_set_font_path);
|
|
1993
|
563
|
1994 DEFSYMBOL (Qx_error);
|
|
1995 DEFSYMBOL (Qinit_pre_x_win);
|
|
1996 DEFSYMBOL (Qinit_post_x_win);
|
428
|
1997 }
|
|
1998
|
|
1999 void
|
|
2000 reinit_console_type_create_device_x (void)
|
|
2001 {
|
|
2002 /* Initialize variables to speed up X resource interactions */
|
442
|
2003 const char *valid_resource_chars =
|
428
|
2004 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
2005 while (*valid_resource_chars)
|
|
2006 valid_resource_char_p[(unsigned int) (*valid_resource_chars++)] = 1;
|
|
2007
|
|
2008 name_char_dynarr = Dynarr_new (char);
|
|
2009 class_char_dynarr = Dynarr_new (char);
|
|
2010 }
|
|
2011
|
|
2012 void
|
|
2013 console_type_create_device_x (void)
|
|
2014 {
|
|
2015 reinit_console_type_create_device_x ();
|
|
2016 CONSOLE_HAS_METHOD (x, init_device);
|
|
2017 CONSOLE_HAS_METHOD (x, finish_init_device);
|
|
2018 CONSOLE_HAS_METHOD (x, mark_device);
|
|
2019 CONSOLE_HAS_METHOD (x, delete_device);
|
|
2020 CONSOLE_HAS_METHOD (x, device_system_metrics);
|
|
2021 }
|
|
2022
|
|
2023 void
|
|
2024 reinit_vars_of_device_x (void)
|
|
2025 {
|
|
2026 error_expected = 0;
|
|
2027 error_occurred = 0;
|
|
2028
|
|
2029 in_resource_setting = 0;
|
|
2030 }
|
|
2031
|
|
2032 void
|
|
2033 vars_of_device_x (void)
|
|
2034 {
|
|
2035 reinit_vars_of_device_x ();
|
|
2036
|
|
2037 DEFVAR_LISP ("x-emacs-application-class", &Vx_emacs_application_class /*
|
|
2038 The X application class of the XEmacs process.
|
|
2039 This controls, among other things, the name of the `app-defaults' file
|
|
2040 that XEmacs will use. For changes to this variable to take effect, they
|
|
2041 must be made before the connection to the X server is initialized, that is,
|
|
2042 this variable may only be changed before emacs is dumped, or by setting it
|
|
2043 in the file lisp/term/x-win.el.
|
|
2044
|
|
2045 If this variable is nil before the connection to the X server is first
|
|
2046 initialized (which it is by default), the X resource database will be
|
|
2047 consulted and the value will be set according to whether any resources
|
|
2048 are found for the application class `XEmacs'. If the user has set any
|
|
2049 resources for the XEmacs application class, the XEmacs process will use
|
|
2050 the application class `XEmacs'. Otherwise, the XEmacs process will use
|
|
2051 the application class `Emacs' which is backwards compatible to previous
|
|
2052 XEmacs versions but may conflict with resources intended for GNU Emacs.
|
|
2053 */ );
|
|
2054 Vx_emacs_application_class = Qnil;
|
|
2055
|
|
2056 DEFVAR_LISP ("x-initial-argv-list", &Vx_initial_argv_list /*
|
|
2057 You don't want to know.
|
|
2058 This is used during startup to communicate the remaining arguments in
|
|
2059 `command-line-args-left' to the C code, which passes the args to
|
|
2060 the X initialization code, which removes some args, and then the
|
|
2061 args are placed back into `x-initial-arg-list' and thence into
|
|
2062 `command-line-args-left'. Perhaps `command-line-args-left' should
|
|
2063 just reside in C.
|
|
2064 */ );
|
|
2065 Vx_initial_argv_list = Qnil;
|
|
2066
|
|
2067 #if defined(MULE) && (defined(LWLIB_MENUBARS_MOTIF) || defined(HAVE_XIM) || defined (USE_XFONTSET))
|
|
2068 DEFVAR_LISP ("x-app-defaults-directory", &Vx_app_defaults_directory /*
|
|
2069 Used by the Lisp code to communicate to the low level X initialization
|
|
2070 where the localized init files are.
|
|
2071 */ );
|
|
2072 Vx_app_defaults_directory = Qnil;
|
|
2073 #endif
|
|
2074
|
|
2075 Fprovide (Qx);
|
|
2076
|
|
2077 staticpro (&Vdefault_x_device);
|
|
2078 Vdefault_x_device = Qnil;
|
|
2079 }
|