comparison src/xterm.c @ 39586:2ca67ed01cd8

(XTread_socket): Return a non_ascii_keystroke for unknown keysyms. (error_msg): New variable. (x_fatal_error_signal): New function. (x_connection_closed): Set error_msg. Install x_fatal_error_signal as fatal_error_signal_hook around the call to XtCloseDisplay.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 05 Oct 2001 09:53:07 +0000
parents 5f9f7d59fd79
children 6d60a3a33839
comparison
equal deleted inserted replaced
39585:72b9c859446e 39586:2ca67ed01cd8
10524 || orig_keysym == XK_dead_abovedot 10524 || orig_keysym == XK_dead_abovedot
10525 #endif 10525 #endif
10526 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */ 10526 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
10527 || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */ 10527 || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
10528 /* Any "vendor-specific" key is ok. */ 10528 /* Any "vendor-specific" key is ok. */
10529 || (orig_keysym & (1 << 28))) 10529 || (orig_keysym & (1 << 28))
10530 || (keysym != NoSymbol && nbytes == 0))
10530 && ! (IsModifierKey (orig_keysym) 10531 && ! (IsModifierKey (orig_keysym)
10531 #ifndef HAVE_X11R5 10532 #ifndef HAVE_X11R5
10532 #ifdef XK_Mode_switch 10533 #ifdef XK_Mode_switch
10533 || ((unsigned)(orig_keysym) == XK_Mode_switch) 10534 || ((unsigned)(orig_keysym) == XK_Mode_switch)
10534 #endif 10535 #endif
11875 11876
11876 /************************************************************************ 11877 /************************************************************************
11877 Handling X errors 11878 Handling X errors
11878 ************************************************************************/ 11879 ************************************************************************/
11879 11880
11881 /* Error message passed to x_connection_closed. */
11882
11883 static char *error_msg;
11884
11885 /* Function installed as fatal_error_signal_hook.in
11886 x_connection_closed. Print the X error message, and exit normally,
11887 instead of dumping core when XtCloseDisplay fails. */
11888
11889 static void
11890 x_fatal_error_signal ()
11891 {
11892 fprintf (stderr, "%s\n", error_msg);
11893 exit (70);
11894 }
11895
11880 /* Handle the loss of connection to display DPY. ERROR_MESSAGE is 11896 /* Handle the loss of connection to display DPY. ERROR_MESSAGE is
11881 the text of an error message that lead to the connection loss. */ 11897 the text of an error message that lead to the connection loss. */
11882 11898
11883 static SIGTYPE 11899 static SIGTYPE
11884 x_connection_closed (dpy, error_message) 11900 x_connection_closed (dpy, error_message)
11886 char *error_message; 11902 char *error_message;
11887 { 11903 {
11888 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 11904 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
11889 Lisp_Object frame, tail; 11905 Lisp_Object frame, tail;
11890 int count; 11906 int count;
11891 char *msg; 11907
11892 11908 error_msg = (char *) alloca (strlen (error_message) + 1);
11893 msg = (char *) alloca (strlen (error_message) + 1); 11909 strcpy (error_msg, error_message);
11894 strcpy (msg, error_message);
11895 handling_signal = 0; 11910 handling_signal = 0;
11896 11911
11897 /* Prevent being called recursively because of an error condition 11912 /* Prevent being called recursively because of an error condition
11898 below. Otherwise, we might end up with printing ``can't find per 11913 below. Otherwise, we might end up with printing ``can't find per
11899 display information'' in the recursive call instead of printing 11914 display information'' in the recursive call instead of printing
11917 11932
11918 #ifdef USE_X_TOOLKIT 11933 #ifdef USE_X_TOOLKIT
11919 /* If DPYINFO is null, this means we didn't open the display 11934 /* If DPYINFO is null, this means we didn't open the display
11920 in the first place, so don't try to close it. */ 11935 in the first place, so don't try to close it. */
11921 if (dpyinfo) 11936 if (dpyinfo)
11922 XtCloseDisplay (dpy); 11937 {
11938 extern void (*fatal_error_signal_hook) P_ ((void));
11939 fatal_error_signal_hook = x_fatal_error_signal;
11940 XtCloseDisplay (dpy);
11941 fatal_error_signal_hook = NULL;
11942 }
11923 #endif 11943 #endif
11924 11944
11925 /* Indicate that this display is dead. */ 11945 /* Indicate that this display is dead. */
11926 if (dpyinfo) 11946 if (dpyinfo)
11927 dpyinfo->display = 0; 11947 dpyinfo->display = 0;
11958 11978
11959 x_uncatch_errors (dpy, count); 11979 x_uncatch_errors (dpy, count);
11960 11980
11961 if (x_display_list == 0) 11981 if (x_display_list == 0)
11962 { 11982 {
11963 fprintf (stderr, "%s\n", msg); 11983 fprintf (stderr, "%s\n", error_msg);
11964 shut_down_emacs (0, 0, Qnil); 11984 shut_down_emacs (0, 0, Qnil);
11965 exit (70); 11985 exit (70);
11966 } 11986 }
11967 11987
11968 /* Ordinary stack unwind doesn't deal with these. */ 11988 /* Ordinary stack unwind doesn't deal with these. */
11971 #endif 11991 #endif
11972 sigunblock (sigmask (SIGALRM)); 11992 sigunblock (sigmask (SIGALRM));
11973 TOTALLY_UNBLOCK_INPUT; 11993 TOTALLY_UNBLOCK_INPUT;
11974 11994
11975 clear_waiting_for_input (); 11995 clear_waiting_for_input ();
11976 error ("%s", msg); 11996 error ("%s", error_msg);
11977 } 11997 }
11978 11998
11979 11999
11980 /* This is the usual handler for X protocol errors. 12000 /* This is the usual handler for X protocol errors.
11981 It kills all frames on the display that we got the error for. 12001 It kills all frames on the display that we got the error for.