From c1fc674b45aa1f241c0703207ac30b7ec79beea3 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 20 Mar 2006 22:41:23 +0000 Subject: [PATCH] * dispnew.c (init_display): Check DISPLAY here. * emacs.c (main): Don't check here. * xterm.c (x_display_ok): Don't use DISPLAY env var. --- src/ChangeLog | 8 ++++++++ src/dispnew.c | 7 +++++++ src/emacs.c | 12 ------------ src/xterm.c | 8 ++------ 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 72452257c84..97d3fe46c47 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2006-03-20 Andreas Schwab + + * dispnew.c (init_display): Check DISPLAY here. + + * emacs.c (main): Don't check here. + + * xterm.c (x_display_ok): Don't use DISPLAY env var. + 2006-03-20 Stefan Monnier * window.c (window_scroll_pixel_based): Yet another int/Lisp_Object diff --git a/src/dispnew.c b/src/dispnew.c index f6ce8eb43f4..ff7758c7538 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6664,6 +6664,13 @@ init_display () #endif display_arg = (display != 0 && *display != 0); + + if (display_arg && !x_display_ok (display)) + { + fprintf (stderr, "Display %s unavailable, simulating -nw\n", + display); + inhibit_window_system = 1; + } } if (!inhibit_window_system && display_arg diff --git a/src/emacs.c b/src/emacs.c index 62a23f70859..846bfc7e453 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -53,10 +53,6 @@ Boston, MA 02110-1301, USA. */ #include "buffer.h" #include "window.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - #include "systty.h" #include "blockinput.h" #include "syssignal.h" @@ -1486,14 +1482,6 @@ main (argc, argv /* Don't actually discard this arg. */ skip_args = count_before; - - /* Do not be lenient if the user explicitly asked for a named display. */ - if (display_arg == 1 && !x_display_ok (displayname)) - { - fprintf (stderr, "Display %s unavailable, simulating -nw\n", - displayname); - inhibit_window_system = 1; - } } #endif diff --git a/src/xterm.c b/src/xterm.c index 368f9c1a6d3..298b1c2e63d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10123,12 +10123,8 @@ x_display_ok (display) int dpy_ok = 1; Display *dpy; - if (!display) - display = getenv("DISPLAY"); - if (!display) - return 0; - - if ((dpy = XOpenDisplay (display))) + dpy = XOpenDisplay (display); + if (dpy) XCloseDisplay (dpy); else dpy_ok = 0; -- 2.39.2