]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent Haiku display from being opened multiple times
authorPo Lu <luangruo@yahoo.com>
Mon, 21 Feb 2022 07:42:01 +0000 (07:42 +0000)
committerPo Lu <luangruo@yahoo.com>
Mon, 21 Feb 2022 07:42:01 +0000 (07:42 +0000)
* src/haikufns.c (Fx_open_connection): Return if display
connection already exists.

src/haikufns.c

index ea42dd0daa6b62795f0ef4ccb1e1bf84ceb7b6ff..69f502fb016a0d5a4099a2b7bfafb3183a77c831 100644 (file)
@@ -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;
 }