From: Po Lu Date: Mon, 21 Feb 2022 07:42:01 +0000 (+0000) Subject: Prevent Haiku display from being opened multiple times X-Git-Tag: emacs-29.0.90~2184 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fc281e0df3d6f3ea359eae440cdae7e65412c06d;p=emacs.git Prevent Haiku display from being opened multiple times * src/haikufns.c (Fx_open_connection): Return if display connection already exists. --- diff --git a/src/haikufns.c b/src/haikufns.c index ea42dd0daa6..69f502fb016 100644 --- a/src/haikufns.c +++ b/src/haikufns.c @@ -1844,16 +1844,29 @@ DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, doc: /* SKIP: real doc in xfns.c. */) (Lisp_Object display, Lisp_Object resource_string, Lisp_Object must_succeed) { - struct haiku_display_info *dpy_info; + struct haiku_display_info *dpyinfo; CHECK_STRING (display); if (NILP (Fstring_equal (display, build_string ("be")))) - !NILP (must_succeed) ? fatal ("Bad display") : error ("Bad display"); - dpy_info = haiku_term_init (); + { + if (!NILP (must_succeed)) + fatal ("Bad display"); + else + error ("Bad display"); + } + + if (x_display_list) + return Qnil; + + dpyinfo = haiku_term_init (); - if (!dpy_info) - !NILP (must_succeed) ? fatal ("Display not responding") : - error ("Display not responding"); + if (!dpyinfo) + { + if (!NILP (must_succeed)) + fatal ("Display not responding"); + else + error ("Display not responding"); + } return Qnil; }