summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-02-21 07:42:01 +0000
committerPo Lu <luangruo@yahoo.com>2022-02-21 07:42:01 +0000
commitfc281e0df3d6f3ea359eae440cdae7e65412c06d (patch)
treecf6ca6c76a31be53752fd27e0c01b82858f69093
parente087c89b1e243bbd941a4a50b4bf99613e13d016 (diff)
downloademacs-fc281e0df3d6f3ea359eae440cdae7e65412c06d.tar.gz
Prevent Haiku display from being opened multiple times
* src/haikufns.c (Fx_open_connection): Return if display connection already exists.
-rw-r--r--src/haikufns.c25
1 files changed, 19 insertions, 6 deletions
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;
}