Mercurial > hg > xemacs-beta
comparison src/device-x.c @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | bc4f2511bbea |
children | d1247f3cc363 |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
33 #include "buffer.h" | 33 #include "buffer.h" |
34 #include "device-impl.h" | 34 #include "device-impl.h" |
35 #include "elhash.h" | 35 #include "elhash.h" |
36 #include "events.h" | 36 #include "events.h" |
37 #include "faces.h" | 37 #include "faces.h" |
38 #include "file-coding.h" | |
38 #include "frame-impl.h" | 39 #include "frame-impl.h" |
39 #include "process.h" /* for egetenv */ | 40 #include "process.h" /* for egetenv */ |
40 #include "redisplay.h" | 41 #include "redisplay.h" |
41 #include "sysdep.h" | 42 #include "sysdep.h" |
42 #include "window.h" | 43 #include "window.h" |
52 #include <X11/CoreP.h> /* Numerous places access the fields of | 53 #include <X11/CoreP.h> /* Numerous places access the fields of |
53 a core widget directly. We could | 54 a core widget directly. We could |
54 use XtGetValues(), but ... */ | 55 use XtGetValues(), but ... */ |
55 #include "xgccache.h" | 56 #include "xgccache.h" |
56 #include <X11/Shell.h> | 57 #include <X11/Shell.h> |
57 #include "xmu.h" | 58 #include <X11/Xmu/Error.h> |
58 | 59 |
59 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D) | 60 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D) |
60 #include "sysdll.h" | 61 #include "sysdll.h" |
61 #endif /* HAVE_SHLIB and LWLIB_USES_ATHENA and not HAVE_ATHENA_3D */ | 62 #endif /* HAVE_SHLIB and LWLIB_USES_ATHENA and not HAVE_ATHENA_3D */ |
62 | 63 |
63 #ifdef HAVE_OFFIX_DND | 64 Lisp_Object Vx_app_defaults_directory; |
64 #include "offix.h" | |
65 #endif | |
66 | |
67 #ifdef MULE | 65 #ifdef MULE |
68 Lisp_Object Vx_app_defaults_directory; | |
69 Lisp_Object Qget_coding_system_from_locale; | 66 Lisp_Object Qget_coding_system_from_locale; |
70 #endif | 67 #endif |
71 | 68 |
72 /* Qdisplay in general.c */ | 69 /* Qdisplay in general.c */ |
73 Lisp_Object Qx_error; | 70 Lisp_Object Qx_error; |
74 Lisp_Object Qinit_pre_x_win, Qinit_post_x_win; | 71 Lisp_Object Qmake_device_early_x_entry_point, Qmake_device_late_x_entry_point; |
75 | 72 |
76 /* The application class of Emacs. */ | 73 /* The application class of Emacs. */ |
77 Lisp_Object Vx_emacs_application_class; | 74 Lisp_Object Vx_emacs_application_class; |
78 | 75 |
79 Lisp_Object Vx_initial_argv_list; /* #### ugh! */ | 76 Lisp_Object Vx_initial_argv_list; /* #### ugh! */ |
80 | 77 |
78 /* Shut up G++ 4.3. */ | |
79 #define Xrm_ODR(option,resource,type,default) \ | |
80 { (String) option, (String) resource, type, default } | |
81 | |
81 static XrmOptionDescRec emacs_options[] = | 82 static XrmOptionDescRec emacs_options[] = |
82 { | 83 { |
83 {"-geometry", ".geometry", XrmoptionSepArg, NULL}, | 84 Xrm_ODR ("-geometry", ".geometry", XrmoptionSepArg, NULL), |
84 {"-iconic", ".iconic", XrmoptionNoArg, "yes"}, | 85 Xrm_ODR ("-iconic", ".iconic", XrmoptionNoArg, (String) "yes"), |
85 | 86 |
86 {"-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL}, | 87 Xrm_ODR ("-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL), |
87 {"-ib", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL}, | 88 Xrm_ODR ("-ib", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL), |
88 {"-scrollbar-width", "*EmacsFrame.scrollBarWidth", XrmoptionSepArg, NULL}, | 89 Xrm_ODR ("-scrollbar-width", "*EmacsFrame.scrollBarWidth", XrmoptionSepArg, NULL), |
89 {"-scrollbar-height", "*EmacsFrame.scrollBarHeight", XrmoptionSepArg, NULL}, | 90 Xrm_ODR ("-scrollbar-height", "*EmacsFrame.scrollBarHeight", XrmoptionSepArg, NULL), |
90 | 91 |
91 {"-privatecolormap", ".privateColormap", XrmoptionNoArg, "yes"}, | 92 Xrm_ODR ("-privatecolormap", ".privateColormap", XrmoptionNoArg, (String) "yes"), |
92 {"-visual", ".EmacsVisual", XrmoptionSepArg, NULL}, | 93 Xrm_ODR ("-visual", ".EmacsVisual", XrmoptionSepArg, NULL), |
93 | 94 |
94 /* #### Beware! If the type of the shell changes, update this. */ | 95 /* #### Beware! If the type of the shell changes, update this. */ |
95 {"-T", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, | 96 Xrm_ODR ("-T", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL), |
96 {"-wn", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, | 97 Xrm_ODR ("-wn", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL), |
97 {"-title", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL}, | 98 Xrm_ODR ("-title", "*TopLevelEmacsShell.title", XrmoptionSepArg, NULL), |
98 | 99 |
99 {"-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL}, | 100 Xrm_ODR ("-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL), |
100 {"-in", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL}, | 101 Xrm_ODR ("-in", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL), |
101 {"-mc", "*pointerColor", XrmoptionSepArg, NULL}, | 102 Xrm_ODR ("-mc", "*pointerColor", XrmoptionSepArg, NULL), |
102 {"-cr", "*cursorColor", XrmoptionSepArg, NULL}, | 103 Xrm_ODR ("-cr", "*cursorColor", XrmoptionSepArg, NULL), |
103 {"-fontset", "*FontSet", XrmoptionSepArg, NULL}, | 104 Xrm_ODR ("-fontset", "*FontSet", XrmoptionSepArg, NULL), |
104 }; | 105 }; |
105 | 106 |
106 static const struct memory_description x_device_data_description_1 [] = { | 107 static const struct memory_description x_device_data_description_1 [] = { |
107 { XD_LISP_OBJECT, offsetof (struct x_device, x_keysym_map_hash_table) }, | 108 { XD_LISP_OBJECT, offsetof (struct x_device, x_keysym_map_hash_table) }, |
108 { XD_LISP_OBJECT, offsetof (struct x_device, WM_COMMAND_frame) }, | 109 { XD_LISP_OBJECT, offsetof (struct x_device, WM_COMMAND_frame) }, |
109 { XD_END } | 110 { XD_END } |
110 }; | 111 }; |
111 | 112 |
113 #ifdef NEW_GC | |
114 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("x-device", x_device, | |
115 0, x_device_data_description_1, | |
116 Lisp_X_Device); | |
117 #else /* not NEW_GC */ | |
112 extern const struct sized_memory_description x_device_data_description; | 118 extern const struct sized_memory_description x_device_data_description; |
113 | 119 |
114 const struct sized_memory_description x_device_data_description = { | 120 const struct sized_memory_description x_device_data_description = { |
115 sizeof (struct x_device), x_device_data_description_1 | 121 sizeof (struct x_device), x_device_data_description_1 |
116 }; | 122 }; |
123 #endif /* not NEW_GC */ | |
117 | 124 |
118 /* Functions to synchronize mirroring resources and specifiers */ | 125 /* Functions to synchronize mirroring resources and specifiers */ |
119 int in_resource_setting; | 126 int in_resource_setting; |
120 | 127 |
121 /************************************************************************/ | 128 /************************************************************************/ |
182 | 189 |
183 static Lisp_Object | 190 static Lisp_Object |
184 coding_system_of_xrm_database (XrmDatabase USED_IF_MULE (db)) | 191 coding_system_of_xrm_database (XrmDatabase USED_IF_MULE (db)) |
185 { | 192 { |
186 #ifdef MULE | 193 #ifdef MULE |
187 const Extbyte *locale = XrmLocaleOfDatabase (db); | 194 const Extbyte *locale; |
188 Lisp_Object localestr = build_ext_string (locale, Qbinary); | 195 Lisp_Object localestr; |
189 return call1 (Qget_coding_system_from_locale, localestr); | 196 static XrmDatabase last_xrm_db; |
197 | |
198 /* This will always be zero, nil or an actual coding system object, so no | |
199 need to worry about GCPROing it--it'll be protected from garbage | |
200 collection by means of Vcoding_system_hash_table in file-coding.c. */ | |
201 static Lisp_Object last_coding_system; | |
202 | |
203 if (db == last_xrm_db) | |
204 { | |
205 return last_coding_system; | |
206 } | |
207 | |
208 last_xrm_db = db; | |
209 | |
210 locale = XrmLocaleOfDatabase (db); | |
211 localestr = build_ext_string (locale, Qbinary); | |
212 last_coding_system = call1 (Qget_coding_system_from_locale, localestr); | |
213 | |
214 return last_coding_system; | |
190 #else | 215 #else |
191 return Qbinary; | 216 return Qbinary; |
192 #endif | 217 #endif |
193 } | 218 } |
194 | 219 |
200 static struct device *device_being_initialized = NULL; | 225 static struct device *device_being_initialized = NULL; |
201 | 226 |
202 static void | 227 static void |
203 allocate_x_device_struct (struct device *d) | 228 allocate_x_device_struct (struct device *d) |
204 { | 229 { |
230 #ifdef NEW_GC | |
231 d->device_data = alloc_lrecord_type (struct x_device, &lrecord_x_device); | |
232 #else /* not NEW_GC */ | |
205 d->device_data = xnew_and_zero (struct x_device); | 233 d->device_data = xnew_and_zero (struct x_device); |
234 #endif /* not NEW_GC */ | |
206 } | 235 } |
207 | 236 |
208 static void | 237 static void |
209 Xatoms_of_device_x (struct device *d) | 238 Xatoms_of_device_x (struct device *d) |
210 { | 239 { |
296 return argv[i+1]; | 325 return argv[i+1]; |
297 | 326 |
298 if (argc > 0 && argv[0] && *argv[0]) | 327 if (argc > 0 && argv[0] && *argv[0]) |
299 return (ptr = strrchr (argv[0], '/')) ? ++ptr : argv[0]; | 328 return (ptr = strrchr (argv[0], '/')) ? ++ptr : argv[0]; |
300 | 329 |
301 return "xemacs"; | 330 return (Extbyte *) "xemacs"; /* shut up g++ 4.3 */ |
302 } | 331 } |
303 | 332 |
304 /* | 333 /* |
305 * This function figures out whether the user has any resources of the | 334 * This function figures out whether the user has any resources of the |
306 * form "XEmacs.foo" or "XEmacs*foo". | 335 * form "XEmacs.foo" or "XEmacs*foo". |
310 * xdefs = XScreenResourceString(ScreenOfDisplay(dpy, scrno)); | 339 * xdefs = XScreenResourceString(ScreenOfDisplay(dpy, scrno)); |
311 */ | 340 */ |
312 static int | 341 static int |
313 have_xemacs_resources_in_xrdb (Display *dpy) | 342 have_xemacs_resources_in_xrdb (Display *dpy) |
314 { | 343 { |
315 char *xdefs, *key; | 344 const char *xdefs, *key; |
316 int len; | 345 int len; |
317 | 346 |
318 #ifdef INFODOCK | 347 #ifdef INFODOCK |
319 key = "InfoDock"; | 348 key = "InfoDock"; |
320 #else | 349 #else |
508 int depth = 8; /* shut up the compiler */ | 537 int depth = 8; /* shut up the compiler */ |
509 Colormap cmap; | 538 Colormap cmap; |
510 int screen; | 539 int screen; |
511 /* */ | 540 /* */ |
512 int best_visual_found = 0; | 541 int best_visual_found = 0; |
542 | |
543 /* Run the elisp side of the X device initialization, allowing it to set | |
544 x-emacs-application-class and x-app-defaults-directory. */ | |
545 call0 (Qmake_device_early_x_entry_point); | |
513 | 546 |
514 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D) | 547 #if defined(HAVE_SHLIB) && defined(LWLIB_USES_ATHENA) && !defined(HAVE_ATHENA_3D) |
515 /* | 548 /* |
516 * In order to avoid the lossage with flat Athena widgets dynamically | 549 * In order to avoid the lossage with flat Athena widgets dynamically |
517 * linking to one of the ThreeD variants, using the dynamic symbol helpers | 550 * linking to one of the ThreeD variants, using the dynamic symbol helpers |
651 data-directory/app-defaults/$LANG/Emacs. | 684 data-directory/app-defaults/$LANG/Emacs. |
652 This is in addition to the standard app-defaults files, and | 685 This is in addition to the standard app-defaults files, and |
653 does not override resources defined elsewhere */ | 686 does not override resources defined elsewhere */ |
654 const Extbyte *data_dir; | 687 const Extbyte *data_dir; |
655 Extbyte *path; | 688 Extbyte *path; |
689 const Extbyte *format; | |
656 XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */ | 690 XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */ |
657 const Extbyte *locale = XrmLocaleOfDatabase (db); | 691 const Extbyte *locale = xstrdup (XrmLocaleOfDatabase (db)); |
692 Extbyte *locale_end; | |
658 | 693 |
659 if (STRINGP (Vx_app_defaults_directory) && | 694 if (STRINGP (Vx_app_defaults_directory) && |
660 XSTRING_LENGTH (Vx_app_defaults_directory) > 0) | 695 XSTRING_LENGTH (Vx_app_defaults_directory) > 0) |
661 { | 696 { |
662 LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, | 697 LISP_STRING_TO_EXTERNAL (Vx_app_defaults_directory, data_dir, |
663 Qfile_name); | 698 Qfile_name); |
664 path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7); | 699 path = alloca_extbytes (strlen (data_dir) + strlen (locale) + 7); |
665 sprintf (path, "%s%s/Emacs", data_dir, locale); | 700 format = "%s%s/Emacs"; |
666 if (!access (path, R_OK)) | |
667 XrmCombineFileDatabase (path, &db, False); | |
668 } | 701 } |
669 else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) | 702 else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) > 0) |
670 { | 703 { |
671 LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name); | 704 LISP_STRING_TO_EXTERNAL (Vdata_directory, data_dir, Qfile_name); |
672 path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7); | 705 path = alloca_extbytes (strlen (data_dir) + 13 + strlen (locale) + 7); |
673 sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale); | 706 format = "%sapp-defaults/%s/Emacs"; |
674 if (!access (path, R_OK)) | |
675 XrmCombineFileDatabase (path, &db, False); | |
676 } | 707 } |
708 else | |
709 { | |
710 goto no_data_directory; | |
711 } | |
712 | |
713 /* | |
714 * The general form for $LANG is <language>_<country>.<encoding>. Try | |
715 * that form, <language>_<country> and <language> and load for first | |
716 * app-defaults file found. | |
717 */ | |
718 | |
719 sprintf (path, format, data_dir, locale); | |
720 if (!access (path, R_OK)) | |
721 XrmCombineFileDatabase (path, &db, False); | |
722 | |
723 if ((locale_end = strchr(locale, '.'))) { | |
724 *locale_end = '\0'; | |
725 sprintf (path, format, data_dir, locale); | |
726 | |
727 if (!access (path, R_OK)) | |
728 XrmCombineFileDatabase (path, &db, False); | |
729 } | |
730 | |
731 if ((locale_end = strchr(locale, '_'))) { | |
732 *locale_end = '\0'; | |
733 sprintf (path, format, data_dir, locale); | |
734 | |
735 if (!access (path, R_OK)) | |
736 XrmCombineFileDatabase (path, &db, False); | |
737 } | |
738 | |
739 no_data_directory: | |
740 { | |
741 /* Cast off const for G++ 4.3. */ | |
742 Extbyte *temp = (Extbyte *) locale; | |
743 xfree (temp, Extbyte*); | |
744 } | |
677 } | 745 } |
678 #endif /* MULE */ | 746 #endif /* MULE */ |
679 | 747 |
680 if (NILP (DEVICE_NAME (d))) | 748 if (NILP (DEVICE_NAME (d))) |
681 DEVICE_NAME (d) = display; | 749 DEVICE_NAME (d) = display; |
793 | 861 |
794 /* #### If we're going to implement X session management, this would | 862 /* #### If we're going to implement X session management, this would |
795 be the place. Make sure it doesn't conflict with GNOME. */ | 863 be the place. Make sure it doesn't conflict with GNOME. */ |
796 { | 864 { |
797 Arg al[3]; | 865 Arg al[3]; |
798 XtSetArg (al[0], XtNvisual, visual); | 866 Xt_SET_ARG (al[0], XtNvisual, visual); |
799 XtSetArg (al[1], XtNdepth, depth); | 867 Xt_SET_ARG (al[1], XtNdepth, depth); |
800 XtSetArg (al[2], XtNcolormap, cmap); | 868 Xt_SET_ARG (al[2], XtNcolormap, cmap); |
801 | 869 |
802 app_shell = XtAppCreateShell (NULL, app_class, | 870 app_shell = XtAppCreateShell (NULL, app_class, |
803 applicationShellWidgetClass, | 871 applicationShellWidgetClass, |
804 dpy, al, countof (al)); | 872 dpy, al, countof (al)); |
805 } | 873 } |
812 | 880 |
813 /* Realize the app_shell so that its window exists for GC creation purposes, | 881 /* Realize the app_shell so that its window exists for GC creation purposes, |
814 and set it to the size of the root window for child placement purposes */ | 882 and set it to the size of the root window for child placement purposes */ |
815 { | 883 { |
816 Arg al[5]; | 884 Arg al[5]; |
817 XtSetArg (al[0], XtNmappedWhenManaged, False); | 885 Xt_SET_ARG (al[0], XtNmappedWhenManaged, False); |
818 XtSetArg (al[1], XtNx, 0); | 886 Xt_SET_ARG (al[1], XtNx, 0); |
819 XtSetArg (al[2], XtNy, 0); | 887 Xt_SET_ARG (al[2], XtNy, 0); |
820 XtSetArg (al[3], XtNwidth, WidthOfScreen (ScreenOfDisplay (dpy, screen))); | 888 Xt_SET_ARG (al[3], XtNwidth, |
821 XtSetArg (al[4], XtNheight, HeightOfScreen (ScreenOfDisplay (dpy, screen))); | 889 WidthOfScreen (ScreenOfDisplay (dpy, screen))); |
890 Xt_SET_ARG (al[4], XtNheight, | |
891 HeightOfScreen (ScreenOfDisplay (dpy, screen))); | |
822 XtSetValues (app_shell, al, countof (al)); | 892 XtSetValues (app_shell, al, countof (al)); |
823 XtRealizeWidget (app_shell); | 893 XtRealizeWidget (app_shell); |
824 } | 894 } |
825 | 895 |
826 #ifdef HAVE_WMCOMMAND | 896 #ifdef HAVE_WMCOMMAND |
832 (char **) new_argv, new_argc); | 902 (char **) new_argv, new_argc); |
833 free_argc_argv (new_argv); | 903 free_argc_argv (new_argv); |
834 } | 904 } |
835 #endif /* HAVE_WMCOMMAND */ | 905 #endif /* HAVE_WMCOMMAND */ |
836 | 906 |
837 | |
838 #ifdef HAVE_OFFIX_DND | |
839 DndInitialize (app_shell); | |
840 #endif | |
841 | |
842 Vx_initial_argv_list = make_arg_list (argc, argv); | 907 Vx_initial_argv_list = make_arg_list (argc, argv); |
843 free_argc_argv (argv); | 908 free_argc_argv (argv); |
844 | 909 |
845 DEVICE_X_WM_COMMAND_FRAME (d) = Qnil; | 910 DEVICE_X_WM_COMMAND_FRAME (d) = Qnil; |
846 | 911 |
857 DEVICE_X_GRAY_PIXMAP (d) = None; | 922 DEVICE_X_GRAY_PIXMAP (d) = None; |
858 Xatoms_of_device_x (d); | 923 Xatoms_of_device_x (d); |
859 Xatoms_of_select_x (d); | 924 Xatoms_of_select_x (d); |
860 Xatoms_of_objects_x (d); | 925 Xatoms_of_objects_x (d); |
861 x_init_device_class (d); | 926 x_init_device_class (d); |
862 | |
863 /* Run the elisp side of the X device initialization. */ | |
864 call0 (Qinit_pre_x_win); | |
865 } | 927 } |
866 | 928 |
867 static void | 929 static void |
868 x_finish_init_device (struct device *UNUSED (d), Lisp_Object UNUSED (props)) | 930 x_finish_init_device (struct device *d, Lisp_Object UNUSED (props)) |
869 { | 931 { |
870 call0 (Qinit_post_x_win); | 932 call1 (Qmake_device_late_x_entry_point, wrap_device (d)); |
871 } | 933 } |
872 | 934 |
873 static void | 935 static void |
874 x_mark_device (struct device *d) | 936 x_mark_device (struct device *d) |
875 { | 937 { |
880 | 942 |
881 /************************************************************************/ | 943 /************************************************************************/ |
882 /* closing an X connection */ | 944 /* closing an X connection */ |
883 /************************************************************************/ | 945 /************************************************************************/ |
884 | 946 |
947 #ifndef NEW_GC | |
885 static void | 948 static void |
886 free_x_device_struct (struct device *d) | 949 free_x_device_struct (struct device *d) |
887 { | 950 { |
888 xfree (d->device_data, void *); | 951 xfree (d->device_data, void *); |
889 } | 952 } |
953 #endif /* not NEW_GC */ | |
890 | 954 |
891 static void | 955 static void |
892 x_delete_device (struct device *d) | 956 x_delete_device (struct device *d) |
893 { | 957 { |
894 Display *display; | 958 Display *display; |
927 if (checking_free) | 991 if (checking_free) |
928 enable_strict_free_check (); | 992 enable_strict_free_check (); |
929 #endif | 993 #endif |
930 } | 994 } |
931 | 995 |
996 #ifndef NEW_GC | |
932 free_x_device_struct (d); | 997 free_x_device_struct (d); |
998 #endif /* not NEW_GC */ | |
933 } | 999 } |
934 | 1000 |
935 | 1001 |
936 /************************************************************************/ | 1002 /************************************************************************/ |
937 /* handle X errors */ | 1003 /* handle X errors */ |
1197 | 1263 |
1198 /* According to X specs, we should not return from this function, or | 1264 /* According to X specs, we should not return from this function, or |
1199 Xlib might just decide to exit(). So we mark the offending | 1265 Xlib might just decide to exit(). So we mark the offending |
1200 console for deletion and throw to top level. */ | 1266 console for deletion and throw to top level. */ |
1201 if (d) | 1267 if (d) |
1202 enqueue_magic_eval_event (io_error_delete_device, dev); | 1268 { |
1203 DEVICE_X_BEING_DELETED (d) = 1; | 1269 enqueue_magic_eval_event (io_error_delete_device, dev); |
1204 Fthrow (Qtop_level, Qnil); | 1270 DEVICE_X_BEING_DELETED (d) = 1; |
1271 } | |
1272 | |
1273 throw_or_bomb_out (Qtop_level, Qnil, 0, Qnil, Qnil); | |
1205 | 1274 |
1206 RETURN_NOT_REACHED (0); | 1275 RETURN_NOT_REACHED (0); |
1207 } | 1276 } |
1208 | 1277 |
1209 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /* | 1278 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /* |
1979 while (ndirs_return--) | 2048 while (ndirs_return--) |
1980 font_path = Fcons (build_ext_string (directories[ndirs_return], | 2049 font_path = Fcons (build_ext_string (directories[ndirs_return], |
1981 Qfile_name), | 2050 Qfile_name), |
1982 font_path); | 2051 font_path); |
1983 | 2052 |
2053 XFreeFontPath ((char **)directories); | |
2054 | |
1984 return font_path; | 2055 return font_path; |
1985 } | 2056 } |
1986 | 2057 |
1987 DEFUN ("x-set-font-path", Fx_set_font_path, 1, 2, 0, /* | 2058 DEFUN ("x-set-font-path", Fx_set_font_path, 1, 2, 0, /* |
1988 Set the X Server's font path to FONT-PATH. | 2059 Set the X Server's font path to FONT-PATH. |
2035 /************************************************************************/ | 2106 /************************************************************************/ |
2036 | 2107 |
2037 void | 2108 void |
2038 syms_of_device_x (void) | 2109 syms_of_device_x (void) |
2039 { | 2110 { |
2111 #ifdef NEW_GC | |
2112 INIT_LISP_OBJECT (x_device); | |
2113 #endif /* NEW_GC */ | |
2114 | |
2040 DEFSUBR (Fx_debug_mode); | 2115 DEFSUBR (Fx_debug_mode); |
2041 DEFSUBR (Fx_get_resource); | 2116 DEFSUBR (Fx_get_resource); |
2042 DEFSUBR (Fx_get_resource_prefix); | 2117 DEFSUBR (Fx_get_resource_prefix); |
2043 DEFSUBR (Fx_put_resource); | 2118 DEFSUBR (Fx_put_resource); |
2044 | 2119 |
2059 | 2134 |
2060 DEFSUBR (Fx_get_font_path); | 2135 DEFSUBR (Fx_get_font_path); |
2061 DEFSUBR (Fx_set_font_path); | 2136 DEFSUBR (Fx_set_font_path); |
2062 | 2137 |
2063 DEFSYMBOL (Qx_error); | 2138 DEFSYMBOL (Qx_error); |
2064 DEFSYMBOL (Qinit_pre_x_win); | 2139 DEFSYMBOL (Qmake_device_early_x_entry_point); |
2065 DEFSYMBOL (Qinit_post_x_win); | 2140 DEFSYMBOL (Qmake_device_late_x_entry_point); |
2066 | 2141 |
2067 #ifdef MULE | 2142 #ifdef MULE |
2068 DEFSYMBOL (Qget_coding_system_from_locale); | 2143 DEFSYMBOL (Qget_coding_system_from_locale); |
2069 #endif | 2144 #endif |
2070 } | 2145 } |
2133 `command-line-args-left'. Perhaps `command-line-args-left' should | 2208 `command-line-args-left'. Perhaps `command-line-args-left' should |
2134 just reside in C. | 2209 just reside in C. |
2135 */ ); | 2210 */ ); |
2136 Vx_initial_argv_list = Qnil; | 2211 Vx_initial_argv_list = Qnil; |
2137 | 2212 |
2138 #ifdef MULE | |
2139 DEFVAR_LISP ("x-app-defaults-directory", &Vx_app_defaults_directory /* | 2213 DEFVAR_LISP ("x-app-defaults-directory", &Vx_app_defaults_directory /* |
2140 Used by the Lisp code to communicate to the low level X initialization | 2214 Used by the Lisp code to communicate to the low level X initialization |
2141 where the localized init files are. | 2215 where the localized init files are. |
2142 */ ); | 2216 */ ); |
2143 Vx_app_defaults_directory = Qnil; | 2217 Vx_app_defaults_directory = Qnil; |
2144 #endif | |
2145 | 2218 |
2146 Fprovide (Qx); | 2219 Fprovide (Qx); |
2147 } | 2220 } |