X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d2bd6bc4c14eb86c92aeaf7b681ee4d265158983..f000f5c5ac061ad8075841b9c8fb2019ae5fc531:/src/xterm.c diff --git a/src/xterm.c b/src/xterm.c index 79561dcaac..977e1b8020 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -115,7 +115,10 @@ extern void _XEditResCheckMessages (); #endif #ifdef SOLARIS2 -#define X_CONNECTION_LOCK_FLAG XlibDisplayWriting +/* memmove will be defined as a macro in Xfuncs.h unless + is included beforehand. The declaration for memmove in + will cause a syntax error when Xfuncs.h later includes it. */ +#include #endif #ifndef min @@ -141,6 +144,8 @@ Lisp_Object x_display_name_list; is the frame to apply to. */ extern struct frame *updating_frame; +extern waiting_for_input; + /* This is a frame waiting to be autoraised, within XTread_socket. */ struct frame *pending_autoraise_frame; @@ -3295,7 +3300,12 @@ XTread_socket (sd, bufp, numchars, waitp, expected) while (XPending (dpyinfo->display) != 0) { +#ifdef USE_X_TOOLKIT + /* needed to raise Motif submenus */ + XtAppNextEvent (Xt_app_con, &event); +#else XNextEvent (dpyinfo->display, &event); +#endif event_found = 1; switch (event.type) @@ -3344,7 +3354,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) XSetCommand (FRAME_X_DISPLAY (f), event.xclient.window, initial_argv, initial_argc); - else + else if (f) XSetCommand (FRAME_X_DISPLAY (f), event.xclient.window, 0, 0); @@ -3549,7 +3559,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) /* We can't distinguish, from the event, whether the window has become iconified or invisible. So assume, if it was previously visible, than now it is iconified. - We depend on x_make_frame_invisible to mark it iconified. */ + We depend on x_make_frame_invisible to mark it invisible. */ if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) f->async_iconified = 1; @@ -4509,7 +4519,7 @@ x_connection_closed (display, error_message) if (x_display_list == 0) { - fprintf (stderr, "%s", error_message); + fprintf (stderr, "%s\n", error_message); shut_down_emacs (0, 0, Qnil); exit (70); } @@ -4521,6 +4531,12 @@ x_connection_closed (display, error_message) sigunblock (sigmask (SIGALRM)); TOTALLY_UNBLOCK_INPUT; + if (waiting_for_input) + { + message ("%s", error_message); + quit_throw_to_read_char (); + } + error ("%s", error_message); } @@ -4560,55 +4576,19 @@ x_io_error_quitter (display) /* Handle SIGPIPE, which can happen when the connection to a server simply goes away. SIGPIPE is handled by x_connection_signal. - It works by sending a no-op command to each X server connection. - When we try a connection that has closed, we get SIGPIPE again. - But this time, it is handled by x_connection_signal_1. - That function knows which connection we were testing, - so it closes that one. - - x_connection_closed never returns, - so if more than one connection was lost at once, - we only find one. But XTread_socket keeps trying them all, - so it will notice the other closed one sooner or later. */ + Don't need to do anything, because the write which caused the + SIGPIPE will fail, causing Xlib to invoke the X IO error handler, + which will do the appropriate cleanup for us. */ - -static struct x_display_info *x_connection_signal_dpyinfo; - -static SIGTYPE x_connection_signal (); - -static SIGTYPE -x_connection_signal_1 (signalnum) /* If we don't have an argument, */ - int signalnum; /* some compilers complain in signal calls. */ -{ - signal (SIGPIPE, x_connection_signal); - x_connection_closed (x_connection_signal_dpyinfo, - "connection was lost"); -} - static SIGTYPE x_connection_signal (signalnum) /* If we don't have an argument, */ int signalnum; /* some compilers complain in signal calls. */ { - x_connection_signal_dpyinfo = x_display_list; - - sigunblock (sigmask (SIGPIPE)); - - while (x_connection_signal_dpyinfo) - { - signal (SIGPIPE, x_connection_signal_1); - - x_connection_close_if_hung (x_connection_signal_dpyinfo); - - XNoOp (x_connection_signal_dpyinfo->display); - - XSync (x_connection_signal_dpyinfo->display, False); - - /* Each time we get here, cycle through the displays now open. */ - x_connection_signal_dpyinfo = x_connection_signal_dpyinfo->next; - } - - /* We should have found some closed connection. */ - abort (); +#ifdef USG + /* USG systems forget handlers when they are used; + must reestablish each time */ + signal (signalnum, x_connection_signal); +#endif /* USG */ } /* A buffer for storing X error messages. */ @@ -5431,6 +5411,11 @@ x_iconify_frame (f) x_wm_set_window_state (f, IconicState); /* This was XtPopup, but that did nothing for an iconified frame. */ XtMapWidget (f->output_data.x->widget); + /* The server won't give us any event to indicate + that an invisible frame was changed to an icon, + so we have to record it here. */ + f->iconified = 1; + f->async_iconified = 1; UNBLOCK_INPUT; return; } @@ -6219,49 +6204,5 @@ syms_of_xterm () staticpro (&Qvendor_specific_keysyms); Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); } - -/* Avoid warnings or errors from including Xlibint.h. - We don't need these functions for the rest of this file. */ -#undef bzero -#undef bcopy -#undef bcmp -#undef min -#undef max - -#ifdef X_CONNECTION_LOCK_FLAG -#define free loserfree -#define malloc losermalloc -#define exit loserexit -#define abort loserabort -/* For XlibDisplayWriting */ -#include -#endif - -/* Check whether display connection DPYINFO is hung - because its thread-interlock is locked. - If it is, close the connection. - Do nothing if this system does not have a thread interlock. */ - -x_connection_close_if_hung (dpyinfo) - struct x_display_info *dpyinfo; -{ - /* This tests (1) whether X_CONNECTION_LOCK_FLAG is defined at all, - and (2) whether the name it is defined as is itself defined. - (It ought to have been defined by Xlibint.h. */ -#if X_CONNECTION_LOCK_FLAG - - if (dpyinfo->display->flags & X_CONNECTION_LOCK_FLAG) - { - /* If the thread-interlock is locked, assume this connection is dead. - This assumes that the library does not make other threads - that can be locking the display legitimately. */ - - dpyinfo->display->flags &= ~X_CONNECTION_LOCK_FLAG; - x_connection_closed (dpyinfo->display, "connection was lost"); - } -#endif /* X_CONNECTION_LOCK_FLAG */ -} - -/* Don't put any additional functions here! */ #endif /* not HAVE_X_WINDOWS */