comparison src/device-x.c @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 7d59cb494b73
children de805c49cfc1
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
47 #include "sysdep.h" 47 #include "sysdep.h"
48 #include "window.h" 48 #include "window.h"
49 49
50 #include "sysfile.h" 50 #include "sysfile.h"
51 #include "systime.h" 51 #include "systime.h"
52
53 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D)
54 #include "sysdll.h"
55 #endif /* HAVE_SHLIB and LWLIB_USES_ATHENA and not HAVE_ATHENA_3D */
52 56
53 #ifdef HAVE_OFFIX_DND 57 #ifdef HAVE_OFFIX_DND
54 #include "offix.h" 58 #include "offix.h"
55 #endif 59 #endif
56 60
385 */ 389 */
386 && (visual_class != PseudoColor || 390 && (visual_class != PseudoColor ||
387 vi_out [i].depth == 1 || 391 vi_out [i].depth == 1 ||
388 vi_out [i].depth == 8) 392 vi_out [i].depth == 8)
389 #endif 393 #endif
390 394
391 /* SGI has 30-bit deep visuals. Ignore them. 395 /* SGI has 30-bit deep visuals. Ignore them.
392 (We only have 24-bit data anyway.) 396 (We only have 24-bit data anyway.)
393 */ 397 */
394 && (vi_out [i].depth <= 24) 398 && (vi_out [i].depth <= 24)
395 ) 399 )
396 best = i; 400 best = i;
454 Lisp_Object device; 458 Lisp_Object device;
455 Display *dpy; 459 Display *dpy;
456 Widget app_shell; 460 Widget app_shell;
457 int argc; 461 int argc;
458 char **argv; 462 char **argv;
459 CONST char *app_class; 463 const char *app_class;
460 CONST char *app_name; 464 const char *app_name;
461 CONST char *disp_name; 465 const char *disp_name;
462 Visual *visual = NULL; 466 Visual *visual = NULL;
463 int depth = 8; /* shut up the compiler */ 467 int depth = 8; /* shut up the compiler */
464 Colormap cmap; 468 Colormap cmap;
465 int screen; 469 int screen;
466 /* */ 470 /* */
467 int best_visual_found = 0; 471 int best_visual_found = 0;
468 472
473 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D)
474 /*
475 * In order to avoid the lossage with flat Athena widgets dynamically
476 * linking to one of the ThreeD variants, using the dynamic symbol helpers
477 * to look for symbols that shouldn't be there and refusing to run if they
478 * are seems a less toxic idea than having XEmacs crash when we try and
479 * use a subclass of a widget that has changed size.
480 *
481 * It's ugly, I know, and not going to work everywhere. It seems better to
482 * do our damnedest to try and tell the user what to expect rather than
483 * simply blow up though.
484 *
485 * All the ThreeD variants I have access to define the following function
486 * symbols in the shared library. The flat Xaw library does not define them:
487 *
488 * Xaw3dComputeBottomShadowRGB
489 * Xaw3dComputeTopShadowRGB
490 *
491 * So far only Linux has shown this problem. This seems to be portable to
492 * all the distributions (certainly all the ones I checked - Debian and
493 * Redhat)
494 *
495 * This will only work, sadly, with dlopen() -- the other dynamic linkers
496 * are simply not capable of doing what is needed. :/
497 */
498
499 {
500 /* Get a dll handle to the main process. */
501 dll_handle xaw_dll_handle = dll_open (NULL);
502
503 /* Did that fail? If so, continue without error.
504 * We could die here but, well, that's unfriendly and all -- plus I feel
505 * better about some crashing somewhere rather than preventing a perfectly
506 * good configuration working just because dll_open failed.
507 */
508 if (xaw_dll_handle != NULL)
509 {
510 /* Look for the Xaw3d function */
511 dll_func xaw_function_handle =
512 dll_function (xaw_dll_handle, "Xaw3dComputeTopShadowRGB");
513
514 /* If we found it, warn the user in big, nasty, unfriendly letters */
515 if (xaw_function_handle != NULL)
516 {
517 warn_when_safe (Qdevice, Qerror, "\n"
518 "It seems that XEmacs is built dynamically linked to the flat Athena widget\n"
519 "library but it finds a 3D Athena variant with the same name at runtime.\n"
520 "\n"
521 "This WILL cause your XEmacs process to dump core at some point.\n"
522 "You should not continue to use this binary without resolving this issue.\n"
523 "\n"
524 "This can be solved with the xaw-wrappers package under Debian\n"
525 "(register XEmacs as incompatible with all 3d widget sets, see\n"
526 "update-xaw-wrappers(8) and .../doc/xaw-wrappers/README.packagers). It\n"
527 "can be verified by checking the runtime path in /etc/ld.so.conf and by\n"
528 "using `ldd /path/to/xemacs' under other Linux distributions. One\n"
529 "solution is to use LD_PRELOAD or LD_LIBRARY_PATH to force ld.so to\n"
530 "load the flat Athena widget library instead of the aliased 3D widget\n"
531 "library (see ld.so(8) for use of these environment variables).\n\n"
532 );
533
534 }
535
536 /* Otherwise release the handle to the library
537 * No error catch here; I can't think of a way to recover anyhow.
538 */
539 dll_close (xaw_dll_handle);
540 }
541 }
542 #endif /* HAVE_SHLIB and LWLIB_USES_ATHENA and not HAVE_ATHENA_3D */
543
544
469 XSETDEVICE (device, d); 545 XSETDEVICE (device, d);
470 display = DEVICE_CONNECTION (d); 546 display = DEVICE_CONNECTION (d);
471 547
472 allocate_x_device_struct (d); 548 allocate_x_device_struct (d);
473 549
474 make_argc_argv (Vx_initial_argv_list, &argc, &argv); 550 make_argc_argv (Vx_initial_argv_list, &argc, &argv);
475 551
476 GET_C_STRING_CTEXT_DATA_ALLOCA (display, disp_name); 552 TO_EXTERNAL_FORMAT (LISP_STRING, display,
553 C_STRING_ALLOCA, disp_name,
554 Qctext);
477 555
478 /* 556 /*
479 * Break apart the old XtOpenDisplay call into XOpenDisplay and 557 * Break apart the old XtOpenDisplay call into XOpenDisplay and
480 * XtDisplayInitialize so we can figure out whether there 558 * XtDisplayInitialize so we can figure out whether there
481 * are any XEmacs resources in the resource database before 559 * are any XEmacs resources in the resource database before
493 signal_simple_error ("X server not responding\n", display); 571 signal_simple_error ("X server not responding\n", display);
494 } 572 }
495 573
496 if (STRINGP (Vx_emacs_application_class) && 574 if (STRINGP (Vx_emacs_application_class) &&
497 XSTRING_LENGTH (Vx_emacs_application_class) > 0) 575 XSTRING_LENGTH (Vx_emacs_application_class) > 0)
498 GET_C_STRING_CTEXT_DATA_ALLOCA (Vx_emacs_application_class, app_class); 576 TO_EXTERNAL_FORMAT (LISP_STRING, Vx_emacs_application_class,
577 C_STRING_ALLOCA, app_class,
578 Qctext);
499 else 579 else
500 { 580 {
501 app_class = (NILP (Vx_emacs_application_class) && 581 app_class = (NILP (Vx_emacs_application_class) &&
502 have_xemacs_resources_in_xrdb (dpy)) 582 have_xemacs_resources_in_xrdb (dpy))
503 #ifdef INFODOCK 583 #ifdef INFODOCK
527 { 607 {
528 /* Read in locale-specific resources from 608 /* Read in locale-specific resources from
529 data-directory/app-defaults/$LANG/Emacs. 609 data-directory/app-defaults/$LANG/Emacs.
530 This is in addition to the standard app-defaults files, and 610 This is in addition to the standard app-defaults files, and
531 does not override resources defined elsewhere */ 611 does not override resources defined elsewhere */
532 CONST char *data_dir; 612 const char *data_dir;
533 char *path; 613 char *path;
534 XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */ 614 XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */
535 CONST char *locale = XrmLocaleOfDatabase (db); 615 const char *locale = XrmLocaleOfDatabase (db);
536 616
537 if (STRINGP (Vx_app_defaults_directory) && 617 if (STRINGP (Vx_app_defaults_directory) &&
538 XSTRING_LENGTH (Vx_app_defaults_directory) > 0) 618 XSTRING_LENGTH (Vx_app_defaults_directory) > 0)
539 { 619 {
540 GET_C_STRING_FILENAME_DATA_ALLOCA(Vx_app_defaults_directory, data_dir); 620 TO_EXTERNAL_FORMAT (LISP_STRING, Vx_app_defaults_directory,
621 C_STRING_ALLOCA, data_dir,
622 Qfile_name);
541 path = (char *)alloca (strlen (data_dir) + strlen (locale) + 7); 623 path = (char *)alloca (strlen (data_dir) + strlen (locale) + 7);
542 sprintf (path, "%s%s/Emacs", data_dir, locale); 624 sprintf (path, "%s%s/Emacs", data_dir, locale);
543 if (!access (path, R_OK)) 625 if (!access (path, R_OK))
544 XrmCombineFileDatabase (path, &db, False); 626 XrmCombineFileDatabase (path, &db, False);
545 } 627 }
546 else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) 628 else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0)
547 { 629 {
548 GET_C_STRING_FILENAME_DATA_ALLOCA (Vdata_directory, data_dir); 630 TO_EXTERNAL_FORMAT (LISP_STRING, Vdata_directory,
631 C_STRING_ALLOCA, data_dir,
632 Qfile_name);
549 path = (char *)alloca (strlen (data_dir) + 13 + strlen (locale) + 7); 633 path = (char *)alloca (strlen (data_dir) + 13 + strlen (locale) + 7);
550 sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale); 634 sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale);
551 if (!access (path, R_OK)) 635 if (!access (path, R_OK))
552 XrmCombineFileDatabase (path, &db, False); 636 XrmCombineFileDatabase (path, &db, False);
553 } 637 }
564 strings */ 648 strings */
565 649
566 XtGetApplicationNameAndClass (dpy, (char **) &app_name, (char **) &app_class); 650 XtGetApplicationNameAndClass (dpy, (char **) &app_name, (char **) &app_class);
567 /* search for a matching visual if requested by the user, or setup the display default */ 651 /* search for a matching visual if requested by the user, or setup the display default */
568 { 652 {
569 char *buf1 = (char *)alloca (strlen (app_name) + 17); 653 int resource_name_length = max (sizeof (".emacsVisual"),
570 char *buf2 = (char *)alloca (strlen (app_class) + 17); 654 sizeof (".privateColormap"));
655 char *buf1 = alloca_array (char, strlen (app_name) + resource_name_length);
656 char *buf2 = alloca_array (char, strlen (app_class) + resource_name_length);
571 char *type; 657 char *type;
572 XrmValue value; 658 XrmValue value;
573 659
574 sprintf (buf1, "%s.emacsVisual", app_name); 660 sprintf (buf1, "%s.emacsVisual", app_name);
575 sprintf (buf2, "%s.EmacsVisual", app_class); 661 sprintf (buf2, "%s.EmacsVisual", app_class);
576 if (XrmGetResource (XtDatabase (dpy), buf1, buf2, &type, &value) == True) 662 if (XrmGetResource (XtDatabase (dpy), buf1, buf2, &type, &value) == True)
577 { 663 {
578 int cnt = 0, vis_class = PseudoColor; 664 int cnt = 0;
665 int vis_class = PseudoColor;
579 XVisualInfo vinfo; 666 XVisualInfo vinfo;
580 char *res, *str = (char*)value.addr; 667 char *str = (char*) value.addr;
581 668
582 #define CHECK_VIS_CLASS(class) \ 669 #define CHECK_VIS_CLASS(visual_class) \
583 else if (strncmp (str, #class, sizeof (#class) - 1) == 0) \ 670 else if (memcmp (str, #visual_class, sizeof (#visual_class) - 1) == 0) \
584 cnt = sizeof (#class) - 1, vis_class = class 671 cnt = sizeof (#visual_class) - 1, vis_class = visual_class
585 672
586 if (1) 673 if (1)
587 ; 674 ;
588 CHECK_VIS_CLASS (StaticGray); 675 CHECK_VIS_CLASS (StaticGray);
589 CHECK_VIS_CLASS (StaticColor); 676 CHECK_VIS_CLASS (StaticColor);
592 CHECK_VIS_CLASS (PseudoColor); 679 CHECK_VIS_CLASS (PseudoColor);
593 CHECK_VIS_CLASS (DirectColor); 680 CHECK_VIS_CLASS (DirectColor);
594 681
595 if (cnt) 682 if (cnt)
596 { 683 {
597 res = str + cnt; 684 depth = atoi (str + cnt);
598 depth = atoi (res);
599 if (depth == 0) 685 if (depth == 0)
600 { 686 {
601 stderr_out ("Invalid Depth specification in %s... ignoring...\n", str); 687 stderr_out ("Invalid Depth specification in %s... ignoring...\n", str);
602 } 688 }
603 else 689 else
651 cmap = XCreateColormap (dpy, RootWindow (dpy, screen), visual, AllocNone); 737 cmap = XCreateColormap (dpy, RootWindow (dpy, screen), visual, AllocNone);
652 } 738 }
653 else 739 else
654 { 740 {
655 /* We have to create a matching colormap anyway... 741 /* We have to create a matching colormap anyway...
656 ### think about using standard colormaps (need the Xmu libs?) */ 742 #### think about using standard colormaps (need the Xmu libs?) */
657 cmap = XCreateColormap(dpy, RootWindow(dpy, screen), visual, AllocNone); 743 cmap = XCreateColormap(dpy, RootWindow(dpy, screen), visual, AllocNone);
658 XInstallColormap(dpy, cmap); 744 XInstallColormap(dpy, cmap);
659 } 745 }
660 } 746 }
661 } 747 }
694 XtSetArg (al[4], XtNheight, HeightOfScreen (ScreenOfDisplay (dpy, screen))); 780 XtSetArg (al[4], XtNheight, HeightOfScreen (ScreenOfDisplay (dpy, screen)));
695 XtSetValues (app_shell, al, countof (al)); 781 XtSetValues (app_shell, al, countof (al));
696 XtRealizeWidget (app_shell); 782 XtRealizeWidget (app_shell);
697 } 783 }
698 784
699 #ifdef HAVE_SESSION 785 #ifdef HAVE_WMCOMMAND
700 { 786 {
701 int new_argc; 787 int new_argc;
702 char **new_argv; 788 char **new_argv;
703 make_argc_argv (Vcommand_line_args, &new_argc, &new_argv); 789 make_argc_argv (Vcommand_line_args, &new_argc, &new_argv);
704 XSetCommand (XtDisplay (app_shell), XtWindow (app_shell), new_argv, new_argc); 790 XSetCommand (XtDisplay (app_shell), XtWindow (app_shell), new_argv, new_argc);
705 free_argc_argv (new_argv); 791 free_argc_argv (new_argv);
706 } 792 }
707 #endif /* HAVE_SESSION */ 793 #endif /* HAVE_WMCOMMAND */
708 794
709 795
710 #ifdef HAVE_OFFIX_DND 796 #ifdef HAVE_OFFIX_DND
711 DndInitialize ( app_shell ); 797 DndInitialize ( app_shell );
712 #endif 798 #endif
726 init_one_device (d); 812 init_one_device (d);
727 813
728 DEVICE_X_GC_CACHE (d) = make_gc_cache (dpy, XtWindow(app_shell)); 814 DEVICE_X_GC_CACHE (d) = make_gc_cache (dpy, XtWindow(app_shell));
729 DEVICE_X_GRAY_PIXMAP (d) = None; 815 DEVICE_X_GRAY_PIXMAP (d) = None;
730 Xatoms_of_device_x (d); 816 Xatoms_of_device_x (d);
731 Xatoms_of_xselect (d); 817 Xatoms_of_select_x (d);
732 Xatoms_of_objects_x (d); 818 Xatoms_of_objects_x (d);
733 x_init_device_class (d); 819 x_init_device_class (d);
734 820
735 /* Run the elisp side of the X device initialization. */ 821 /* Run the elisp side of the X device initialization. */
736 call0 (Qinit_pre_x_win); 822 call0 (Qinit_pre_x_win);
741 { 827 {
742 call0 (Qinit_post_x_win); 828 call0 (Qinit_post_x_win);
743 } 829 }
744 830
745 static void 831 static void
746 x_mark_device (struct device *d, void (*markobj) (Lisp_Object)) 832 x_mark_device (struct device *d)
747 { 833 {
748 markobj (DEVICE_X_WM_COMMAND_FRAME (d)); 834 mark_object (DEVICE_X_WM_COMMAND_FRAME (d));
749 markobj (DEVICE_X_DATA (d)->x_keysym_map_hash_table); 835 mark_object (DEVICE_X_DATA (d)->x_keysym_map_hash_table);
750 } 836 }
751 837
752 838
753 /************************************************************************/ 839 /************************************************************************/
754 /* closing an X connection */ 840 /* closing an X connection */
825 911
826 /************************************************************************/ 912 /************************************************************************/
827 /* handle X errors */ 913 /* handle X errors */
828 /************************************************************************/ 914 /************************************************************************/
829 915
830 CONST char * 916 const char *
831 x_event_name (int event_type) 917 x_event_name (int event_type)
832 { 918 {
833 static CONST char *events[] = 919 static const char *events[] =
834 { 920 {
835 "0: ERROR!", 921 "0: ERROR!",
836 "1: REPLY", 922 "1: REPLY",
837 "KeyPress", 923 "KeyPress",
838 "KeyRelease", 924 "KeyRelease",
1333 1419
1334 The returned value of this function is nil if the queried resource is not 1420 The returned value of this function is nil if the queried resource is not
1335 found. If the third arg is `string', a string is returned, and if it is 1421 found. If the third arg is `string', a string is returned, and if it is
1336 `integer', an integer is returned. If the third arg is `boolean', then the 1422 `integer', an integer is returned. If the third arg is `boolean', then the
1337 returned value is the list (t) for true, (nil) for false, and is nil to 1423 returned value is the list (t) for true, (nil) for false, and is nil to
1338 mean ``unspecified.'' 1424 mean ``unspecified''.
1339 */ 1425 */
1340 (name, class, type, locale, device, no_error)) 1426 (name, class, type, locale, device, no_error))
1341 { 1427 {
1342 char* name_string, *class_string; 1428 char* name_string, *class_string;
1343 char *raw_result; 1429 char *raw_result;
1596 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in 1682 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
1597 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system. 1683 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system.
1598 */ 1684 */
1599 (keysym)) 1685 (keysym))
1600 { 1686 {
1601 CONST char *keysym_ext; 1687 const char *keysym_ext;
1602 1688
1603 CHECK_STRING (keysym); 1689 CHECK_STRING (keysym);
1604 GET_C_STRING_CTEXT_DATA_ALLOCA (keysym, keysym_ext); 1690 TO_EXTERNAL_FORMAT (LISP_STRING, keysym,
1691 C_STRING_ALLOCA, keysym_ext,
1692 Qctext);
1605 1693
1606 return XStringToKeysym (keysym_ext) ? Qt : Qnil; 1694 return XStringToKeysym (keysym_ext) ? Qt : Qnil;
1607 } 1695 }
1608 1696
1609 DEFUN ("x-keysym-hash-table", Fx_keysym_hash_table, 0, 1, 0, /* 1697 DEFUN ("x-keysym-hash-table", Fx_keysym_hash_table, 0, 1, 0, /*
1610 Return a hash table which contains a hash key for all keysyms which 1698 Return a hash table containing a key for all keysyms on DEVICE.
1611 name keys on the keyboard. See `x-keysym-on-keyboard-p'. 1699 DEVICE must be an X11 display device. See `x-keysym-on-keyboard-p'.
1612 */ 1700 */
1613 (device)) 1701 (device))
1614 { 1702 {
1615 struct device *d = decode_device (device); 1703 struct device *d = decode_device (device);
1616 if (!DEVICE_X_P (d)) 1704 if (!DEVICE_X_P (d))
1748 DEFUN ("x-grab-keyboard", Fx_grab_keyboard, 0, 1, 0, /* 1836 DEFUN ("x-grab-keyboard", Fx_grab_keyboard, 0, 1, 0, /*
1749 Grab the keyboard on the given device (defaulting to the selected one). 1837 Grab the keyboard on the given device (defaulting to the selected one).
1750 So long as the keyboard is grabbed, all keyboard events will be delivered 1838 So long as the keyboard is grabbed, all keyboard events will be delivered
1751 to emacs -- it is not possible for other X clients to eavesdrop on them. 1839 to emacs -- it is not possible for other X clients to eavesdrop on them.
1752 Ungrab the keyboard with `x-ungrab-keyboard' (use an unwind-protect). 1840 Ungrab the keyboard with `x-ungrab-keyboard' (use an unwind-protect).
1753 Returns t if the grab was successful; nil otherwise. 1841 Returns t if the grab is successful, nil otherwise.
1754 */ 1842 */
1755 (device)) 1843 (device))
1756 { 1844 {
1757 struct device *d = decode_x_device (device); 1845 struct device *d = decode_x_device (device);
1758 Window w = XtWindow (FRAME_X_TEXT_WIDGET (device_selected_frame (d))); 1846 Window w = XtWindow (FRAME_X_TEXT_WIDGET (device_selected_frame (d)));
1800 */ 1888 */
1801 (device)) 1889 (device))
1802 { 1890 {
1803 Display *dpy = get_x_display (device); 1891 Display *dpy = get_x_display (device);
1804 int ndirs_return; 1892 int ndirs_return;
1805 CONST char **directories = (CONST char **) XGetFontPath (dpy, &ndirs_return); 1893 const char **directories = (const char **) XGetFontPath (dpy, &ndirs_return);
1806 Lisp_Object font_path = Qnil; 1894 Lisp_Object font_path = Qnil;
1807 1895
1808 if (!directories) 1896 if (!directories)
1809 signal_simple_error ("Can't get X font path", device); 1897 signal_simple_error ("Can't get X font path", device);
1810 1898
1811 while (ndirs_return--) 1899 while (ndirs_return--)
1812 font_path = Fcons (build_ext_string (directories[ndirs_return], 1900 font_path = Fcons (build_ext_string (directories[ndirs_return],
1813 FORMAT_FILENAME), font_path); 1901 Qfile_name),
1902 font_path);
1814 1903
1815 return font_path; 1904 return font_path;
1816 } 1905 }
1817 1906
1818 DEFUN ("x-set-font-path", Fx_set_font_path, 1, 2, 0, /* 1907 DEFUN ("x-set-font-path", Fx_set_font_path, 1, 2, 0, /*
1831 */ 1920 */
1832 (font_path, device)) 1921 (font_path, device))
1833 { 1922 {
1834 Display *dpy = get_x_display (device); 1923 Display *dpy = get_x_display (device);
1835 Lisp_Object path_entry; 1924 Lisp_Object path_entry;
1836 CONST char **directories; 1925 const char **directories;
1837 int i=0,ndirs=0; 1926 int i=0,ndirs=0;
1838 1927
1839 EXTERNAL_LIST_LOOP (path_entry, font_path) 1928 EXTERNAL_LIST_LOOP (path_entry, font_path)
1840 { 1929 {
1841 CHECK_STRING (XCAR (path_entry)); 1930 CHECK_STRING (XCAR (path_entry));
1842 ndirs++; 1931 ndirs++;
1843 } 1932 }
1844 1933
1845 directories = alloca_array (CONST char *, ndirs); 1934 directories = alloca_array (const char *, ndirs);
1846 1935
1847 EXTERNAL_LIST_LOOP (path_entry, font_path) 1936 EXTERNAL_LIST_LOOP (path_entry, font_path)
1848 { 1937 {
1849 GET_C_STRING_FILENAME_DATA_ALLOCA (XCAR (path_entry), directories[i++]); 1938 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (path_entry),
1939 C_STRING_ALLOCA, directories[i++],
1940 Qfile_name);
1850 } 1941 }
1851 1942
1852 expect_x_error (dpy); 1943 expect_x_error (dpy);
1853 XSetFontPath (dpy, (char **) directories, ndirs); 1944 XSetFontPath (dpy, (char **) directories, ndirs);
1854 signal_if_x_error (dpy, 1/*resumable_p*/); 1945 signal_if_x_error (dpy, 1/*resumable_p*/);
1891 defsymbol (&Qinit_pre_x_win, "init-pre-x-win"); 1982 defsymbol (&Qinit_pre_x_win, "init-pre-x-win");
1892 defsymbol (&Qinit_post_x_win, "init-post-x-win"); 1983 defsymbol (&Qinit_post_x_win, "init-post-x-win");
1893 } 1984 }
1894 1985
1895 void 1986 void
1987 reinit_console_type_create_device_x (void)
1988 {
1989 /* Initialize variables to speed up X resource interactions */
1990 const char *valid_resource_chars =
1991 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
1992 while (*valid_resource_chars)
1993 valid_resource_char_p[(unsigned int) (*valid_resource_chars++)] = 1;
1994
1995 name_char_dynarr = Dynarr_new (char);
1996 class_char_dynarr = Dynarr_new (char);
1997 }
1998
1999 void
1896 console_type_create_device_x (void) 2000 console_type_create_device_x (void)
1897 { 2001 {
2002 reinit_console_type_create_device_x ();
1898 CONSOLE_HAS_METHOD (x, init_device); 2003 CONSOLE_HAS_METHOD (x, init_device);
1899 CONSOLE_HAS_METHOD (x, finish_init_device); 2004 CONSOLE_HAS_METHOD (x, finish_init_device);
1900 CONSOLE_HAS_METHOD (x, mark_device); 2005 CONSOLE_HAS_METHOD (x, mark_device);
1901 CONSOLE_HAS_METHOD (x, delete_device); 2006 CONSOLE_HAS_METHOD (x, delete_device);
1902 CONSOLE_HAS_METHOD (x, device_system_metrics); 2007 CONSOLE_HAS_METHOD (x, device_system_metrics);
1903 2008 }
1904 { 2009
1905 /* Initialize variables to speed up X resource interactions */ 2010 void
1906 CONST char *valid_resource_chars = 2011 reinit_vars_of_device_x (void)
1907 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; 2012 {
1908 while (*valid_resource_chars) 2013 error_expected = 0;
1909 valid_resource_char_p[(unsigned int) (*valid_resource_chars++)] = 1; 2014 error_occurred = 0;
1910 2015
1911 name_char_dynarr = Dynarr_new (char); 2016 in_resource_setting = 0;
1912 class_char_dynarr = Dynarr_new (char);
1913 }
1914 } 2017 }
1915 2018
1916 void 2019 void
1917 vars_of_device_x (void) 2020 vars_of_device_x (void)
1918 { 2021 {
2022 reinit_vars_of_device_x ();
2023
1919 DEFVAR_LISP ("x-emacs-application-class", &Vx_emacs_application_class /* 2024 DEFVAR_LISP ("x-emacs-application-class", &Vx_emacs_application_class /*
1920 The X application class of the XEmacs process. 2025 The X application class of the XEmacs process.
1921 This controls, among other things, the name of the `app-defaults' file 2026 This controls, among other things, the name of the `app-defaults' file
1922 that XEmacs will use. For changes to this variable to take effect, they 2027 that XEmacs will use. For changes to this variable to take effect, they
1923 must be made before the connection to the X server is initialized, that is, 2028 must be made before the connection to the X server is initialized, that is,
1956 2061
1957 Fprovide (Qx); 2062 Fprovide (Qx);
1958 2063
1959 staticpro (&Vdefault_x_device); 2064 staticpro (&Vdefault_x_device);
1960 Vdefault_x_device = Qnil; 2065 Vdefault_x_device = Qnil;
1961 2066 }
1962 error_expected = 0;
1963 error_occurred = 0;
1964
1965 in_resource_setting = 0;
1966 }