comparison src/device-x.c @ 373:6240c7796c7a r21-2b2

Import from CVS: tag r21-2b2
author cvs
date Mon, 13 Aug 2007 11:04:06 +0200
parents cc15677e0335
children 8626e4521993
comparison
equal deleted inserted replaced
372:49e1ed2d7ed8 373:6240c7796c7a
59 #endif 59 #endif
60 60
61 /* Qdisplay in general.c */ 61 /* Qdisplay in general.c */
62 Lisp_Object Qx_error; 62 Lisp_Object Qx_error;
63 Lisp_Object Qinit_pre_x_win, Qinit_post_x_win; 63 Lisp_Object Qinit_pre_x_win, Qinit_post_x_win;
64
65 /* $B@ZJ"(B, n. Japanese ritual suicide. */
66 int x_seppuku_on_epipe;
67 64
68 /* The application class of Emacs. */ 65 /* The application class of Emacs. */
69 Lisp_Object Vx_emacs_application_class; 66 Lisp_Object Vx_emacs_application_class;
70 67
71 Lisp_Object Vx_initial_argv_list; /* #### ugh! */ 68 Lisp_Object Vx_initial_argv_list; /* #### ugh! */
878 { 875 {
879 /* This function can GC */ 876 /* This function can GC */
880 Lisp_Object dev; 877 Lisp_Object dev;
881 struct device *d = get_device_from_display_1 (disp); 878 struct device *d = get_device_from_display_1 (disp);
882 879
883 if (d) 880 assert (d != NULL);
884 XSETDEVICE (dev, d); 881 XSETDEVICE (dev, d);
885 else
886 dev = Qnil;
887 882
888 if (NILP (find_nonminibuffer_frame_not_on_device (dev))) 883 if (NILP (find_nonminibuffer_frame_not_on_device (dev)))
889 { 884 {
890 /* We're going down. */ 885 /* We're going down. */
891 stderr_out 886 stderr_out
901 } 896 }
902 else 897 else
903 { 898 {
904 warn_when_safe 899 warn_when_safe
905 (Qx, Qcritical, 900 (Qx, Qcritical,
906 "I/O Error %d (%s) on display connection \"%s\"\n" 901 "I/O Error %d (%s) on display connection\n"
907 " after %lu requests (%lu known processed) with " 902 " \"%s\" after after %lu requests (%lu known processed)\n"
908 "%d events remaining.\n", 903 " with %d events remaining.\n"
904 " Throwing to top level.\n",
909 errno, strerror (errno), DisplayString (disp), 905 errno, strerror (errno), DisplayString (disp),
910 NextRequest (disp) - 1, LastKnownRequestProcessed (disp), 906 NextRequest (disp) - 1, LastKnownRequestProcessed (disp),
911 QLength (disp)); 907 QLength (disp));
912 } 908 }
913 909
910 /* According to X specs, we should not return from this function, or
911 Xlib might just decide to exit(). So we mark the offending
912 console for deletion and throw to top level. */
914 if (d) 913 if (d)
915 enqueue_magic_eval_event (io_error_delete_device, dev); 914 enqueue_magic_eval_event (io_error_delete_device, dev);
916 915 DEVICE_X_BEING_DELETED (d) = 1;
917 /* CvE, July 16, 1996, XEmacs 19.14 */ 916 Fthrow (Qtop_level, Qnil);
918 /* Test for broken pipe error, which indicates X-server has gone down */ 917
919 if (errno == EPIPE && x_seppuku_on_epipe) 918 RETURN_NOT_REACHED (0);
920 {
921 /* Most probably X-server has gone down: Avoid infinite loop by just */
922 /* exiting */
923 /* slb: This sounds really, really dangerous to do by default, so */
924 /* I'm adding a guard to avoid doing this as default behavior */
925 stderr_out( "\n\nXEmacs exiting on broken pipe (errno %d, %s)\n",
926 errno, strerror(errno));
927 exit(errno);
928 }
929
930 return 0;
931 } 919 }
932 920
933 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /* 921 DEFUN ("x-debug-mode", Fx_debug_mode, 1, 2, 0, /*
934 With a true arg, make the connection to the X server synchronous. 922 With a true arg, make the connection to the X server synchronous.
935 With false, make it asynchronous. Synchronous connections are much slower, 923 With false, make it asynchronous. Synchronous connections are much slower,
1732 `command-line-args-left'. Perhaps `command-line-args-left' should 1720 `command-line-args-left'. Perhaps `command-line-args-left' should
1733 just reside in C. 1721 just reside in C.
1734 */ ); 1722 */ );
1735 Vx_initial_argv_list = Qnil; 1723 Vx_initial_argv_list = Qnil;
1736 1724
1737 DEFVAR_BOOL ("x-seppuku-on-epipe", &x_seppuku_on_epipe /*
1738 When non-nil, terminate XEmacs immediately on SIGPIPE from the X server.
1739 XEmacs doesn't terminate properly on some systems.
1740 When this variable is non-nil, XEmacs will commit immediate suicide
1741 when it gets a sigpipe from the X Server.
1742 */ );
1743 x_seppuku_on_epipe = 0;
1744
1745 #if defined(MULE) && (defined(LWLIB_MENUBARS_MOTIF) || defined(HAVE_XIM) || defined (USE_XFONTSET)) 1725 #if defined(MULE) && (defined(LWLIB_MENUBARS_MOTIF) || defined(HAVE_XIM) || defined (USE_XFONTSET))
1746 DEFVAR_LISP ("x-app-defaults-directory", &Vx_app_defaults_directory /* 1726 DEFVAR_LISP ("x-app-defaults-directory", &Vx_app_defaults_directory /*
1747 Used by the Lisp code to communicate to the low level X initialization 1727 Used by the Lisp code to communicate to the low level X initialization
1748 where the localized init files are. 1728 where the localized init files are.
1749 */ ); 1729 */ );