-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpackage.lisp
79 lines (68 loc) · 2.21 KB
/
package.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#+generate-pure-x11-doc
(mgl-pax:define-package :pure-x11
(:documentation "socket based lisp-only interface to X11. See
PURE-X11:@PURE-X11-MANUAL.")
(:use #:common-lisp #:sb-bsd-sockets #:mgl-pax))
#-generate-pure-x11-doc
(defpackage :pure-x11
(:documentation "socket based lisp-only interface to X11")
(:use #:common-lisp #:sb-bsd-sockets)
(:export #:connect
#:make-window
#:draw-window
#:query-pointer
#:imagetext8
#:put-image-big-req))
(in-package :pure-x11)
#+generate-pure-x11-doc
(defsection @pure-x11-manual (:title "Pure X11 manual")
"This package provides a socket based lisp-only interface to X11. It
started as an experiment but as I added support for XPutImage using
BIG-REQUESTS it now seems more useful to me than CLX.
Connect will send a request to open a connection to the X-Server and
parses its response to obtain the constants *RESOURCE-ID-BASE*,
*RESOURCE-ID-MASK* and *ROOT*. These are stored in dynamic variables
and are later used by other functions, e.g. by MAKE-WINDOW to create
a new window."
(connect function)
(make-window function)
(draw-window function)
(query-pointer function)
(put-image-big-req function)
(parse-initial-reply function)
(read-reply-wait function)
(*s* variable)
(*resource-id-base* variable)
(*resource-id-mask* variable)
(*root* variable)
(*window* variable)
(big-requests-enable function)
(@pure-x11-examples section)
(@pure-x11-internal section))
#+generate-pure-x11-doc
(defsection @pure-x11-examples (:title "Examples")
"Let's see the transcript of a real session of someone working
with PURE-X11:
```common-lisp
(progn ;; open a window and draw a line
(connect)
(make-window)
(draw-window 0 0 100 100))
(query-pointer) ;; ask for current mouse cursor position
;; => 700, 700, 302, -321
;; while a *WINDOW* is open, one can copy image data into it
;; like this:
(let*((w 512)
(h 512)
(c 4)
(a (make-array (list h w c)
:element-type '(unsigned-byte 8))))
(dotimes (j h)
(dotimes (i w)
(setf (aref a j i 0) (mod i 255) ;; b
(aref a j i 1) (mod j 255) ;; g
(aref a j i 2) 255 ;; r
(aref a j i 3) 255))) ;; a
(put-image-big-req a))
```
")