changeset 84455:04182505543b

(x_term_init): Give error if can't open DISPLAY_NAME.
author Richard M. Stallman <rms@gnu.org>
date Mon, 10 Sep 2007 17:34:01 +0000
parents 371bf4ba333b
children 26077e45b33f
files src/xterm.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Mon Sep 10 17:25:58 2007 +0000
+++ b/src/xterm.c	Mon Sep 10 17:34:01 2007 +0000
@@ -10586,9 +10586,12 @@
   *bits = nr;
 }
 
+/* Return 1 if display DISPLAY is available for use, 0 otherwise.
+   But don't permanently open it, just test its availability.  */
+
 int
 x_display_ok (display)
-    const char * display;
+    const char *display;
 {
     int dpy_ok = 1;
     Display *dpy;
@@ -10601,6 +10604,10 @@
     return dpy_ok;
 }
 
+/* Open a connection to X display DISPLAY_NAME, and return
+   the structure that describes the open display.
+   If we cannot contact the display, return null.  */
+
 struct x_display_info *
 x_term_init (display_name, xrm_option, resource_name)
      Lisp_Object display_name;
@@ -10621,6 +10628,9 @@
       ++x_initialized;
     }
 
+  if (! x_display_ok (SDATA (display_name)))
+    error ("Display %s can't be opened", SDATA (display_name));
+
 #ifdef USE_GTK
   {
 #define NUM_ARGV 10