PageRenderTime 62ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/modules/clx/mit-clx/doc.lisp

https://github.com/ynd/clisp-branch--ynd-devel
Lisp | 3803 lines | 2464 code | 535 blank | 804 comment | 10 complexity | af702102a2421a6c21e08bc7fc721719 MD5 | raw file
Possible License(s): LGPL-2.0, GPL-2.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. ;;; -*- Mode: LISP; Syntax: Common-lisp; Package: XLIB; Base: 10; Lowercase: Yes -*-
  2. ;;; Copyright 1987, 1988 Massachusetts Institute of Technology, and
  3. ;;; Texas Instruments Incorporated
  4. ;;; Permission to use, copy, modify, and distribute this document for any purpose
  5. ;;; and without fee is hereby granted, provided that the above copyright notice
  6. ;;; appear in all copies and that both that copyright notice and this permission
  7. ;;; notice are retained, and that the name of M.I.T. not be used in advertising or
  8. ;;; publicity pertaining to this document without specific, written prior
  9. ;;; permission. M.I.T. makes no representations about the suitability of this
  10. ;;; document or the protocol defined in this document for any purpose. It is
  11. ;;; provided "as is" without express or implied warranty.
  12. ;;; Texas Instruments Incorporated provides this document "as is" without
  13. ;;; express or implied warranty.
  14. ;; Version 4
  15. ;; This is considered a somewhat changeable interface. Discussion of better
  16. ;; integration with CLOS, support for user-specified subclassess of basic
  17. ;; objects, and the additional functionality to match the C Xlib is still in
  18. ;; progress.
  19. ;; Primary Interface Author:
  20. ;; Robert W. Scheifler
  21. ;; MIT Laboratory for Computer Science
  22. ;; 545 Technology Square, Room 418
  23. ;; Cambridge, MA 02139
  24. ;; rws@zermatt.lcs.mit.edu
  25. ;; Design Contributors:
  26. ;; Dan Cerys, Texas Instruments
  27. ;; Scott Fahlman, CMU
  28. ;; Charles Hornig, Symbolics
  29. ;; John Irwin, Franz
  30. ;; Kerry Kimbrough, Texas Instruments
  31. ;; Chris Lindblad, MIT
  32. ;; Rob MacLachlan, CMU
  33. ;; Mike McMahon, Symbolics
  34. ;; David Moon, Symbolics
  35. ;; LaMott Oren, Texas Instruments
  36. ;; Daniel Weinreb, Symbolics
  37. ;; John Wroclawski, MIT
  38. ;; Richard Zippel, Symbolics
  39. ;; CLX Extensions
  40. ;; Adds some of the functionality provided by the C XLIB library.
  41. ;;
  42. ;; Primary Author
  43. ;; LaMott G. Oren
  44. ;; Texas Instruments
  45. ;;
  46. ;; Design Contributors:
  47. ;; Robert W. Scheifler, MIT
  48. ;; Note: all of the following is in the package XLIB.
  49. (declaim (declaration arglist clx-values))
  50. ;; Note: if you have read the Version 11 protocol document or C Xlib manual, most of
  51. ;; the relationships should be fairly obvious. We have no intention of writing yet
  52. ;; another moby document for this interface.
  53. (deftype card32 () '(unsigned-byte 32))
  54. (deftype card29 () '(unsigned-byte 29))
  55. (deftype int32 () '(signed-byte 32))
  56. (deftype card16 () '(unsigned-byte 16))
  57. (deftype int16 () '(signed-byte 16))
  58. (deftype card8 () '(unsigned-byte 8))
  59. (deftype int8 () '(signed-byte 8))
  60. (deftype mask32 () 'card32)
  61. (deftype mask16 () 'card16)
  62. (deftype resource-id () 'card29)
  63. ;; Types employed: display, window, pixmap, cursor, font, gcontext, colormap, color.
  64. ;; These types are defined solely by a functional interface; we do not specify
  65. ;; whether they are implemented as structures or flavors or ... Although functions
  66. ;; below are written using DEFUN, this is not an implementation requirement (although
  67. ;; it is a requirement that they be functions as opposed to macros or special forms).
  68. ;; It is unclear whether with-slots in the Common Lisp Object System must work on
  69. ;; them.
  70. ;; Windows, pixmaps, cursors, fonts, gcontexts, and colormaps are all represented as
  71. ;; compound objects, rather than as integer resource-ids. This allows applications
  72. ;; to deal with multiple displays without having an explicit display argument in the
  73. ;; most common functions. Every function uses the display object indicated by the
  74. ;; first argument that is or contains a display; it is an error if arguments contain
  75. ;; different displays, and predictable results are not guaranteed.
  76. ;; Each of window, pixmap, drawable, cursor, font, gcontext, and colormap have the
  77. ;; following five functions:
  78. (defun <mumble>-display (<mumble>)
  79. (declare (type <mumble> <mumble>)
  80. (clx-values display)))
  81. (defun <mumble>-id (<mumble>)
  82. (declare (type <mumble> <mumble>)
  83. (clx-values resource-id)))
  84. (defun <mumble>-equal (<mumble>-1 <mumble>-2)
  85. (declare (type <mumble> <mumble>-1 <mumble>-2)))
  86. (defun <mumble>-p (<mumble>)
  87. (declare (type <mumble> <mumble>)
  88. (clx-values boolean)))
  89. ;; The following functions are provided by color objects:
  90. ;; The intention is that IHS and YIQ and CYM interfaces will also exist. Note that
  91. ;; we are explicitly using a different spectrum representation than what is actually
  92. ;; transmitted in the protocol.
  93. (deftype rgb-val () '(real 0 1))
  94. (defun make-color (&key red green blue &allow-other-keys) ; for expansion
  95. (declare (type rgb-val red green blue)
  96. (clx-values color)))
  97. (defun color-rgb (color)
  98. (declare (type color color)
  99. (clx-values red green blue)))
  100. (defun color-red (color)
  101. ;; setf'able
  102. (declare (type color color)
  103. (clx-values rgb-val)))
  104. (defun color-green (color)
  105. ;; setf'able
  106. (declare (type color color)
  107. (clx-values rgb-val)))
  108. (defun color-blue (color)
  109. ;; setf'able
  110. (declare (type color color)
  111. (clx-values rgb-val)))
  112. (deftype drawable () '(or window pixmap))
  113. ;; Atoms are accepted as strings or symbols, and are always returned as keywords.
  114. ;; Protocol-level integer atom ids are hidden, using a cache in the display object.
  115. (deftype xatom () '(or string symbol))
  116. (deftype stringable () '(or string symbol))
  117. (deftype fontable () '(or stringable font))
  118. ;; Nil stands for CurrentTime.
  119. (deftype timestamp () '(or null card32))
  120. (deftype bit-gravity () '(member :forget :static :north-west :north :north-east
  121. :west :center :east :south-west :south :south-east))
  122. (deftype win-gravity () '(member :unmap :static :north-west :north :north-east
  123. :west :center :east :south-west :south :south-east))
  124. (deftype grab-status ()
  125. '(member :success :already-grabbed :frozen :invalid-time :not-viewable))
  126. (deftype boolean () '(or null (not null)))
  127. (deftype pixel () '(unsigned-byte 32))
  128. (deftype image-depth () '(integer 0 32))
  129. (deftype keysym () 'card32)
  130. (deftype array-index () `(integer 0 ,array-dimension-limit))
  131. ;; An association list.
  132. (deftype alist (key-type-and-name datum-type-and-name) 'list)
  133. (deftype clx-list (&optional element-type) 'list)
  134. (deftype clx-sequence (&optional element-type) 'sequence)
  135. ;; A sequence, containing zero or more repetitions of the given elements,
  136. ;; with the elements expressed as (type name).
  137. (deftype repeat-seq (&rest elts) 'sequence)
  138. (deftype point-seq () '(repeat-seq (int16 x) (int16 y)))
  139. (deftype seg-seq () '(repeat-seq (int16 x1) (int16 y1) (int16 x2) (int16 y2)))
  140. (deftype rect-seq () '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height)))
  141. ;; Note that we are explicitly using a different angle representation than what
  142. ;; is actually transmitted in the protocol.
  143. (deftype angle () '(real #.(* -2 pi) #.(* 2 pi)))
  144. (deftype arc-seq () '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height)
  145. (angle angle1) (angle angle2)))
  146. (deftype event-mask-class ()
  147. '(member :key-press :key-release :owner-grab-button :button-press :button-release
  148. :enter-window :leave-window :pointer-motion :pointer-motion-hint
  149. :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  150. :button-5-motion :button-motion :exposure :visibility-change
  151. :structure-notify :resize-redirect :substructure-notify :substructure-redirect
  152. :focus-change :property-change :colormap-change :keymap-state))
  153. (deftype event-mask ()
  154. '(or mask32 (clx-list event-mask-class)))
  155. (deftype pointer-event-mask-class ()
  156. '(member :button-press :button-release
  157. :enter-window :leave-window :pointer-motion :pointer-motion-hint
  158. :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  159. :button-5-motion :button-motion :keymap-state))
  160. (deftype pointer-event-mask ()
  161. '(or mask32 (clx-list pointer-event-mask-class)))
  162. (deftype device-event-mask-class ()
  163. '(member :key-press :key-release :button-press :button-release :pointer-motion
  164. :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  165. :button-5-motion :button-motion))
  166. (deftype device-event-mask ()
  167. '(or mask32 (clx-list device-event-mask-class)))
  168. (deftype modifier-key ()
  169. '(member :shift :lock :control :mod-1 :mod-2 :mod-3 :mod-4 :mod-5))
  170. (deftype modifier-mask ()
  171. '(or (member :any) mask16 (clx-list modifier-key)))
  172. (deftype state-mask-key ()
  173. '(or modifier-key (member :button-1 :button-2 :button-3 :button-4 :button-5)))
  174. (deftype gcontext-key ()
  175. '(member :function :plane-mask :foreground :background
  176. :line-width :line-style :cap-style :join-style :fill-style :fill-rule
  177. :arc-mode :tile :stipple :ts-x :ts-y :font :subwindow-mode
  178. :exposures :clip-x :clip-y :clip-mask :dash-offset :dashes))
  179. (deftype event-key ()
  180. '(member :key-press :key-release :button-press :button-release :motion-notify
  181. :enter-notify :leave-notify :focus-in :focus-out :keymap-notify
  182. :exposure :graphics-exposure :no-exposure :visibility-notify
  183. :create-notify :destroy-notify :unmap-notify :map-notify :map-request
  184. :reparent-notify :configure-notify :gravity-notify :resize-request
  185. :configure-request :circulate-notify :circulate-request :property-notify
  186. :selection-clear :selection-request :selection-notify
  187. :colormap-notify :client-message))
  188. (deftype error-key ()
  189. '(member :access :alloc :atom :colormap :cursor :drawable :font :gcontext :id-choice
  190. :illegal-request :implementation :length :match :name :pixmap :value :window))
  191. (deftype draw-direction ()
  192. '(member :left-to-right :right-to-left))
  193. (defstruct bitmap-format
  194. (unit <unspec> :type (member 8 16 32))
  195. (pad <unspec> :type (member 8 16 32))
  196. (lsb-first-p <unspec> :type boolean))
  197. (defstruct pixmap-format
  198. (depth <unspec> :type image-depth)
  199. (bits-per-pixel <unspec> :type (member 1 4 8 16 24 32))
  200. (pad <unspec> :type (member 8 16 32)))
  201. (defstruct visual-info
  202. (id <unspec> :type resource-id)
  203. (display <unspec> :type display)
  204. (class <unspec> :type (member :static-gray :static-color :true-color
  205. :gray-scale :pseudo-color :direct-color))
  206. (red-mask <unspec> :type pixel)
  207. (green-mask <unspec> :type pixel)
  208. (blue-mask <unspec> :type pixel)
  209. (bits-per-rgb <unspec> :type card8)
  210. (colormap-entries <unspec> :type card16))
  211. (defstruct screen
  212. (root <unspec> :type window)
  213. (width <unspec> :type card16)
  214. (height <unspec> :type card16)
  215. (width-in-millimeters <unspec> :type card16)
  216. (height-in-millimeters <unspec> :type card16)
  217. (depths <unspec> :type (alist (image-depth depth) ((clx-list visual-info) visuals)))
  218. (root-depth <unspec> :type image-depth)
  219. (root-visual-info <unspec> :type visual-info)
  220. (default-colormap <unspec> :type colormap)
  221. (white-pixel <unspec> :type pixel)
  222. (black-pixel <unspec> :type pixel)
  223. (min-installed-maps <unspec> :type card16)
  224. (max-installed-maps <unspec> :type card16)
  225. (backing-stores <unspec> :type (member :never :when-mapped :always))
  226. (save-unders-p <unspec> :type boolean)
  227. (event-mask-at-open <unspec> :type mask32))
  228. (defun screen-root-visual (screen)
  229. (declare (type screen screen)
  230. (clx-values resource-id)))
  231. ;; The list contains alternating keywords and integers.
  232. (deftype font-props () 'list)
  233. (defun open-display (host &key (display 0) protocol)
  234. ;; A string must be acceptable as a host, but otherwise the possible types for host
  235. ;; and protocol are not constrained, and will likely be very system dependent. The
  236. ;; default protocol is system specific. Authorization, if any, is assumed to come
  237. ;; from the environment somehow.
  238. (declare (type integer display)
  239. (clx-values display)))
  240. (defun display-protocol-major-version (display)
  241. (declare (type display display)
  242. (clx-values card16)))
  243. (defun display-protocol-minor-version (display)
  244. (declare (type display display)
  245. (clx-values card16)))
  246. (defun display-vendor-name (display)
  247. (declare (type display display)
  248. (clx-values string)))
  249. (defun display-release-number (display)
  250. (declare (type display display)
  251. (clx-values card32)))
  252. (defun display-image-lsb-first-p (display)
  253. (declare (type display display)
  254. (clx-values boolean)))
  255. (defun display-bitmap-formap (display)
  256. (declare (type display display)
  257. (clx-values bitmap-format)))
  258. (defun display-pixmap-formats (display)
  259. (declare (type display display)
  260. (clx-values (clx-list pixmap-formats))))
  261. (defun display-roots (display)
  262. (declare (type display display)
  263. (clx-values (clx-list screen))))
  264. (defun display-motion-buffer-size (display)
  265. (declare (type display display)
  266. (clx-values card32)))
  267. (defun display-max-request-length (display)
  268. (declare (type display display)
  269. (clx-values card16)))
  270. (defun display-min-keycode (display)
  271. (declare (type display display)
  272. (clx-values card8)))
  273. (defun display-max-keycode (display)
  274. (declare (type display display)
  275. (clx-values card8)))
  276. (defun close-display (display)
  277. (declare (type display display)))
  278. (defun display-error-handler (display)
  279. (declare (type display display)
  280. (clx-values handler)))
  281. (defsetf display-error-handler (display) (handler)
  282. ;; All errors (synchronous and asynchronous) are processed by calling an error
  283. ;; handler in the display. If handler is a sequence it is expected to contain
  284. ;; handler functions specific to each error; the error code is used to index the
  285. ;; sequence, fetching the appropriate handler. Any results returned by the handler
  286. ;; are ignored; it is assumed the handler either takes care of the error
  287. ;; completely, or else signals. For all core errors, the keyword/value argument
  288. ;; pairs are:
  289. ;; :major card8
  290. ;; :minor card16
  291. ;; :sequence card16
  292. ;; :current-sequence card16
  293. ;; :asynchronous (member t nil)
  294. ;; For :colormap, :cursor, :drawable, :font, :gcontext, :id-choice, :pixmap, and
  295. ;; :window errors another pair is:
  296. ;; :resource-id card32
  297. ;; For :atom errors, another pair is:
  298. ;; :atom-id card32
  299. ;; For :value errors, another pair is:
  300. ;; :value card32
  301. (declare (type display display)
  302. (type (or (clx-sequence (function (display symbol &key &allow-other-keys)))
  303. (function (display symbol &key &allow-other-keys)))
  304. handler)))
  305. (defsetf display-report-asynchronous-errors (display) (when)
  306. ;; Most useful in multi-process lisps.
  307. ;;
  308. ;; Synchronous errors are always signalled in the process that made the
  309. ;; synchronous request. An error is considered synchronous if a process is
  310. ;; waiting for a reply with the same request-id as the error.
  311. ;;
  312. ;; Asynchronous errors can be signalled at any one of these three times:
  313. ;;
  314. ;; 1. As soon as they are read. They get signalled in whichever process
  315. ;; was doing the reading. This is enabled by
  316. ;; (setf (xlib:display-report-asynchronous-errors display)
  317. ;; '(:immediately))
  318. ;; This is the default.
  319. ;;
  320. ;; 2. Before any events are to be handled. You get these by doing an
  321. ;; event-listen with any timeout value other than 0, or in of the event
  322. ;; processing forms. This is useful if you using a background process to
  323. ;; handle input. This is enabled by
  324. ;; (setf (xlib:display-report-asynchronous-errors display)
  325. ;; '(:before-event-handling))
  326. ;;
  327. ;; 3. After a display-finish-output. You get these by doing a
  328. ;; display-finish-output. A cliche using this might have a with-display
  329. ;; wrapped around the display operations that possibly cause an asynchronous
  330. ;; error, with a display-finish-output right the end of the with-display to
  331. ;; catch any asynchronous errors. This is enabled by
  332. ;; (setf (xlib:display-report-asynchronous-errors display)
  333. ;; '(:after-finish-output))
  334. ;;
  335. ;; You can select any combination of the three keywords. For example, to
  336. ;; get errors reported before event handling and after finish-output,
  337. ;; (setf (xlib:display-report-asynchronous-errors display)
  338. ;; '(:before-event-handling :after-finish-output))
  339. (declare (type list when))
  340. )
  341. (defmacro define-condition (name base &body items)
  342. ;; just a place-holder here for the real thing
  343. )
  344. (define-condition request-error error
  345. display
  346. major
  347. minor
  348. sequence
  349. current-sequence
  350. asynchronous)
  351. (defun default-error-handler (display error-key &key &allow-other-keys)
  352. ;; The default display-error-handler.
  353. ;; It signals the conditions listed below.
  354. (declare (type display display)
  355. (type symbol error-key))
  356. )
  357. (define-condition resource-error request-error
  358. resource-id)
  359. (define-condition access-error request-error)
  360. (define-condition alloc-error request-error)
  361. (define-condition atom-error request-error
  362. atom-id)
  363. (define-condition colormap-error resource-error)
  364. (define-condition cursor-error resource-error)
  365. (define-condition drawable-error resource-error)
  366. (define-condition font-error resource-error)
  367. (define-condition gcontext-error resource-error)
  368. (define-condition id-choice-error resource-error)
  369. (define-condition illegal-request-error request-error)
  370. (define-condition implementation-error request-error)
  371. (define-condition length-error request-error)
  372. (define-condition match-error request-error)
  373. (define-condition name-error request-error)
  374. (define-condition pixmap-error resource-error)
  375. (define-condition value-error request-error
  376. value)
  377. (define-condition window-error resource-error)
  378. (defmacro with-display ((display) &body body)
  379. ;; This macro is for use in a multi-process environment. It provides exclusive
  380. ;; access to the local display object for multiple request generation. It need not
  381. ;; provide immediate exclusive access for replies; that is, if another process is
  382. ;; waiting for a reply (while not in a with-display), then synchronization need not
  383. ;; (but can) occur immediately. Except where noted, all routines effectively
  384. ;; contain an implicit with-display where needed, so that correct synchronization
  385. ;; is always provided at the interface level on a per-call basis. Nested uses of
  386. ;; this macro will work correctly. This macro does not prevent concurrent event
  387. ;; processing; see with-event-queue.
  388. )
  389. (defun display-force-output (display)
  390. ;; Output is normally buffered; this forces any buffered output.
  391. (declare (type display display)))
  392. (defun display-finish-output (display)
  393. ;; Forces output, then causes a round-trip to ensure that all possible errors and
  394. ;; events have been received.
  395. (declare (type display display)))
  396. (defun display-after-function (display)
  397. ;; setf'able
  398. ;; If defined, called after every protocol request is generated, even those inside
  399. ;; explicit with-display's, but never called from inside the after-function itself.
  400. ;; The function is called inside the effective with-display for the associated
  401. ;; request. Default value is nil. Can be set, for example, to
  402. ;; #'display-force-output or #'display-finish-output.
  403. (declare (type display display)
  404. (clx-values (or null (function (display))))))
  405. (defun create-window (&key parent x y width height (depth 0) (border-width 0)
  406. (class :copy) (visual :copy)
  407. background border gravity bit-gravity
  408. backing-store backing-planes backing-pixel save-under
  409. event-mask do-not-propagate-mask override-redirect
  410. colormap cursor)
  411. ;; Display is obtained from parent. Only non-nil attributes are passed on in the
  412. ;; request: the function makes no assumptions about what the actual protocol
  413. ;; defaults are. Width and height are the inside size, excluding border.
  414. (declare (type window parent)
  415. (type int16 x y)
  416. (type card16 width height depth border-width)
  417. (type (member :copy :input-output :input-only) class)
  418. (type (or (member :copy) visual-info) visual)
  419. (type (or null (member :none :parent-relative) pixel pixmap) background)
  420. (type (or null (member :copy) pixel pixmap) border)
  421. (type (or null win-gravity) gravity)
  422. (type (or null bit-gravity) bit-gravity)
  423. (type (or null (member :not-useful :when-mapped :always) backing-store))
  424. (type (or null pixel) backing-planes backing-pixel)
  425. (type (or null event-mask) event-mask)
  426. (type (or null device-event-mask) do-not-propagate-mask)
  427. (type (or null (member :on :off)) save-under override-redirect)
  428. (type (or null (member :copy) colormap) colormap)
  429. (type (or null (member :none) cursor) cursor)
  430. (clx-values window)))
  431. (defun window-class (window)
  432. (declare (type window window)
  433. (clx-values (member :input-output :input-only))))
  434. (defun window-visual-info (window)
  435. (declare (type window window)
  436. (clx-values visual-info)))
  437. (defun window-visual (window)
  438. (declare (type window window)
  439. (clx-values resource-id)))
  440. (defsetf window-background (window) (background)
  441. (declare (type window window)
  442. (type (or (member :none :parent-relative) pixel pixmap) background)))
  443. (defsetf window-border (window) (border)
  444. (declare (type window window)
  445. (type (or (member :copy) pixel pixmap) border)))
  446. (defun window-gravity (window)
  447. ;; setf'able
  448. (declare (type window window)
  449. (clx-values win-gravity)))
  450. (defun window-bit-gravity (window)
  451. ;; setf'able
  452. (declare (type window window)
  453. (clx-values bit-gravity)))
  454. (defun window-backing-store (window)
  455. ;; setf'able
  456. (declare (type window window)
  457. (clx-values (member :not-useful :when-mapped :always))))
  458. (defun window-backing-planes (window)
  459. ;; setf'able
  460. (declare (type window window)
  461. (clx-values pixel)))
  462. (defun window-backing-pixel (window)
  463. ;; setf'able
  464. (declare (type window window)
  465. (clx-values pixel)))
  466. (defun window-save-under (window)
  467. ;; setf'able
  468. (declare (type window window)
  469. (clx-values (member :on :off))))
  470. (defun window-event-mask (window)
  471. ;; setf'able
  472. (declare (type window window)
  473. (clx-values mask32)))
  474. (defun window-do-not-propagate-mask (window)
  475. ;; setf'able
  476. (declare (type window window)
  477. (clx-values mask32)))
  478. (defun window-override-redirect (window)
  479. ;; setf'able
  480. (declare (type window window)
  481. (clx-values (member :on :off))))
  482. (defun window-colormap (window)
  483. (declare (type window window)
  484. (clx-values (or null colormap))))
  485. (defsetf window-colormap (window) (colormap)
  486. (declare (type window window)
  487. (type (or (member :copy) colormap) colormap)))
  488. (defsetf window-cursor (window) (cursor)
  489. (declare (type window window)
  490. (type (or (member :none) cursor) cursor)))
  491. (defun window-colormap-installed-p (window)
  492. (declare (type window window)
  493. (clx-values boolean)))
  494. (defun window-all-event-masks (window)
  495. (declare (type window window)
  496. (clx-values mask32)))
  497. (defun window-map-state (window)
  498. (declare (type window window)
  499. (clx-values (member :unmapped :unviewable :viewable))))
  500. (defsetf drawable-x (window) (x)
  501. (declare (type window window)
  502. (type int16 x)))
  503. (defsetf drawable-y (window) (y)
  504. (declare (type window window)
  505. (type int16 y)))
  506. (defsetf drawable-width (window) (width)
  507. ;; Inside width, excluding border.
  508. (declare (type window window)
  509. (type card16 width)))
  510. (defsetf drawable-height (window) (height)
  511. ;; Inside height, excluding border.
  512. (declare (type window window)
  513. (type card16 height)))
  514. (defsetf drawable-border-width (window) (border-width)
  515. (declare (type window window)
  516. (type card16 border-width)))
  517. (defsetf window-priority (window &optional sibling) (mode)
  518. ;; A bit strange, but retains setf form.
  519. (declare (type window window)
  520. (type (or null window) sibling)
  521. (type (member :above :below :top-if :bottom-if :opposite) mode)))
  522. (defmacro with-state ((drawable) &body body)
  523. ;; Allows a consistent view to be obtained of data returned by GetWindowAttributes
  524. ;; and GetGeometry, and allows a coherent update using ChangeWindowAttributes and
  525. ;; ConfigureWindow. The body is not surrounded by a with-display. Within the
  526. ;; indefinite scope of the body, on a per-process basis in a multi-process
  527. ;; environment, the first call within an Accessor Group on the specified drawable
  528. ;; (the object, not just the variable) causes the complete results of the protocol
  529. ;; request to be retained, and returned in any subsequent accessor calls. Calls
  530. ;; within a Setf Group are delayed, and executed in a single request on exit from
  531. ;; the body. In addition, if a call on a function within an Accessor Group follows
  532. ;; a call on a function in the corresponding Setf Group, then all delayed setfs for
  533. ;; that group are executed, any retained accessor information for that group is
  534. ;; discarded, the corresponding protocol request is (re)issued, and the results are
  535. ;; (again) retained, and returned in any subsequent accessor calls.
  536. ;; Accessor Group A (for GetWindowAttributes):
  537. ;; window-visual-info, window-visual, window-class, window-gravity, window-bit-gravity,
  538. ;; window-backing-store, window-backing-planes, window-backing-pixel,
  539. ;; window-save-under, window-colormap, window-colormap-installed-p,
  540. ;; window-map-state, window-all-event-masks, window-event-mask,
  541. ;; window-do-not-propagate-mask, window-override-redirect
  542. ;; Setf Group A (for ChangeWindowAttributes):
  543. ;; window-gravity, window-bit-gravity, window-backing-store, window-backing-planes,
  544. ;; window-backing-pixel, window-save-under, window-event-mask,
  545. ;; window-do-not-propagate-mask, window-override-redirect, window-colormap,
  546. ;; window-cursor
  547. ;; Accessor Group G (for GetGeometry):
  548. ;; drawable-root, drawable-depth, drawable-x, drawable-y, drawable-width,
  549. ;; drawable-height, drawable-border-width
  550. ;; Setf Group G (for ConfigureWindow):
  551. ;; drawable-x, drawable-y, drawable-width, drawable-height, drawable-border-width,
  552. ;; window-priority
  553. )
  554. (defun destroy-window (window)
  555. (declare (type window window)))
  556. (defun destroy-subwindows (window)
  557. (declare (type window window)))
  558. (defun add-to-save-set (window)
  559. (declare (type window window)))
  560. (defun remove-from-save-set (window)
  561. (declare (type window window)))
  562. (defun reparent-window (window parent x y)
  563. (declare (type window window parent)
  564. (type int16 x y)))
  565. (defun map-window (window)
  566. (declare (type window window)))
  567. (defun map-subwindows (window)
  568. (declare (type window window)))
  569. (defun unmap-window (window)
  570. (declare (type window window)))
  571. (defun unmap-subwindows (window)
  572. (declare (type window window)))
  573. (defun circulate-window-up (window)
  574. (declare (type window window)))
  575. (defun circulate-window-down (window)
  576. (declare (type window window)))
  577. (defun drawable-root (drawable)
  578. (declare (type drawable drawable)
  579. (clx-values window)))
  580. (defun drawable-depth (drawable)
  581. (declare (type drawable drawable)
  582. (clx-values card8)))
  583. (defun drawable-x (drawable)
  584. (declare (type drawable drawable)
  585. (clx-values int16)))
  586. (defun drawable-y (drawable)
  587. (declare (type drawable drawable)
  588. (clx-values int16)))
  589. (defun drawable-width (drawable)
  590. ;; For windows, inside width, excluding border.
  591. (declare (type drawable drawable)
  592. (clx-values card16)))
  593. (defun drawable-height (drawable)
  594. ;; For windows, inside height, excluding border.
  595. (declare (type drawable drawable)
  596. (clx-values card16)))
  597. (defun drawable-border-width (drawable)
  598. (declare (type drawable drawable)
  599. (clx-values card16)))
  600. (defun query-tree (window &key (result-type 'list))
  601. (declare (type window window)
  602. (type type result-type)
  603. (clx-values (clx-sequence window) parent root)))
  604. (defun change-property (window property data type format
  605. &key (mode :replace) (start 0) end transform)
  606. ;; Start and end affect sub-sequence extracted from data.
  607. ;; Transform is applied to each extracted element.
  608. (declare (type window window)
  609. (type xatom property type)
  610. (type (member 8 16 32) format)
  611. (type sequence data)
  612. (type (member :replace :prepend :append) mode)
  613. (type array-index start)
  614. (type (or null array-index) end)
  615. (type (or null (function (t) integer)) transform)))
  616. (defun delete-property (window property)
  617. (declare (type window window)
  618. (type xatom property)))
  619. (defun get-property (window property
  620. &key type (start 0) end delete-p (result-type 'list) transform)
  621. ;; Transform is applied to each integer retrieved.
  622. ;; Nil is returned for type when the protocol returns None.
  623. (declare (type window window)
  624. (type xatom property)
  625. (type (or null xatom) type)
  626. (type array-index start)
  627. (type (or null array-index) end)
  628. (type boolean delete-p)
  629. (type type result-type)
  630. (type (or null (function (integer) t)) transform)
  631. (clx-values data type format bytes-after)))
  632. (defun rotate-properties (window properties &optional (delta 1))
  633. ;; Postive rotates left, negative rotates right (opposite of actual protocol request).
  634. (declare (type window window)
  635. (type (clx-sequence xatom) properties)
  636. (type int16 delta)))
  637. (defun list-properties (window &key (result-type 'list))
  638. (declare (type window window)
  639. (type type result-type)
  640. (clx-values (clx-sequence keyword))))
  641. ;; Although atom-ids are not visible in the normal user interface, atom-ids might
  642. ;; appear in window properties and other user data, so conversion hooks are needed.
  643. (defun intern-atom (display name)
  644. (declare (type display display)
  645. (type xatom name)
  646. (clx-values resource-id)))
  647. (defun find-atom (display name)
  648. (declare (type display display)
  649. (type xatom name)
  650. (clx-values (or null resource-id))))
  651. (defun atom-name (display atom-id)
  652. (declare (type display display)
  653. (type resource-id atom-id)
  654. (clx-values keyword)))
  655. (defun selection-owner (display selection)
  656. (declare (type display display)
  657. (type xatom selection)
  658. (clx-values (or null window))))
  659. (defsetf selection-owner (display selection &optional time) (owner)
  660. ;; A bit strange, but retains setf form.
  661. (declare (type display display)
  662. (type xatom selection)
  663. (type (or null window) owner)
  664. (type timestamp time)))
  665. (defun convert-selection (selection type requestor &optional property time)
  666. (declare (type xatom selection type)
  667. (type window requestor)
  668. (type (or null xatom) property)
  669. (type timestamp time)))
  670. (defun send-event (window event-key event-mask &rest args
  671. &key propagate-p display &allow-other-keys)
  672. ;; Additional arguments depend on event-key, and are as specified further below
  673. ;; with declare-event, except that both resource-ids and resource objects are
  674. ;; accepted in the event components. The display argument is only required if the
  675. ;; window is :pointer-window or :input-focus. If an argument has synonyms, it is
  676. ;; only necessary to supply a value for one of them; it is an error to specify
  677. ;; different values for synonyms.
  678. (declare (type (or window (member :pointer-window :input-focus)) window)
  679. (type (or null event-key) event-key)
  680. (type event-mask event-mask)
  681. (type boolean propagate-p)
  682. (type (or null display) display)))
  683. (defun grab-pointer (window event-mask
  684. &key owner-p sync-pointer-p sync-keyboard-p confine-to cursor time)
  685. (declare (type window window)
  686. (type pointer-event-mask event-mask)
  687. (type boolean owner-p sync-pointer-p sync-keyboard-p)
  688. (type (or null window) confine-to)
  689. (type (or null cursor) cursor)
  690. (type timestamp time)
  691. (clx-values grab-status)))
  692. (defun ungrab-pointer (display &key time)
  693. (declare (type display display)
  694. (type timestamp time)))
  695. (defun grab-button (window button event-mask
  696. &key (modifiers 0)
  697. owner-p sync-pointer-p sync-keyboard-p confine-to cursor)
  698. (declare (type window window)
  699. (type (or (member :any) card8) button)
  700. (type modifier-mask modifiers)
  701. (type pointer-event-mask event-mask)
  702. (type boolean owner-p sync-pointer-p sync-keyboard-p)
  703. (type (or null window) confine-to)
  704. (type (or null cursor) cursor)))
  705. (defun ungrab-button (window button &key (modifiers 0))
  706. (declare (type window window)
  707. (type (or (member :any) card8) button)
  708. (type modifier-mask modifiers)))
  709. (defun change-active-pointer-grab (display event-mask &optional cursor time)
  710. (declare (type display display)
  711. (type pointer-event-mask event-mask)
  712. (type (or null cursor) cursor)
  713. (type timestamp time)))
  714. (defun grab-keyboard (window &key owner-p sync-pointer-p sync-keyboard-p time)
  715. (declare (type window window)
  716. (type boolean owner-p sync-pointer-p sync-keyboard-p)
  717. (type timestamp time)
  718. (clx-values grab-status)))
  719. (defun ungrab-keyboard (display &key time)
  720. (declare (type display display)
  721. (type timestamp time)))
  722. (defun grab-key (window key &key (modifiers 0) owner-p sync-pointer-p sync-keyboard-p)
  723. (declare (type window window)
  724. (type boolean owner-p sync-pointer-p sync-keyboard-p)
  725. (type (or (member :any) card8) key)
  726. (type modifier-mask modifiers)))
  727. (defun ungrab-key (window key &key (modifiers 0))
  728. (declare (type window window)
  729. (type (or (member :any) card8) key)
  730. (type modifier-mask modifiers)))
  731. (defun allow-events (display mode &optional time)
  732. (declare (type display display)
  733. (type (member :async-pointer :sync-pointer :reply-pointer
  734. :async-keyboard :sync-keyboard :replay-keyboard
  735. :async-both :sync-both)
  736. mode)
  737. (type timestamp time)))
  738. (defun grab-server (display)
  739. (declare (type display display)))
  740. (defun ungrab-server (display)
  741. (declare (type display display)))
  742. (defmacro with-server-grabbed ((display) &body body)
  743. ;; The body is not surrounded by a with-display.
  744. )
  745. (defun query-pointer (window)
  746. (declare (type window window)
  747. (clx-values x y same-screen-p child mask root-x root-y root)))
  748. (defun pointer-position (window)
  749. (declare (type window window)
  750. (clx-values x y same-screen-p)))
  751. (defun global-pointer-position (display)
  752. (declare (type display display)
  753. (clx-values root-x root-y root)))
  754. (defun motion-events (window &key start stop (result-type 'list))
  755. (declare (type window window)
  756. (type timestamp start stop)
  757. (type type result-type)
  758. (clx-values (repeat-seq (int16 x) (int16 y) (timestamp time)))))
  759. (defun translate-coordinates (src src-x src-y dst)
  760. ;; If src and dst are not on the same screen, nil is returned.
  761. (declare (type window src)
  762. (type int16 src-x src-y)
  763. (type window dst)
  764. (clx-values dst-x dst-y child)))
  765. (defun warp-pointer (dst dst-x dst-y)
  766. (declare (type window dst)
  767. (type int16 dst-x dst-y)))
  768. (defun warp-pointer-relative (display x-off y-off)
  769. (declare (type display display)
  770. (type int16 x-off y-off)))
  771. (defun warp-pointer-if-inside (dst dst-x dst-y src src-x src-y
  772. &optional src-width src-height)
  773. ;; Passing in a zero src-width or src-height is a no-op. A null src-width or
  774. ;; src-height translates into a zero value in the protocol request.
  775. (declare (type window dst src)
  776. (type int16 dst-x dst-y src-x src-y)
  777. (type (or null card16) src-width src-height)))
  778. (defun warp-pointer-relative-if-inside (x-off y-off src src-x src-y
  779. &optional src-width src-height)
  780. ;; Passing in a zero src-width or src-height is a no-op. A null src-width or
  781. ;; src-height translates into a zero value in the protocol request.
  782. (declare (type window src)
  783. (type int16 x-off y-off src-x src-y)
  784. (type (or null card16) src-width src-height)))
  785. (defun set-input-focus (display focus revert-to &optional time)
  786. ;; Setf ought to allow multiple values.
  787. (declare (type display display)
  788. (type (or (member :none :pointer-root) window) focus)
  789. (type (member :none :parent :pointer-root) revert-to)
  790. (type timestamp time)))
  791. (defun input-focus (display)
  792. (declare (type display display)
  793. (clx-values focus revert-to)))
  794. (defun query-keymap (display)
  795. (declare (type display display)
  796. (clx-values (bit-vector 256))))
  797. (defun open-font (display name)
  798. ;; Font objects may be cached and reference counted locally within the display
  799. ;; object. This function might not execute a with-display if the font is cached.
  800. ;; The protocol QueryFont request happens on-demand under the covers.
  801. (declare (type display display)
  802. (type stringable name)
  803. (clx-values font)))
  804. ;; We probably want a per-font bit to indicate whether caching on
  805. ;; text-extents/width calls is desirable. But what to name it?
  806. (defun discard-font-info (font)
  807. ;; Discards any state that can be re-obtained with QueryFont. This is simply
  808. ;; a performance hint for memory-limited systems.
  809. (declare (type font font)))
  810. ;; This can be signalled anywhere a pseudo font access fails.
  811. (define-condition invalid-font error
  812. font)
  813. ;; Note: font-font-info removed.
  814. (defun font-name (font)
  815. ;; Returns nil for a pseudo font returned by gcontext-font.
  816. (declare (type font font)
  817. (clx-values (or null string))))
  818. (defun font-direction (font)
  819. (declare (type font font)
  820. (clx-values draw-direction)))
  821. (defun font-min-char (font)
  822. (declare (type font font)
  823. (clx-values card16)))
  824. (defun font-max-char (font)
  825. (declare (type font font)
  826. (clx-values card16)))
  827. (defun font-min-byte1 (font)
  828. (declare (type font font)
  829. (clx-values card8)))
  830. (defun font-max-byte1 (font)
  831. (declare (type font font)
  832. (clx-values card8)))
  833. (defun font-min-byte2 (font)
  834. (declare (type font font)
  835. (clx-values card8)))
  836. (defun font-max-byte2 (font)
  837. (declare (type font font)
  838. (clx-values card8)))
  839. (defun font-all-chars-exist-p (font)
  840. (declare (type font font)
  841. (clx-values boolean)))
  842. (defun font-default-char (font)
  843. (declare (type font font)
  844. (clx-values card16)))
  845. (defun font-ascent (font)
  846. (declare (type font font)
  847. (clx-values int16)))
  848. (defun font-descent (font)
  849. (declare (type font font)
  850. (clx-values int16)))
  851. ;; The list contains alternating keywords and int32s.
  852. (deftype font-props () 'list)
  853. (defun font-properties (font)
  854. (declare (type font font)
  855. (clx-values font-props)))
  856. (defun font-property (font name)
  857. (declare (type font font)
  858. (type keyword name)
  859. (clx-values (or null int32))))
  860. ;; For each of left-bearing, right-bearing, width, ascent, descent, attributes:
  861. (defun char-<metric> (font index)
  862. ;; Note: I have tentatively chosen to return nil for an out-of-bounds index
  863. ;; (or an in-bounds index on a pseudo font), although returning zero or
  864. ;; signalling might be better.
  865. (declare (type font font)
  866. (type card16 index)
  867. (clx-values (or null int16))))
  868. (defun max-char-<metric> (font)
  869. ;; Note: I have tentatively chosen separate accessors over allowing :min and
  870. ;; :max as an index above.
  871. (declare (type font font)
  872. (clx-values int16)))
  873. (defun min-char-<metric> (font)
  874. (declare (type font font)
  875. (clx-values int16)))
  876. ;; Note: char16-<metric> accessors could be defined to accept two-byte indexes.
  877. (defun close-font (font)
  878. ;; This might not generate a protocol request if the font is reference
  879. ;; counted locally or if it is a pseudo font.
  880. (declare (type font font)))
  881. (defun list-font-names (display pattern &key (max-fonts 65535) (result-type 'list))
  882. (declare (type display display)
  883. (type string pattern)
  884. (type card16 max-fonts)
  885. (type type result-type)
  886. (clx-values (clx-sequence string))))
  887. (defun list-fonts (display pattern &key (max-fonts 65535) (result-type 'list))
  888. ;; Returns "pseudo" fonts that contain basic font metrics and properties, but
  889. ;; no per-character metrics and no resource-ids. These pseudo fonts will be
  890. ;; converted (internally) to real fonts dynamically as needed, by issuing an
  891. ;; OpenFont request. However, the OpenFont might fail, in which case the
  892. ;; invalid-font error can arise.
  893. (declare (type display display)
  894. (type string pattern)
  895. (type card16 max-fonts)
  896. (type type result-type)
  897. (clx-values (clx-sequence font))))
  898. (defun font-path (display &key (result-type 'list))
  899. (declare (type display display)
  900. (type type result-type)
  901. (clx-values (clx-sequence (or string pathname)))))
  902. (defsetf font-path (display) (paths)
  903. (declare (type display display)
  904. (type (clx-sequence (or string pathname)) paths)))
  905. (defun create-pixmap (&key width height depth drawable)
  906. (declare (type card16 width height)
  907. (type card8 depth)
  908. (type drawable drawable)
  909. (clx-values pixmap)))
  910. (defun free-pixmap (pixmap)
  911. (declare (type pixmap pixmap)))
  912. (defun create-gcontext (&key drawable function plane-mask foreground background
  913. line-width line-style cap-style join-style fill-style fill-rule
  914. arc-mode tile stipple ts-x ts-y font subwindow-mode
  915. exposures clip-x clip-y clip-mask clip-ordering
  916. dash-offset dashes
  917. (cache-p t))
  918. ;; Only non-nil components are passed on in the request, but for effective caching
  919. ;; assumptions have to be made about what the actual protocol defaults are. For
  920. ;; all gcontext components, a value of nil causes the default gcontext value to be
  921. ;; used. For clip-mask, this implies that an empty rect-seq cannot be represented
  922. ;; as a list. Note: use of stringable as font will cause an implicit open-font.
  923. ;; Note: papers over protocol SetClipRectangles and SetDashes special cases. If
  924. ;; cache-p is true, then gcontext state is cached locally, and changing a gcontext
  925. ;; component will have no effect unless the new value differs from the cached
  926. ;; value. Component changes (setfs and with-gcontext) are always deferred
  927. ;; regardless of the cache mode, and sent over the protocol only when required by a
  928. ;; local operation or by an explicit call to force-gcontext-changes.
  929. (declare (type drawable drawable)
  930. (type (or null boole-constant) function)
  931. (type (or null pixel) plane-mask foreground background)
  932. (type (or null card16) line-width dash-offset)
  933. (type (or null int16) ts-x ts-y clip-x clip-y)
  934. (type (or null (member :solid :dash :double-dash)) line-style)
  935. (type (or null (member :not-last :butt :round :projecting)) cap-style)
  936. (type (or null (member :miter :round :bevel)) join-style)
  937. (type (or null (member :solid :tiled :opaque-stippled :stippled)) fill-style)
  938. (type (or null (member :even-odd :winding)) fill-rule)
  939. (type (or null (member :chord :pie-slice)) arc-mode)
  940. (type (or null pixmap) tile stipple)
  941. (type (or null fontable) font)
  942. (type (or null (member :clip-by-children :include-inferiors)) subwindow-mode)
  943. (type (or null (member :on :off)) exposures)
  944. (type (or null (member :none) pixmap rect-seq) clip-mask)
  945. (type (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)) clip-ordering)
  946. (type (or null (or card8 (clx-sequence card8))) dashes)
  947. (type boolean cache)
  948. (clx-values gcontext)))
  949. ;; For each argument to create-gcontext (except font, clip-mask and
  950. ;; clip-ordering) declared as (type <type> <name>), there is an accessor:
  951. (defun gcontext-<name> (gcontext)
  952. ;; The value will be nil if the last value stored is unknown (e.g., the cache was
  953. ;; off, or the component was copied from a gcontext with unknown state).
  954. (declare (type gcontext gcontext)
  955. (clx-values <type>)))
  956. ;; For each argument to create-gcontext (except clip-mask and clip-ordering) declared
  957. ;; as (type (or null <type>) <name>), there is a setf for the corresponding accessor:
  958. (defsetf gcontext-<name> (gcontext) (value)
  959. (declare (type gcontext gcontext)
  960. (type <type> value)))
  961. (defun gcontext-font (gcontext &optional metrics-p)
  962. ;; If the stored font is known, it is returned. If it is not known and
  963. ;; metrics-p is false, then nil is returned. If it is not known and
  964. ;; metrics-p is true, then a pseudo font is returned. Full metric and
  965. ;; property information can be obtained, but the font does not have a name or
  966. ;; a resource-id, and attempts to use it where a resource-id is required will
  967. ;; result in an invalid-font error.
  968. (declare (type gcontext gcontext)
  969. (type boolean metrics-p)
  970. (clx-values (or null font))))
  971. (defun gcontext-clip-mask (gcontext)
  972. (declare (type gcontext gcontext)
  973. (clx-values (or null (member :none) pixmap rect-seq)
  974. (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)))))
  975. (defsetf gcontext-clip-mask (gcontext &optional ordering) (clip-mask)
  976. ;; Is nil illegal here, or is it transformed to a vector?
  977. ;; A bit strange, but retains setf form.
  978. (declare (type gcontext gcontext)
  979. (type (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)) clip-ordering)
  980. (type (or (member :none) pixmap rect-seq) clip-mask)))
  981. (defun force-gcontext-changes (gcontext)
  982. ;; Force any delayed changes.
  983. (declare (type gcontext gcontext)))
  984. (defmacro with-gcontext ((gcontext &key
  985. function plane-mask foreground background
  986. line-width line-style cap-style join-style fill-style fill-rule
  987. arc-mode tile stipple ts-x ts-y font subwindow-mode
  988. exposures clip-x clip-y clip-mask clip-ordering
  989. dashes dash-offset)
  990. &body body)
  991. ;; Changes gcontext components within the dynamic scope of the body (i.e.,
  992. ;; indefinite scope and dynamic extent), on a per-process basis in a multi-process
  993. ;; environment. The values are all evaluated before bindings are performed. The
  994. ;; body is not surrounded by a with-display. If cache-p is nil or the some
  995. ;; component states are unknown, this will implement save/restore by creating a
  996. ;; temporary gcontext and doing gcontext-components to and from it.
  997. )
  998. (defun copy-gcontext-components (src dst &rest keys)
  999. (declare (type gcontext src dst)
  1000. (type (clx-list gcontext-key) keys)))
  1001. (defun copy-gcontext (src dst)
  1002. (declare (type gcontext src dst))
  1003. ;; Copies all components.
  1004. )
  1005. (defun free-gcontext (gcontext)
  1006. (declare (type gcontext gcontext)))
  1007. (defun clear-area (window &key (x 0) (y 0) width height exposures-p)
  1008. ;; Passing in a zero width or height is a no-op. A null width or height translates
  1009. ;; into a zero value in the protocol request.
  1010. (declare (type window window)
  1011. (type int16 x y)
  1012. (type (or null card16) width height)
  1013. (type boolean exposures-p)))
  1014. (defun copy-area (src gcontext src-x src-y width height dst dst-x dst-y)
  1015. (declare (type drawable src dst)
  1016. (type gcontext gcontext)
  1017. (type int16 src-x src-y dst-x dst-y)
  1018. (type card16 width height)))
  1019. (defun copy-plane (src gcontext plane src-x src-y width height dst dst-x dst-y)
  1020. (declare (type drawable src dst)
  1021. (type gcontext gcontext)
  1022. (type pixel plane)
  1023. (type int16 src-x src-y dst-x dst-y)
  1024. (type card16 width height)))
  1025. (defun draw-point (drawable gcontext x y)
  1026. ;; Should be clever about appending to existing buffered protocol request, provided
  1027. ;; gcontext has not been modified.
  1028. (declare (type drawable drawable)
  1029. (type gcontext gcontext)
  1030. (type int16 x y)))
  1031. (defun draw-points (drawable gcontext points &optional relative-p)
  1032. (declare (type drawable drawable)
  1033. (type gcontext gcontext)
  1034. (type point-seq points)
  1035. (type boolean relative-p)))
  1036. (defun draw-line (drawable gcontext x1 y1 x2 y2 &optional relative-p)
  1037. ;; Should be clever about appending to existing buffered protocol request, provided
  1038. ;; gcontext has not been modified.
  1039. (declare (type drawable drawable)
  1040. (type gcontext gcontext)
  1041. (type int16 x1 y1 x2 y2)
  1042. (type boolean relative-p)))
  1043. (defun draw-lines (drawable gcontext points &key relative-p fill-p (shape :complex))
  1044. (declare (type drawable drawable)
  1045. (type gcontext gcontext)
  1046. (type point-seq points)
  1047. (type boolean relative-p fill-p)
  1048. (type (member :complex :non-convex :convex) shape)))
  1049. (defun draw-segments (drawable gcontext segments)
  1050. (declare (type drawable drawable)
  1051. (type gcontext gcontext)
  1052. (type seg-seq segments)))
  1053. (defun draw-rectangle (drawable gcontext x y width height &optional fill-p)
  1054. ;; Should be clever about appending to existing buffered protocol request, provided
  1055. ;; gcontext has not been modified.
  1056. (declare (type drawable drawable)
  1057. (type gcontext gcontext)
  1058. (type int16 x y)
  1059. (type card16 width height)
  1060. (type boolean fill-p)))
  1061. (defun draw-rectangles (drawable gcontext rectangles &optional fill-p)
  1062. (declare (type drawable drawable)
  1063. (type gcontext gcontext)
  1064. (type rect-seq rectangles)
  1065. (type boolean fill-p)))
  1066. (defun draw-arc (drawable gcontext x y width height angle1 angle2 &optional fill-p)
  1067. ;; Should be clever about appending to existing buffered protocol request, provided
  1068. ;; gcontext has not been modified.
  1069. (declare (type drawable drawable)
  1070. (type gcontext gcontext)
  1071. (type int16 x y)
  1072. (type card16 width height)
  1073. (type angle angle1 angle2)
  1074. (type boolean fill-p)))
  1075. (defun draw-arcs (drawable gcontext arcs &optional fill-p)
  1076. (declare (type drawable drawable)
  1077. (type gcontext gcontext)
  1078. (type arc-seq arcs)
  1079. (type boolean fill-p)))
  1080. ;; The following image routines are bare minimum. It may be useful to define some
  1081. ;; form of "image" object to hide representation details and format conversions. It
  1082. ;; also may be useful to provide stream-oriented interfaces for reading and writing
  1083. ;; the data.
  1084. (defun put-raw-image (drawable gcontext data
  1085. &key (start 0) depth x y width height (left-pad 0) format)
  1086. ;; Data must be a sequence of 8-bit quantities, already in the appropriate format
  1087. ;; for transmission; the caller is responsible for all byte and bit swapping and
  1088. ;; compaction. Start is the starting index in data; the end is computed from the
  1089. ;; other arguments.
  1090. (declare (type drawable drawable)
  1091. (type gcontext gcontext)
  1092. (type (clx-sequence card8) data)
  1093. (type array-index start)
  1094. (type card8 depth left-pad)
  1095. (type int16 x y)
  1096. (type card16 width height)
  1097. (type (member :bitmap :xy-pixmap :z-pixmap) format)))
  1098. (defun get-raw-image (drawable &key data (start 0) x y width height
  1099. (plane-mask 0xffffffff) format
  1100. (result-type '(vector (unsigned-byte 8))))
  1101. ;; If data is given, it is modified in place (and returned), otherwise a new
  1102. ;; sequence is created and returned, with a size computed from the other arguments
  1103. ;; and the returned depth. The sequence is filled with 8-bit quantities, in
  1104. ;; transmission format; the caller is responsible for any byte and bit swapping and
  1105. ;; compaction required for further local use.
  1106. (declare (type drawable drawable)
  1107. (type (or null (clx-sequence card8)) data)
  1108. (t…

Large files files are truncated, but you can click here to view the full file