Commit 44d7e424 authored by csr21's avatar csr21
Browse files

launchd-darwin-support

From Rudi Schlatte

darcs-hash:20080622175327-df18d-6b38d13bcc9097c675f8123c9a183f181a2ef6d1.gz
parent 4cafe31f
......@@ -553,17 +553,16 @@
;;; OPEN-X-STREAM - create a stream for communicating to the appropriate X
;;; server
(defparameter ccl::*x-server-unix-socket-format-string* "/tmp/.X11-unix/X~d")
(defun open-x-stream (host display protocol)
(declare (ignore protocol))
(if (or (string= host "") (string= host "unix"))
(let ((local-socket-path (unix-socket-path-from-host host display)))
(if local-socket-path
(ccl::make-socket :connect :active
:address-family :file
:remote-filename (format nil ccl::*x-server-unix-socket-format-string* display))
:remote-filename local-socket-path)
(ccl::make-socket :connect :active
:remote-host host
:remote-port (+ 6000 display))))
:remote-port (+ 6000 display)))))
;;; BUFFER-READ-DEFAULT - read data from the X stream
......
......@@ -671,3 +671,23 @@ used, since NIL is the empty list.")
(:return-type :signed-32bit))
(host :simple-string)
(display :signed-32bit))
;;-----------------------------------------------------------------------------
;; Finding the server socket
;;-----------------------------------------------------------------------------
;; These are here because dep-openmcl.lisp and dependent.lisp both need them
(defconstant +X-unix-socket-path+
"/tmp/.X11-unix/X"
"The location of the X socket")
(defun unix-socket-path-from-host (host display)
"Return the name of the unix domain socket for host and display, or
nil if a network socket should be opened."
(cond ((or (string= host "") (string= host "unix"))
(format nil "~A~D" +X-unix-socket-path+ display))
#+darwin
((and (> (length host) 10) (string= host "tmp/launch" :end1 10))
(format nil "/~A:~D" host display))
(t nil)))
......@@ -1541,19 +1541,15 @@
(cdr (host-address host)))
:foreign-port (+ *x-tcp-port* display)))
#+(or sbcl ecl)
(defconstant +X-unix-socket-path+
"/tmp/.X11-unix/X"
"The location of the X socket")
#+sbcl
(defun open-x-stream (host display protocol)
(declare (ignore protocol)
(type (integer 0) display))
(let ((local-socket-path (unix-socket-path-from-host host display)))
(socket-make-stream
(if (or (string= host "") (string= host "unix")) ; AF_LOCAL domain socket
(if local-socket-path
(let ((s (make-instance 'local-socket :type :stream)))
(socket-connect s (format nil "~A~D" +X-unix-socket-path+ display))
(socket-connect s local-socket-path)
s)
(let ((host (car (host-ent-addresses (get-host-by-name host)))))
(when host
......@@ -1561,7 +1557,7 @@
(socket-connect s host (+ 6000 display))
s))))
:element-type '(unsigned-byte 8)
:input t :output t :buffering :none))
:input t :output t :buffering :none)))
#+ecl
(defun open-x-stream (host display protocol)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment