Commit 28877db5 authored by Alastair Bridgewater's avatar Alastair Bridgewater
Browse files

clx-interface: Use a CLIM PORT to find the X server.

  * Moving towards using more CLIM and less straight X in our test
program, use FIND-PORT to open a CLX connection, and retrieve the
DISPLAY handle from the port.

  * Currently, this just adds another layer of indirection to
setting up our window, but once we have working mirrored sheets
and a CLX-GRAFT class things should simplify a bit.
parent 85b779f6
......@@ -5,8 +5,13 @@
(cl:defpackage :game-stuff/clx-interface
(:use :cl :nq-clim/layout/space-requirement)
(:use :cl
......@@ -22,6 +27,7 @@
;;; Important external variables.
(defvar *port* nil "The CLIM PORT.")
(defvar *display* nil "The X display connection.")
(defvar *window* nil "The X window we draw in.")
......@@ -50,7 +56,10 @@
:height height :min-height min-height :max-height max-height))))
(defun init-display (&key display-name space-requirement window-title)
(setf *display* (xlib:open-default-display display-name))
(setf *port*
(find-port :server-path `(:clx ,@(when display-name
`(:display ,display-name)))))
(setf *display* (clx-port-display *port*))
(let* ((screen (xlib:display-default-screen *display*))
(root (xlib:screen-root screen))
(black-pixel (xlib:screen-black-pixel screen))
......@@ -79,9 +88,10 @@
;; It is sufficient to drop the reference to *window*, as closing
;; the display automatically releases all server resources.
(setf *window* nil)
(when *display*
(xlib:close-display *display*))
(setf *display* nil))
(setf *display* nil)
(when *port*
(destroy-port *port*))
(setf *port* nil))
(defun call-with-x11-display (fun &key display-name space-requirement
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