PageRenderTime 34ms CodeModel.GetById 24ms RepoModel.GetById 1ms 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
  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. (type array-index start)
  1109. (type int16 x y)
  1110. (type card16 width height)
  1111. (type pixel plane-mask)
  1112. (type (member :xy-pixmap :z-pixmap) format)
  1113. (clx-values (clx-sequence card8) depth visual-info)))
  1114. (defun translate-default (src src-start src-end font dst dst-start)
  1115. ;; dst is guaranteed to have room for (- src-end src-start) integer elements,
  1116. ;; starting at dst-start; whether dst holds 8-bit or 16-bit elements depends
  1117. ;; on context. font is the current font, if known. The function should
  1118. ;; translate as many elements of src as possible into indexes in the current
  1119. ;; font, and store them into dst. The first return value should be the src
  1120. ;; index of the first untranslated element. If no further elements need to
  1121. ;; be translated, the second return value should be nil. If a horizontal
  1122. ;; motion is required before further translation, the second return value
  1123. ;; should be the delta in x coordinate. If a font change is required for
  1124. ;; further translation, the second return value should be the new font. If
  1125. ;; known, the pixel width of the translated text can be returned as the third
  1126. ;; value; this can allow for appending of subsequent output to the same
  1127. ;; protocol request, if no overall width has been specified at the higher
  1128. ;; level.
  1129. (declare (type sequence src)
  1130. (type array-index src-start src-end dst-start)
  1131. (type (or null font) font)
  1132. (type vector dst)
  1133. (clx-values array-index (or null int16 font) (or null int32))))
  1134. ;; There is a question below of whether translate should always be required, or
  1135. ;; if not, what the default should be or where it should come from. For
  1136. ;; example, the default could be something that expected a string as src and
  1137. ;; translated the CL standard character set to ASCII indexes, and ignored fonts
  1138. ;; and bits. Or the default could expect a string but otherwise be "system
  1139. ;; dependent". Or the default could be something that expected a vector of
  1140. ;; integers and did no translation. Or the default could come from the
  1141. ;; gcontext (but what about text-extents and text-width?).
  1142. (defun text-extents (font sequence &key (start 0) end translate)
  1143. ;; If multiple fonts are involved, font-ascent and font-descent will be the
  1144. ;; maximums. If multiple directions are involved, the direction will be nil.
  1145. ;; Translate will always be called with a 16-bit dst buffer.
  1146. (declare (type sequence sequence)
  1147. (type (or font gcontext) font)
  1148. (type translate translate)
  1149. (clx-values width ascent descent left right font-ascent font-descent direction
  1150. (or null array-index))))
  1151. (defun text-width (font sequence &key (start 0) end translate)
  1152. ;; Translate will always be called with a 16-bit dst buffer.
  1153. (declare (type sequence sequence)
  1154. (type (or font gcontext) font)
  1155. (type translate translate)
  1156. (clx-values int32 (or null array-index))))
  1157. ;; This controls the element size of the dst buffer given to translate. If
  1158. ;; :default is specified, the size will be based on the current font, if known,
  1159. ;; and otherwise 16 will be used. [An alternative would be to pass the buffer
  1160. ;; size to translate, and allow it to return the desired size if it doesn't
  1161. ;; like the current size. The problem is that the protocol doesn't allow
  1162. ;; switching within a single request, so to allow switching would require
  1163. ;; knowing the width of text, which isn't necessarily known. We could call
  1164. ;; text-width to compute it, but perhaps that is doing too many favors?] [An
  1165. ;; additional possibility is to allow an index-size of :two-byte, in which case
  1166. ;; translate would be given a double-length 8-bit array, and translate would be
  1167. ;; expected to store first-byte/second-byte instead of 16-bit integers.]
  1168. (deftype index-size () '(member :default 8 16))
  1169. ;; In the glyph functions below, if width is specified, it is assumed to be the
  1170. ;; total pixel width of whatever string of glyphs is actually drawn.
  1171. ;; Specifying width will allow for appending the output of subsequent calls to
  1172. ;; the same protocol request, provided gcontext has not been modified in the
  1173. ;; interim. If width is not specified, appending of subsequent output might
  1174. ;; not occur (unless translate returns the width). Specifying width is simply
  1175. ;; a hint, for performance.
  1176. (defun draw-glyph (drawable gcontext x y elt
  1177. &key translate width (size :default))
  1178. ;; Returns true if elt is output, nil if translate refuses to output it.
  1179. ;; Second result is width, if known.
  1180. (declare (type drawable drawable)
  1181. (type gcontext gcontext)
  1182. (type int16 x y)
  1183. (type translate translate)
  1184. (type (or null int32) width)
  1185. (type index-size size)
  1186. (clx-values boolean (or null int32))))
  1187. (defun draw-glyphs (drawable gcontext x y sequence
  1188. &key (start 0) end translate width (size :default))
  1189. ;; First result is new start, if end was not reached. Second result is
  1190. ;; overall width, if known.
  1191. (declare (type drawable drawable)
  1192. (type gcontext gcontext)
  1193. (type int16 x y)
  1194. (type sequence sequence)
  1195. (type array-index start)
  1196. (type (or null array-index) end)
  1197. (type (or null int32) width)
  1198. (type translate translate)
  1199. (type index-size size)
  1200. (clx-values (or null array-index) (or null int32))))
  1201. (defun draw-image-glyph (drawable gcontext x y elt
  1202. &key translate width (size :default))
  1203. ;; Returns true if elt is output, nil if translate refuses to output it.
  1204. ;; Second result is overall width, if known. An initial font change is
  1205. ;; allowed from translate.
  1206. (declare (type drawable drawable)
  1207. (type gcontext gcontext)
  1208. (type int16 x y)
  1209. (type translate translate)
  1210. (type (or null int32) width)
  1211. (type index-size size)
  1212. (clx-values boolean (or null int32))))
  1213. (defun draw-image-glyphs (drawable gcontext x y sequence
  1214. &key (start 0) end width translate (size :default))
  1215. ;; An initial font change is allowed from translate, but any subsequent font
  1216. ;; change or horizontal motion will cause termination (because the protocol
  1217. ;; doesn't support chaining). [Alternatively, font changes could be accepted
  1218. ;; as long as they are accompanied with a width return value, or always
  1219. ;; accept font changes and call text-width as required. However, horizontal
  1220. ;; motion can't really be accepted, due to semantics.] First result is new
  1221. ;; start, if end was not reached. Second result is overall width, if known.
  1222. (declare (type drawable drawable)
  1223. (type gcontext gcontext)
  1224. (type int16 x y)
  1225. (type sequence sequence)
  1226. (type array-index start)
  1227. (type (or null array-index) end)
  1228. (type (or null int32) width)
  1229. (type translate translate)
  1230. (type index-size size)
  1231. (clx-values (or null array-index) (or null int32))))
  1232. (defun create-colormap (visual window &optional alloc-p)
  1233. (declare (type visual-info visual)
  1234. (type window window)
  1235. (type boolean alloc-p)
  1236. (clx-values colormap)))
  1237. (defun free-colormap (colormap)
  1238. (declare (type colormap colormap)))
  1239. (defun copy-colormap-and-free (colormap)
  1240. (declare (type colormap colormap)
  1241. (clx-values colormap)))
  1242. (defun install-colormap (colormap)
  1243. (declare (type colormap colormap)))
  1244. (defun uninstall-colormap (colormap)
  1245. (declare (type colormap colormap)))
  1246. (defun installed-colormaps (window &key (result-type 'list))
  1247. (declare (type window window)
  1248. (type type result-type)
  1249. (clx-values (clx-sequence colormap))))
  1250. (defun alloc-color (colormap color)
  1251. (declare (type colormap colormap)
  1252. (type (or stringable color) color)
  1253. (clx-values pixel screen-color exact-color)))
  1254. (defun alloc-color-cells (colormap colors &key (planes 0) contiguous-p (result-type 'list))
  1255. (declare (type colormap colormap)
  1256. (type card16 colors planes)
  1257. (type boolean contiguous-p)
  1258. (type type result-type)
  1259. (clx-values (clx-sequence pixel) (clx-sequence mask))))
  1260. (defun alloc-color-planes (colormap colors
  1261. &key (reds 0) (greens 0) (blues 0)
  1262. contiguous-p (result-type 'list))
  1263. (declare (type colormap colormap)
  1264. (type card16 colors reds greens blues)
  1265. (type boolean contiguous-p)
  1266. (type type result-type)
  1267. (clx-values (clx-sequence pixel) red-mask green-mask blue-mask)))
  1268. (defun free-colors (colormap pixels &optional (plane-mask 0))
  1269. (declare (type colormap colormap)
  1270. (type (clx-sequence pixel) pixels)
  1271. (type pixel plane-mask)))
  1272. (defun store-color (colormap pixel spec &key (red-p t) (green-p t) (blue-p t))
  1273. (declare (type colormap colormap)
  1274. (type pixel pixel)
  1275. (type (or stringable color) spec)
  1276. (type boolean red-p green-p blue-p)))
  1277. (defun store-colors (colormap specs &key (red-p t) (green-p t) (blue-p t))
  1278. ;; If stringables are specified for colors, it is unspecified whether all
  1279. ;; stringables are first resolved and then a single StoreColors protocol request is
  1280. ;; issued, or whether multiple StoreColors protocol requests are issued.
  1281. (declare (type colormap colormap)
  1282. (type (repeat-seq (pixel pixel) ((or stringable color) color)) specs)
  1283. (type boolean red-p green-p blue-p)))
  1284. (defun query-colors (colormap pixels &key (result-type 'list))
  1285. (declare (type colormap colormap)
  1286. (type (clx-sequence pixel) pixels)
  1287. (type type result-type)
  1288. (clx-values (clx-sequence color))))
  1289. (defun lookup-color (colormap name)
  1290. (declare (type colormap colormap)
  1291. (type stringable name)
  1292. (clx-values screen-color true-color)))
  1293. (defun create-cursor (&key source mask x y foreground background)
  1294. (declare (type pixmap source)
  1295. (type (or null pixmap) mask)
  1296. (type card16 x y)
  1297. (type color foreground background)
  1298. (clx-values cursor)))
  1299. (defun create-glyph-cursor (&key source-font source-char mask-font mask-char
  1300. foreground background)
  1301. (declare (type font source-font)
  1302. (type card16 source-char)
  1303. (type (or null font) mask-font)
  1304. (type (or null card16) mask-char)
  1305. (type color foreground background)
  1306. (clx-values cursor)))
  1307. (defun free-cursor (cursor)
  1308. (declare (type cursor cursor)))
  1309. (defun recolor-cursor (cursor foreground background)
  1310. (declare (type cursor cursor)
  1311. (type color foreground background)))
  1312. (defun query-best-cursor (width height drawable)
  1313. (declare (type card16 width height)
  1314. (type drawable display)
  1315. (clx-values width height)))
  1316. (defun query-best-tile (width height drawable)
  1317. (declare (type card16 width height)
  1318. (type drawable drawable)
  1319. (clx-values width height)))
  1320. (defun query-best-stipple (width height drawable)
  1321. (declare (type card16 width height)
  1322. (type drawable drawable)
  1323. (clx-values width height)))
  1324. (defun query-extension (display name)
  1325. (declare (type display display)
  1326. (type stringable name)
  1327. (clx-values major-opcode first-event first-error)))
  1328. (defun list-extensions (display &key (result-type 'list))
  1329. (declare (type display display)
  1330. (type type result-type)
  1331. (clx-values (clx-sequence string))))
  1332. ;; Should pointer-mapping setf be changed to set-pointer-mapping?
  1333. (defun set-modifier-mapping (display &key shift lock control mod1 mod2 mod3 mod4 mod5)
  1334. ;; Can signal device-busy.
  1335. ;; Setf ought to allow multiple values.
  1336. ;; Returns true for success, nil for failure
  1337. (declare (type display display)
  1338. (type (clx-sequence card8) shift lock control mod1 mod2 mod3 mod4 mod5)
  1339. (clx-values (member :success :busy :failed))))
  1340. (defun modifier-mapping (display)
  1341. ;; each value is a list of card8s
  1342. (declare (type display display)
  1343. (clx-values shift lock control mod1 mod2 mod3 mod4 mod5)))
  1344. ;; Either we will want lots of defconstants for well-known values, or perhaps
  1345. ;; an integer-to-keyword translation function for well-known values.
  1346. (defun change-keyboard-mapping (display keysyms
  1347. &key (start 0) end (first-keycode start))
  1348. ;; start/end give subrange of keysyms
  1349. ;; first-keycode is the first-keycode to store at
  1350. (declare (type display display)
  1351. (type (array * (* *)) keysyms)
  1352. (type array-index start)
  1353. (type (or null array-index) end)
  1354. (type card8 first-keycode)))
  1355. (defun keyboard-mapping (display &key first-keycode start end data)
  1356. ;; First-keycode specifies which keycode to start at (defaults to
  1357. ;; min-keycode). Start specifies where (in result) to put first-keycode
  1358. ;; (defaults to first-keycode). (- end start) is the number of keycodes to
  1359. ;; get (end defaults to (1+ max-keycode)). If data is specified, the results
  1360. ;; are put there.
  1361. (declare (type display display)
  1362. (type (or null card8) first-keycode)
  1363. (type (or null array-index) start end)
  1364. (type (or null (array * (* *))) data)
  1365. (clx-values (array * (* *)))))
  1366. (defun change-keyboard-control (display &key key-click-percent
  1367. bell-percent bell-pitch bell-duration
  1368. led led-mode key auto-repeat-mode)
  1369. (declare (type display display)
  1370. (type (or null (member :default) int16) key-click-percent
  1371. bell-percent bell-pitch bell-duration)
  1372. (type (or null card8) led key)
  1373. (type (or null (member :on :off)) led-mode)
  1374. (type (or null (member :on :off :default)) auto-repeat-mode)))
  1375. (defun keyboard-control (display)
  1376. (declare (type display display)
  1377. (clx-values key-click-percent bell-percent bell-pitch bell-duration
  1378. led-mask global-auto-repeat auto-repeats)))
  1379. (defun bell (display &optional (percent-from-normal 0))
  1380. ;; It is assumed that an eventual audio extension to X will provide more complete
  1381. ;; control.
  1382. (declare (type display display)
  1383. (type int8 percent-from-normal)))
  1384. (defun pointer-mapping (display &key (result-type 'list))
  1385. (declare (type display display)
  1386. (type type result-type)
  1387. (clx-values (clx-sequence card8))))
  1388. (defsetf pointer-mapping (display) (map)
  1389. ;; Can signal device-busy.
  1390. (declare (type display display)
  1391. (type (clx-sequence card8) map)))
  1392. (defun change-pointer-control (display &key acceleration threshold)
  1393. ;; Acceleration is rationalized if necessary.
  1394. (declare (type display display)
  1395. (type (or null (member :default) number) acceleration)
  1396. (type (or null (member :default) integer) threshold)))
  1397. (defun pointer-control (display)
  1398. (declare (type display display)
  1399. (clx-values acceleration threshold)))
  1400. (defun set-screen-saver (display timeout interval blanking exposures)
  1401. ;; Setf ought to allow multiple values.
  1402. ;; Timeout and interval are in seconds, will be rounded to minutes.
  1403. (declare (type display display)
  1404. (type (or (member :default) int16) timeout interval)
  1405. (type (member :on :off :default) blanking exposures)))
  1406. (defun screen-saver (display)
  1407. ;; Returns timeout and interval in seconds.
  1408. (declare (type display display)
  1409. (clx-values timeout interval blanking exposures)))
  1410. (defun activate-screen-saver (display)
  1411. (declare (type display display)))
  1412. (defun reset-screen-saver (display)
  1413. (declare (type display display)))
  1414. (defun add-access-host (display host)
  1415. ;; A string must be acceptable as a host, but otherwise the possible types for host
  1416. ;; are not constrained, and will likely be very system dependent.
  1417. (declare (type display display)))
  1418. (defun remove-access-host (display host)
  1419. ;; A string must be acceptable as a host, but otherwise the possible types for host
  1420. ;; are not constrained, and will likely be very system dependent.
  1421. (declare (type display display)))
  1422. (defun access-hosts (display &key (result-type 'list))
  1423. ;; The type of host objects returned is not constrained, except that the hosts must
  1424. ;; be acceptable to add-access-host and remove-access-host.
  1425. (declare (type display display)
  1426. (type type result-type)
  1427. (clx-values (clx-sequence host) enabled-p)))
  1428. (defun access-control (display)
  1429. ;; setf'able
  1430. (declare (type display display)
  1431. (clx-values boolean)))
  1432. (defun close-down-mode (display)
  1433. ;; setf'able
  1434. ;; Cached locally in display object.
  1435. (declare (type display display)
  1436. (clx-values (member :destroy :retain-permanent :retain-temporary))))
  1437. (defun kill-client (display resource-id)
  1438. (declare (type display display)
  1439. (type resource-id resource-id)))
  1440. (defun kill-temporary-clients (display)
  1441. (declare (type display display)))
  1442. (defun make-event-mask (&rest keys)
  1443. ;; This is only defined for core events.
  1444. ;; Useful for constructing event-mask, pointer-event-mask, device-event-mask.
  1445. (declare (type (clx-list event-mask-class) keys)
  1446. (clx-values mask32)))
  1447. (defun make-event-keys (event-mask)
  1448. ;; This is only defined for core events.
  1449. (declare (type mask32 event-mask)
  1450. (clx-values (clx-list event-mask-class))))
  1451. (defun make-state-mask (&rest keys)
  1452. ;; Useful for constructing modifier-mask, state-mask.
  1453. (declare (type (clx-list state-mask-key) keys)
  1454. (clx-values mask16)))
  1455. (defun make-state-keys (state-mask)
  1456. (declare (type mask16 mask)
  1457. (clx-values (clx-list state-mask-key))))
  1458. (defmacro with-event-queue ((display) &body body)
  1459. ;; Grants exclusive access to event queue.
  1460. )
  1461. (defun event-listen (display &optional (timeout 0))
  1462. (declare (type display display)
  1463. (type (or null number) timeout)
  1464. (clx-values (or null number) (or null (member :timeout) (not null))))
  1465. ;; Returns the number of events queued locally, if any, else nil. Hangs
  1466. ;; waiting for events, forever if timeout is nil, else for the specified
  1467. ;; number of seconds. The second value returned is :timeout if the
  1468. ;; operation timed out, and some other non-nil value if an EOF has been
  1469. ;; detected.
  1470. )
  1471. (defun process-event (display &key handler timeout peek-p discard-p (force-output-p t))
  1472. ;; If force-output-p is true, first invokes display-force-output. Invokes
  1473. ;; handler on each queued event until handler returns non-nil, and that
  1474. ;; returned object is then returned by process-event. If peek-p is true,
  1475. ;; then the event is not removed from the queue. If discard-p is true, then
  1476. ;; events for which handler returns nil are removed from the queue,
  1477. ;; otherwise they are left in place. Hangs until non-nil is generated for
  1478. ;; some event, or for the specified timeout (in seconds, if given); however,
  1479. ;; it is acceptable for an implementation to wait only once on network data,
  1480. ;; and therefore timeout prematurely. Returns nil on timeout or EOF, with a
  1481. ;; second return value being :timeout for a timeout and some other non-nil
  1482. ;; value for EOF. If handler is a sequence, it is expected to contain
  1483. ;; handler functions specific to each event class; the event code is used to
  1484. ;; index the sequence, fetching the appropriate handler. The arguments to
  1485. ;; the handler are described further below using declare-event. If
  1486. ;; process-event is invoked recursively, the nested invocation begins with
  1487. ;; the event after the one currently being processed.
  1488. (declare (type display display)
  1489. (type (or (clx-sequence (function (&key &allow-other-keys) t))
  1490. (function (&key &allow-other-keys) t))
  1491. handler)
  1492. (type (or null number) timeout)
  1493. (type boolean peek-p)))
  1494. (defun make-event-handlers (&key (type 'array) default)
  1495. (declare (type t type) ;Sequence type specifier
  1496. (type function default)
  1497. (clx-values sequence)) ;Default handler for initial content
  1498. ;; Makes a handler sequence suitable for process-event
  1499. )
  1500. (defun event-handler (handlers event-key)
  1501. (declare (type sequence handlers)
  1502. (type event-key event-key)
  1503. (clx-values function))
  1504. ;; Accessor for a handler sequence
  1505. )
  1506. (defsetf event-handler (handlers event-key) (handler)
  1507. (declare (type sequence handlers)
  1508. (type event-key event-key)
  1509. (type function handler)
  1510. (clx-values function))
  1511. ;; Setf accessor for a handler sequence
  1512. )
  1513. (defmacro event-case ((display &key timeout peek-p discard-p (force-output-p t))
  1514. &body clauses)
  1515. (declare (arglist (display &key timeout peek-p discard-p force-output-p)
  1516. (event-or-events ((&rest args) |...|) &body body) |...|))
  1517. ;; If force-output-p is true, first invokes display-force-output. Executes
  1518. ;; the matching clause for each queued event until a clause returns non-nil,
  1519. ;; and that returned object is then returned by event-case. If peek-p is
  1520. ;; true, then the event is not removed from the queue. If discard-p is
  1521. ;; true, then events for which the clause returns nil are removed from the
  1522. ;; queue, otherwise they are left in place. Hangs until non-nil is
  1523. ;; generated for some event, or for the specified timeout (in seconds, if
  1524. ;; given); however, it is acceptable for an implementation to wait only once
  1525. ;; on network data, and therefore timeout prematurely. Returns nil on
  1526. ;; timeout or EOF with a second return value being :timeout for a timeout
  1527. ;; and some other non-nil value for EOF. In each clause, event-or-events is
  1528. ;; an event-key or a list of event-keys (but they need not be typed as
  1529. ;; keywords) or the symbol t or otherwise (but only in the last clause).
  1530. ;; The keys are not evaluated, and it is an error for the same key to appear
  1531. ;; in more than one clause. Args is the list of event components of
  1532. ;; interest; corresponding values (if any) are bound to variables with these
  1533. ;; names (i.e., the args are variable names, not keywords, the keywords are
  1534. ;; derived from the variable names). An arg can also be a (keyword var)
  1535. ;; form, as for keyword args in a lambda lists. If no t/otherwise clause
  1536. ;; appears, it is equivalent to having one that returns nil. If
  1537. ;; process-event is invoked recursively, the nested invocation begins with
  1538. ;; the event after the one currently being processed.
  1539. )
  1540. (defmacro event-cond ((display &key timeout peek-p discard-p (force-output-p t))
  1541. &body clauses)
  1542. ;; The clauses of event-cond are of the form:
  1543. ;; (event-or-events binding-list test-form . body-forms)
  1544. ;;
  1545. ;; EVENT-OR-EVENTS event-key or a list of event-keys (but they
  1546. ;; need not be typed as keywords) or the symbol t
  1547. ;; or otherwise (but only in the last clause). If
  1548. ;; no t/otherwise clause appears, it is equivalent
  1549. ;; to having one that returns nil. The keys are
  1550. ;; not evaluated, and it is an error for the same
  1551. ;; key to appear in more than one clause.
  1552. ;;
  1553. ;; BINDING-LIST The list of event components of interest.
  1554. ;; corresponding values (if any) are bound to
  1555. ;; variables with these names (i.e., the binding-list
  1556. ;; has variable names, not keywords, the keywords are
  1557. ;; derived from the variable names). An arg can also
  1558. ;; be a (keyword var) form, as for keyword args in a
  1559. ;; lambda list.
  1560. ;;
  1561. ;; The matching TEST-FORM for each queued event is executed until a
  1562. ;; clause's test-form returns non-nil. Then the BODY-FORMS are
  1563. ;; evaluated, returning the (possibly multiple) values of the last
  1564. ;; form from event-cond. If there are no body-forms then, if the
  1565. ;; test-form is non-nil, the value of the test-form is returned as a
  1566. ;; single value.
  1567. ;;
  1568. ;; Options:
  1569. ;; FORCE-OUTPUT-P When true, first invoke display-force-output if no
  1570. ;; input is pending.
  1571. ;;
  1572. ;; PEEK-P When true, then the event is not removed from the queue.
  1573. ;;
  1574. ;; DISCARD-P When true, then events for which the clause returns nil
  1575. ;; are removed from the queue, otherwise they are left in place.
  1576. ;;
  1577. ;; TIMEOUT If NIL, hang until non-nil is generated for some event's
  1578. ;; test-form. Otherwise return NIL after TIMEOUT seconds have
  1579. ;; elapsed. NIL is also returned whenever EOF is read.
  1580. ;; Whenever NIL is returned a second value is returned which
  1581. ;; is either :TIMEOUT if a timeout occurred or some other
  1582. ;; non-NIL value if an EOF is detected.
  1583. ;;
  1584. (declare (arglist (display &key timeout peek-p discard-p force-output-p)
  1585. (event-or-events (&rest args) test-form &body body) |...|))
  1586. )
  1587. (defun discard-current-event (display)
  1588. (declare (type display display)
  1589. (clx-values boolean))
  1590. ;; Discard the current event for DISPLAY.
  1591. ;; Returns NIL when the event queue is empty, else T.
  1592. ;; To ensure events aren't ignored, application code should only call
  1593. ;; this when throwing out of event-case or process-next-event, or from
  1594. ;; inside even-case, event-cond or process-event when :peek-p is T and
  1595. ;; :discard-p is NIL.
  1596. )
  1597. (defmacro declare-event (event-codes &rest declares)
  1598. ;; Used to indicate the keyword arguments for handler functions in process-event
  1599. ;; and event-case. In the declares, an argument listed as (name1 name2) indicates
  1600. ;; synonyms for the same argument. All process-event handlers can have
  1601. ;; (display display), (event-key event-key), and (boolean send-event-p) as keyword
  1602. ;; arguments, and an event-case clause can also have event-key and send-event-p as
  1603. ;; arguments.
  1604. (declare (arglist event-key-or-keys &rest (type &rest keywords))))
  1605. (declare-event (:key-press :key-release :button-press :button-release)
  1606. (card16 sequence)
  1607. (window (window event-window) root)
  1608. ((or null window) child)
  1609. (boolean same-screen-p)
  1610. (int16 x y root-x root-y)
  1611. (card16 state)
  1612. ((or null card32) time)
  1613. ;; for key-press and key-release, code is the keycode
  1614. ;; for button-press and button-release, code is the button number
  1615. (card8 code))
  1616. (declare-event :motion-notify
  1617. (card16 sequence)
  1618. (window (window event-window) root)
  1619. ((or null window) child)
  1620. (boolean same-screen-p)
  1621. (int16 x y root-x root-y)
  1622. (card16 state)
  1623. ((or null card32) time)
  1624. (boolean hint-p))
  1625. (declare-event (:enter-notify :leave-notify)
  1626. (card16 sequence)
  1627. (window (window event-window) root)
  1628. ((or null window) child)
  1629. (boolean same-screen-p)
  1630. (int16 x y root-x root-y)
  1631. (card16 state)
  1632. ((or null card32) time)
  1633. ((member :normal :grab :ungrab) mode)
  1634. ((member :ancestor :virtual :inferior :nonlinear :nonlinear-virtual) kind)
  1635. (boolean focus-p))
  1636. (declare-event (:focus-in :focus-out)
  1637. (card16 sequence)
  1638. (window (window event-window))
  1639. ((member :normal :while-grabbed :grab :ungrab) mode)
  1640. ((member :ancestor :virtual :inferior :nonlinear :nonlinear-virtual
  1641. :pointer :pointer-root :none)
  1642. kind))
  1643. (declare-event :keymap-notify
  1644. ((bit-vector 256) keymap))
  1645. (declare-event :exposure
  1646. (card16 sequence)
  1647. (window (window event-window))
  1648. (card16 x y width height count))
  1649. (declare-event :graphics-exposure
  1650. (card16 sequence)
  1651. (drawable (drawable event-window))
  1652. (card16 x y width height count)
  1653. (card8 major)
  1654. (card16 minor))
  1655. (declare-event :no-exposure
  1656. (card16 sequence)
  1657. (drawable (drawable event-window))
  1658. (card8 major)
  1659. (card16 minor))
  1660. (declare-event :visibility-notify
  1661. (card16 sequence)
  1662. (window (window event-window))
  1663. ((member :unobscured :partially-obscured :fully-obscured) state))
  1664. (declare-event :create-notify
  1665. (card16 sequence)
  1666. (window window (parent event-window))
  1667. (int16 x y)
  1668. (card16 width height border-width)
  1669. (boolean override-redirect-p))
  1670. (declare-event :destroy-notify
  1671. (card16 sequence)
  1672. (window event-window window))
  1673. (declare-event :unmap-notify
  1674. (card16 sequence)
  1675. (window event-window window)
  1676. (boolean configure-p))
  1677. (declare-event :map-notify
  1678. (card16 sequence)
  1679. (window event-window window)
  1680. (boolean override-redirect-p))
  1681. (declare-event :map-request
  1682. (card16 sequence)
  1683. (window (parent event-window) window))
  1684. (declare-event :reparent-notify
  1685. (card16 sequence)
  1686. (window event-window window parent)
  1687. (int16 x y)
  1688. (boolean override-redirect-p))
  1689. (declare-event :configure-notify
  1690. (card16 sequence)
  1691. (window event-window window)
  1692. (int16 x y)
  1693. (card16 width height border-width)
  1694. ((or null window) above-sibling)
  1695. (boolean override-redirect-p))
  1696. (declare-event :gravity-notify
  1697. (card16 sequence)
  1698. (window event-window window)
  1699. (int16 x y))
  1700. (declare-event :resize-request
  1701. (card16 sequence)
  1702. (window (window event-window))
  1703. (card16 width height))
  1704. (declare-event :configure-request
  1705. (card16 sequence)
  1706. (window (parent event-window) window)
  1707. (int16 x y)
  1708. (card16 width height border-width)
  1709. ((member :above :below :top-if :bottom-if :opposite) stack-mode)
  1710. ((or null window) above-sibling)
  1711. (mask16 value-mask))
  1712. (declare-event :circulate-notify
  1713. (card16 sequence)
  1714. (window event-window window)
  1715. ((member :top :bottom) place))
  1716. (declare-event :circulate-request
  1717. (card16 sequence)
  1718. (window (parent event-window) window)
  1719. ((member :top :bottom) place))
  1720. (declare-event :property-notify
  1721. (card16 sequence)
  1722. (window (window event-window))
  1723. (keyword atom)
  1724. ((member :new-value :deleted) state)
  1725. ((or null card32) time))
  1726. (declare-event :selection-clear
  1727. (card16 sequence)
  1728. (window (window event-window))
  1729. (keyword selection)
  1730. ((or null card32) time))
  1731. (declare-event :selection-request
  1732. (card16 sequence)
  1733. (window (window event-window) requestor)
  1734. (keyword selection target)
  1735. ((or null keyword) property)
  1736. ((or null card32) time))
  1737. (declare-event :selection-notify
  1738. (card16 sequence)
  1739. (window (window event-window))
  1740. (keyword selection target)
  1741. ((or null keyword) property)
  1742. ((or null card32) time))
  1743. (declare-event :colormap-notify
  1744. (card16 sequence)
  1745. (window (window event-window))
  1746. ((or null colormap) colormap)
  1747. (boolean new-p installed-p))
  1748. (declare-event :mapping-notify
  1749. (card16 sequence)
  1750. ((member :modifier :keyboard :pointer) request)
  1751. (card8 start count))
  1752. (declare-event :client-message
  1753. (card16 sequence)
  1754. (window (window event-window))
  1755. ((member 8 16 32) format)
  1756. (sequence data))
  1757. (defun queue-event (display event-key &rest args &key append-p &allow-other-keys)
  1758. ;; The event is put at the head of the queue if append-p is nil, else the tail.
  1759. ;; Additional arguments depend on event-key, and are as specified above with
  1760. ;; declare-event, except that both resource-ids and resource objects are accepted
  1761. ;; in the event components.
  1762. (declare (type display display)
  1763. (type event-key event-key)
  1764. (type boolean append-p)))
  1765. ;;; From here on, there has been less coherent review of the interface:
  1766. ;;;-----------------------------------------------------------------------------
  1767. ;;; Window Manager Property functions
  1768. (defun wm-name (window)
  1769. (declare (type window window)
  1770. (clx-values string)))
  1771. (defsetf wm-name (window) (name))
  1772. (defun wm-icon-name (window)
  1773. (declare (type window window)
  1774. (clx-values string)))
  1775. (defsetf wm-icon-name (window) (name))
  1776. (defun get-wm-class (window)
  1777. (declare (type window window)
  1778. (clx-values (or null name-string) (or null class-string))))
  1779. (defun set-wm-class (window resource-name resource-class)
  1780. (declare (type window window)
  1781. (type (or null stringable) resource-name resource-class)))
  1782. (defun wm-command (window)
  1783. ;; Returns a list whose car is a command string and
  1784. ;; whose cdr is the list of argument strings.
  1785. (declare (type window window)
  1786. (clx-values (clx-list string))))
  1787. (defsetf wm-command (window) (command)
  1788. ;; Uses PRIN1 inside the ANSI common lisp form WITH-STANDARD-IO-SYNTAX (or
  1789. ;; equivalent), with elements of command separated by NULL characters. This
  1790. ;; enables
  1791. ;; (with-standard-io-syntax (mapcar #'read-from-string (wm-command window)))
  1792. ;; to recover a lisp command.
  1793. (declare (type window window)
  1794. (type (clx-list stringable) command)))
  1795. (defun wm-client-machine (window)
  1796. ;; Returns a list whose car is a command string and
  1797. ;; whose cdr is the list of argument strings.
  1798. (declare (type window window)
  1799. (clx-values string)))
  1800. (defsetf wm-client-machine (window) (string)
  1801. (declare (type window window)
  1802. (type stringable string)))
  1803. (defstruct wm-hints
  1804. (input nil :type (or null (member :off :on)))
  1805. (initial-state nil :type (or null (member :normal :iconic)))
  1806. (icon-pixmap nil :type (or null pixmap))
  1807. (icon-window nil :type (or null window))
  1808. (icon-x nil :type (or null card16))
  1809. (icon-y nil :type (or null card16))
  1810. (icon-mask nil :type (or null pixmap))
  1811. (window-group nil :type (or null resource-id))
  1812. (flags 0 :type card32) ;; Extension-hook. Exclusive-Or'ed with the FLAGS field
  1813. ;; may be extended in the future
  1814. )
  1815. (defun wm-hints (window)
  1816. (declare (type window window)
  1817. (clx-values wm-hints)))
  1818. (defsetf wm-hints (window) (wm-hints))
  1819. (defstruct wm-size-hints
  1820. ;; Defaulted T to put the burden of remembering these on widget programmers.
  1821. (user-specified-position-p t :type boolean) ;; True when user specified x y
  1822. (user-specified-size-p t :type boolean) ;; True when user specified width height
  1823. (x nil :type (or null int16)) ;; Obsolete
  1824. (y nil :type (or null int16)) ;; Obsolete
  1825. (width nil :type (or null card16)) ;; Obsolete
  1826. (height nil :type (or null card16)) ;; Obsolete
  1827. (min-width nil :type (or null card16))
  1828. (min-height nil :type (or null card16))
  1829. (max-width nil :type (or null card16))
  1830. (max-height nil :type (or null card16))
  1831. (width-inc nil :type (or null card16))
  1832. (height-inc nil :type (or null card16))
  1833. (min-aspect nil :type (or null number))
  1834. (max-aspect nil :type (or null number))
  1835. (base-width nil :type (or null card16))
  1836. (base-height nil :type (or null card16))
  1837. (win-gravity nil :type (or null win-gravity)))
  1838. (defun wm-normal-hints (window)
  1839. (declare (type window window)
  1840. (clx-values wm-size-hints)))
  1841. (defsetf wm-normal-hints (window) (wm-size-hints))
  1842. ;; ICON-SIZES uses the SIZE-HINTS structure
  1843. (defun icon-sizes (window)
  1844. (declare (type window window)
  1845. (clx-values wm-size-hints)))
  1846. (defsetf icon-sizes (window) (wm-size-hints))
  1847. (defun wm-protocols (window)
  1848. (declare (type window window)
  1849. (clx-values protocols)))
  1850. (defsetf wm-protocols (window) (protocols)
  1851. (declare (type window window)
  1852. (type (clx-list keyword) protocols)))
  1853. (defun wm-colormap-windows (window)
  1854. (declare (type window window)
  1855. (clx-values windows)))
  1856. (defsetf wm-colormap-windows (window) (windows)
  1857. (declare (type window window)
  1858. (type (clx-list window) windows)))
  1859. (defun transient-for (window)
  1860. (declare (type window window)
  1861. (clx-values window)))
  1862. (defsetf transient-for (window) (transient)
  1863. (declare (type window window transient)))
  1864. (defun set-wm-properties (window &rest options &key
  1865. name icon-name resource-name resource-class command
  1866. hints normal-hints
  1867. ;; the following are used for wm-normal-hints
  1868. user-specified-position-p user-specified-size-p
  1869. program-specified-position-p program-specified-size-p
  1870. min-width min-height max-width max-height
  1871. width-inc height-inc min-aspect max-aspect
  1872. base-width base-height win-gravity
  1873. ;; the following are used for wm-hints
  1874. input initial-state icon-pixmap icon-window
  1875. icon-x icon-y icon-mask window-group)
  1876. ;; Set properties for WINDOW.
  1877. (declare (type window window)
  1878. (type (or null stringable) name icoin-name resource-name resource-class)
  1879. (type (or null list) command)
  1880. (type (or null wm-hints) hints)
  1881. (type (or null wm-size-hints) normal-hints)
  1882. (type boolean user-specified-position-p user-specified-size-p)
  1883. (type boolean program-specified-position-p program-specified-size-p)
  1884. (type (or null card16) min-width min-height max-width max-height width-inc height-inc base-width base-height win-gravity)
  1885. (type (or null number) min-aspect max-aspect)
  1886. (type (or null (member :off :on)) input)
  1887. (type (or null (member :normal :iconic)) initial-state)
  1888. (type (or null pixmap) icon-pixmap icon-mask)
  1889. (type (or null window) icon-window)
  1890. (type (or null card16) icon-x icon-y)
  1891. (type (or null resource-id) window-group)))
  1892. (defun iconify-window (window)
  1893. (declare (type window window)))
  1894. (defun withdraw-window (window)
  1895. (declare (type window window)))
  1896. (defstruct standard-colormap
  1897. (colormap nil :type (or null colormap))
  1898. (base-pixel 0 :type pixel)
  1899. (max-color nil :type (or null color))
  1900. (mult-color nil :type (or null color))
  1901. (visual nil :type (or null visual-info))
  1902. (kill nil :type (or (member nil :release-by-freeing-colormap)
  1903. drawable gcontext cursor colormap font)))
  1904. (defun rgb-colormaps (window property)
  1905. (declare (type window window)
  1906. (type (member :rgb_default_map :rgb_best_map :rgb_red_map
  1907. :rgb_green_map :rgb_blue_map) property)
  1908. (clx-values (clx-list standard-colormap))))
  1909. (defsetf rgb-colormaps (window property) (standard-colormaps)
  1910. (declare (type window window)
  1911. (type (member :rgb_default_map :rgb_best_map :rgb_red_map
  1912. :rgb_green_map :rgb_blue_map) property)
  1913. (type (clx-list standard-colormap) standard-colormaps)))
  1914. (defun cut-buffer (display &key (buffer 0) (type :string) (result-type 'string)
  1915. (transform #'card8->char) (start 0) end)
  1916. ;; Return the contents of cut-buffer BUFFER
  1917. (declare (type display display)
  1918. (type (integer 0 7) buffer)
  1919. (type xatom type)
  1920. (type array-index start)
  1921. (type (or null array-index) end)
  1922. (type t result-type) ;a sequence type
  1923. (type (or null (function (integer) t)) transform)
  1924. (clx-values sequence type format bytes-after)))
  1925. (defsetf cut-buffer (display buffer &key (type :string) (format 8)
  1926. (transform #'char->card8) (start 0) end) (data))
  1927. (defun rotate-cut-buffers (display &optional (delta 1) (careful-p t))
  1928. ;; Positive rotates left, negative rotates right (opposite of actual
  1929. ;; protocol request). When careful-p, ensure all cut-buffer
  1930. ;; properties are defined, to prevent errors.
  1931. (declare (type display display)
  1932. (type int16 delta)
  1933. (type boolean careful-p)))
  1934. ;;;-----------------------------------------------------------------------------
  1935. ;;; Keycode mapping
  1936. (defun define-keysym-set (set first-keysym last-keysym)
  1937. ;; Define all keysyms from first-keysym up to and including
  1938. ;; last-keysym to be in SET (returned from the keysym-set function).
  1939. ;; Signals an error if the keysym range overlaps an existing set.
  1940. (declare (type keyword set)
  1941. (type keysym first-keysym last-keysym)))
  1942. (defun keysym-set (keysym)
  1943. ;; Return the character code set name of keysym
  1944. ;; Note that the keyboard set (255) has been broken up into its parts.
  1945. (declare (type keysym keysym)
  1946. (clx-values keyword)))
  1947. (defun define-keysym (object keysym &key lowercase translate modifiers mask display)
  1948. ;; Define the translation from keysym/modifiers to a (usually
  1949. ;; character) object. ANy previous keysym definition with
  1950. ;; KEYSYM and MODIFIERS is deleted before adding the new definition.
  1951. ;;
  1952. ;; MODIFIERS is either a modifier-mask or list containing intermixed
  1953. ;; keysyms and state-mask-keys specifying when to use this
  1954. ;; keysym-translation. The default is NIL.
  1955. ;;
  1956. ;; MASK is either a modifier-mask or list containing intermixed
  1957. ;; keysyms and state-mask-keys specifying which modifiers to look at
  1958. ;; (i.e. modifiers not specified are don't-cares).
  1959. ;; If mask is :MODIFIERS then the mask is the same as the modifiers
  1960. ;; (i.e. modifiers not specified by modifiers are don't cares)
  1961. ;; The default mask is *default-keysym-translate-mask*
  1962. ;;
  1963. ;; If DISPLAY is specified, the translation will be local to DISPLAY,
  1964. ;; otherwise it will be the default translation for all displays.
  1965. ;;
  1966. ;; LOWERCASE is used for uppercase alphabetic keysyms. The value
  1967. ;; is the associated lowercase keysym. This information is used
  1968. ;; by the keysym-both-case-p predicate (for caps-lock computations)
  1969. ;; and by the keysym-downcase function.
  1970. ;;
  1971. ;; TRANSLATE will be called with parameters (display state OBJECT)
  1972. ;; when translating KEYSYM and modifiers and mask are satisfied.
  1973. ;; [e.g (zerop (logxor (logand state (or mask *default-keysym-translate-mask*))
  1974. ;; (or modifiers 0)))
  1975. ;; when mask and modifiers aren't lists of keysyms]
  1976. ;; The default is #'default-keysym-translate
  1977. ;;
  1978. (declare (type (or base-char t) object)
  1979. (type keysym keysym)
  1980. (type (or null mask16 (clx-list (or keysym state-mask-key)))
  1981. modifiers)
  1982. (type (or null (member :modifiers) mask16 (clx-list (or keysym state-mask-key)))
  1983. mask)
  1984. (type (or null display) display)
  1985. (type (or null keysym) lowercase)
  1986. (type (function (display card16 t) t) translate)))
  1987. (defvar *default-keysym-translate-mask*
  1988. (the (or (member :modifiers) mask16 (clx-list (or keysym state-mask-key)))
  1989. (logand #xff (lognot (make-state-mask :lock))))
  1990. "Default keysym state mask to use during keysym-translation.")
  1991. (defun undefine-keysym (object keysym &key display modifiers &allow-other-keys)
  1992. ;; Undefine the keysym-translation translating KEYSYM to OBJECT with MODIFIERS.
  1993. ;; If DISPLAY is non-nil, undefine the translation for DISPLAY if it exists.
  1994. (declare (type (or base-char t) object)
  1995. (type keysym keysym)
  1996. (type (or null mask16 (clx-list (or keysym state-mask-key)))
  1997. modifiers)
  1998. (type (or null display) display)))
  1999. (defun default-keysym-translate (display state object)
  2000. ;; If object is a character, char-bits are set from state.
  2001. ;; If object is a list, it is an alist with entries:
  2002. ;; (base-char [modifiers] [mask-modifiers)
  2003. ;; When MODIFIERS are specified, this character translation
  2004. ;; will only take effect when the specified modifiers are pressed.
  2005. ;; MASK-MODIFIERS can be used to specify a set of modifiers to ignore.
  2006. ;; When MASK-MODIFIERS is missing, all other modifiers are ignored.
  2007. ;; In ambiguous cases, the most specific translation is used.
  2008. (declare (type display display)
  2009. (type card16 state)
  2010. (type t object)
  2011. (clx-values t))) ;; Object returned by keycode->character
  2012. (defmacro keysym (keysym &rest bytes)
  2013. ;; Build a keysym.
  2014. ;; If KEYSYM is an integer, it is used as the most significant bits of
  2015. ;; the keysym, and BYTES are used to specify low order bytes. The last
  2016. ;; parameter is always byte4 of the keysym. If KEYSYM is not an
  2017. ;; integer, the keysym associated with KEYSYM is returned.
  2018. ;;
  2019. ;; This is a macro and not a function macro to promote compile-time
  2020. ;; lookup. All arguments are evaluated.
  2021. (declare (type t keysym)
  2022. (type (clx-list card8) bytes)
  2023. (clx-values keysym)))
  2024. (defun character->keysyms (character &optional display)
  2025. ;; Given a character, return a list of all matching keysyms.
  2026. ;; If DISPLAY is given, translations specific to DISPLAY are used,
  2027. ;; otherwise only global translations are used.
  2028. ;; Implementation dependent function.
  2029. ;; May be slow [i.e. do a linear search over all known keysyms]
  2030. (declare (type t character)
  2031. (type (or null display) display)
  2032. (clx-values (clx-list keysym))))
  2033. (defun keycode->keysym (display keycode keysym-index)
  2034. (declare (type display display)
  2035. (type card8 code)
  2036. (type card16 state)
  2037. (type card8 keysym-index)
  2038. (clx-values keysym)))
  2039. (defun keysym->keycodes (display keysym)
  2040. ;; Return keycodes for keysym, as multiple values
  2041. (declare (type display display)
  2042. (type keysym keysym)
  2043. (clx-values (or null keycode) (or null keycode) (or null keycode)))
  2044. )
  2045. (defun keysym->character (display keysym &optional state)
  2046. ;; Find the character associated with a keysym.
  2047. ;; STATE is used for adding char-bits to character as follows:
  2048. ;; control -> char-control-bit
  2049. ;; mod-1 -> char-meta-bit
  2050. ;; mod-2 -> char-super-bit
  2051. ;; mod-3 -> char-hyper-bit
  2052. ;; Implementation dependent function.
  2053. (declare (type display display)
  2054. (type keysym keysym)
  2055. (type (or null card16) state)
  2056. (clx-values (or null character))))
  2057. (defun keycode->character (display keycode state &key keysym-index
  2058. (keysym-index-function #'default-keysym-index))
  2059. ;; keysym-index defaults to the result of keysym-index-function which
  2060. ;; is called with the following parameters:
  2061. ;; (char0 state caps-lock-p keysyms-per-keycode)
  2062. ;; where char0 is the "character" object associated with keysym-index 0 and
  2063. ;; caps-lock-p is non-nil when the keysym associated with the lock
  2064. ;; modifier is for caps-lock.
  2065. ;; STATE is also used for setting char-bits:
  2066. ;; control -> char-control-bit
  2067. ;; mod-1 -> char-meta-bit
  2068. ;; mod-2 -> char-super-bit
  2069. ;; mod-3 -> char-hyper-bit
  2070. ;; Implementation dependent function.
  2071. (declare (type display display)
  2072. (type card8 keycode)
  2073. (type card16 state)
  2074. (type (or null card8) keysym-index)
  2075. (type (or null (function (char0 state caps-lock-p keysyms-per-keycode) card8))
  2076. keysym-index-function)
  2077. (clx-values (or null character))))
  2078. (defun default-keysym-index (display keycode state)
  2079. ;; Returns a keysym-index for use with keycode->character
  2080. (declare (clx-values card8))
  2081. )
  2082. ;;; default-keysym-index implements the following tables:
  2083. ;;;
  2084. ;;; control shift caps-lock character character
  2085. ;;; 0 0 0 #\a #\8
  2086. ;;; 0 0 1 #\A #\8
  2087. ;;; 0 1 0 #\A #\*
  2088. ;;; 0 1 1 #\A #\*
  2089. ;;; 1 0 0 #\control-A #\control-8
  2090. ;;; 1 0 1 #\control-A #\control-8
  2091. ;;; 1 1 0 #\control-shift-a #\control-*
  2092. ;;; 1 1 1 #\control-shift-a #\control-*
  2093. ;;;
  2094. ;;; control shift shift-lock character character
  2095. ;;; 0 0 0 #\a #\8
  2096. ;;; 0 0 1 #\A #\*
  2097. ;;; 0 1 0 #\A #\*
  2098. ;;; 0 1 1 #\A #\8
  2099. ;;; 1 0 0 #\control-A #\control-8
  2100. ;;; 1 0 1 #\control-A #\control-*
  2101. ;;; 1 1 0 #\control-shift-a #\control-*
  2102. ;;; 1 1 1 #\control-shift-a #\control-8
  2103. (defun state-keysymp (display state keysym)
  2104. ;; Returns T when a modifier key associated with KEYSYM is on in STATE
  2105. (declare (type display display)
  2106. (type card16 state)
  2107. (type keysym keysym)
  2108. (clx-values boolean)))
  2109. (defun mapping-notify (display request start count)
  2110. ;; Called on a mapping-notify event to update
  2111. ;; the keyboard-mapping cache in DISPLAY
  2112. (declare (type display display)
  2113. (type (member :modifier :keyboard :pointer) request)
  2114. (type card8 start count)))
  2115. (defun keysym-in-map-p (display keysym keymap)
  2116. ;; Returns T if keysym is found in keymap
  2117. (declare (type display display)
  2118. (type keysym keysym)
  2119. (type (bit-vector 256) keymap)
  2120. (value boolean)))
  2121. (defun character-in-map-p (display character keymap)
  2122. ;; Implementation dependent function.
  2123. ;; Returns T if character is found in keymap
  2124. (declare (type display display)
  2125. (type t character)
  2126. (type (bit-vector 256) keymap)
  2127. (value boolean)))
  2128. ;;;-----------------------------------------------------------------------------
  2129. ;;; Extensions
  2130. (defmacro define-extension (name &key events errors)
  2131. ;; Define extension NAME with EVENTS and ERRORS.
  2132. ;; Note: The case of NAME is important.
  2133. ;; To define the request, Use:
  2134. ;; (with-buffer-request (display (extension-opcode ,name)) ,@body)
  2135. ;; See the REQUESTS file for lots of examples.
  2136. ;; To define event handlers, use declare-event.
  2137. ;; To define error handlers, use declare-error and define-condition.
  2138. (declare (type stringable name)
  2139. (type (clx-list symbol) events errors)))
  2140. (defmacro extension-opcode (display name)
  2141. ;; Returns the major opcode for extension NAME.
  2142. ;; This is a macro to enable NAME to be interned for fast run-time
  2143. ;; retrieval.
  2144. ;; Note: The case of NAME is important.
  2145. (declare (type display display)
  2146. (type stringable name)
  2147. (clx-values card8)))
  2148. (defmacro define-error (error-key function)
  2149. ;; Associate a function with ERROR-KEY which will be called with
  2150. ;; parameters DISPLAY and REPLY-BUFFER and returns a plist of
  2151. ;; keyword/value pairs which will be passed on to the error handler.
  2152. ;; A compiler warning is printed when ERROR-KEY is not defined in a
  2153. ;; preceding DEFINE-EXTENSION.
  2154. ;; Note: REPLY-BUFFER may used with the READING-EVENT and READ-type
  2155. ;; macros for getting error fields. See DECODE-CORE-ERROR for
  2156. ; an example.
  2157. (declare (type symbol error-key)
  2158. (type function function)))
  2159. ;; All core errors use this, so we make it available to extensions.
  2160. (defun decode-core-error (display event &optional arg)
  2161. ;; All core errors have the following keyword/argument pairs:
  2162. ;; :major integer
  2163. ;; :minor integer
  2164. ;; :sequence integer
  2165. ;; :current-sequence integer
  2166. ;; In addition, many have an additional argument that comes from the
  2167. ;; same place in the event, but is named differently. When the ARG
  2168. ;; argument is specified, the keyword ARG with card32 value starting
  2169. ;; at byte 4 of the event is returned with the other keyword/argument
  2170. ;; pairs.
  2171. (declare (type display display)
  2172. (type reply-buffer event)
  2173. (type (or null keyword) arg)
  2174. (clx-values keyword/arg-plist)))
  2175. ;; This isn't new, just extended.
  2176. (defmacro declare-event (event-codes &body declares)
  2177. ;; Used to indicate the keyword arguments for handler functions in
  2178. ;; process-event and event-case.
  2179. ;; Generates functions used in SEND-EVENT.
  2180. ;; A compiler warning is printed when all of EVENT-CODES are not
  2181. ;; defined by a preceding DEFINE-EXTENSION.
  2182. ;; See the INPUT file for lots of examples.
  2183. (declare (type (or keyword (clx-list keywords)) event-codes)
  2184. (type (alist (field-type symbol) (field-names (clx-list symbol)))
  2185. declares)))
  2186. (defmacro define-gcontext-accessor (name &key default set-function copy-function)
  2187. ;; This will define a new gcontext accessor called NAME.
  2188. ;; Defines the gcontext-NAME accessor function and its defsetf.
  2189. ;; Gcontext's will cache DEFAULT-VALUE and the last value SETF'ed when
  2190. ;; gcontext-cache-p is true. The NAME keyword will be allowed in
  2191. ;; CREATE-GCONTEXT, WITH-GCONTEXT, and COPY-GCONTEXT-COMPONENTS.
  2192. ;; SET-FUNCTION will be called with parameters (GCONTEXT NEW-VALUE)
  2193. ;; from create-gcontext, and force-gcontext-changes.
  2194. ;; COPY-FUNCTION will be called with parameters (src-gc dst-gc src-value)
  2195. ;; from copy-gcontext and copy-gcontext-components.
  2196. ;; The copy-function defaults to:
  2197. ;; (lambda (ignore dst-gc value)
  2198. ;; (if value
  2199. ;; (,set-function dst-gc value)
  2200. ;; (error "Can't copy unknown GContext component ~a" ',name)))
  2201. (declare (type symbol name)
  2202. (type t default)
  2203. (type symbol set-function) ;; required
  2204. (type symbol copy-function)))
  2205. ;; To aid extension implementors in attaching additional information to
  2206. ;; clx data structures, the following accessors (with SETF's) are
  2207. ;; defined. GETF can be used on these to extend the structures.
  2208. display-plist
  2209. screen-plist
  2210. visual-info-plist
  2211. gcontext-plist
  2212. font-plist
  2213. drawable-plist
  2214. ;;; These have had perhaps even less review.
  2215. ;;; Add some of the functionality provided by the C XLIB library.
  2216. ;;;
  2217. ;;; LaMott G. Oren, Texas Instruments 10/87
  2218. ;;;
  2219. ;;; Design Contributors:
  2220. ;;; Robert W. Scheifler, MIT
  2221. ;;;-----------------------------------------------------------------------------
  2222. ;;; Regions (not yet implemented)
  2223. ;;; Regions are arbitrary collections of pixels. This is represented
  2224. ;;; in the region structure as either a list of rectangles or a bitmap.
  2225. (defun make-region (&optional x y width height)
  2226. ;; With no parameters, returns an empty region
  2227. ;; If some parameters are given, all must be given.
  2228. (declare (type (or null int16) x y width height)
  2229. (clx-values region)))
  2230. (defun region-p (thing))
  2231. (defun copy-region (region))
  2232. (defun region-empty-p (region)
  2233. (declare (type region region)
  2234. (clx-values boolean)))
  2235. (defun region-clip-box (region)
  2236. ;; Returns a region which is the smallest enclosing rectangle
  2237. ;; enclosing REGION
  2238. (declare (type region region)
  2239. (clx-values region)))
  2240. ;; Accessors that return the boundaries of a region
  2241. (defun region-x (region))
  2242. (defun region-y (region))
  2243. (defun region-width (region))
  2244. (defun region-height (region))
  2245. (defsetf region-x (region) (x))
  2246. (defsetf region-y (region) (y))
  2247. ;; Setting a region's X/Y translates the region
  2248. (defun region-intersection (&rest regions)
  2249. "Returns a region which is the intersection of one or more REGIONS.
  2250. Returns an empty region if the intersection is empty.
  2251. If there are no regions given, return a very large region."
  2252. (declare (type (clx-list region) regions)
  2253. (clx-values region)))
  2254. (defun region-union (&rest regions)
  2255. "Returns a region which is the union of a number of REGIONS
  2256. (i.e. the smallest region that can contain all the other regions)
  2257. Returns the empty region if no regions are given."
  2258. (declare (type (clx-list region) regions)
  2259. (clx-values region)))
  2260. (defun region-subtract (region subtract)
  2261. "Returns a region containing the points that are in REGION but not in SUBTRACT"
  2262. (declare (type region region subtract)
  2263. (clx-values region)))
  2264. (defun point-in-region-p (region x y)
  2265. ;; Returns T when X/Y are a point within REGION.
  2266. (declare (type region region)
  2267. (type int16 x y)
  2268. (clx-values boolean)))
  2269. (defun region-equal (a b)
  2270. ;; Returns T when regions a and b contain the same points.
  2271. ;; That is, return t when for every X/Y (point-in-region-p a x y)
  2272. ;; equals (point-in-region-p b x y)
  2273. (declare (type region a b)
  2274. (clx-values boolean)))
  2275. (defun subregion-p (large small)
  2276. "Returns T if SMALL is within LARGE.
  2277. That is, return T when for every X/Y (point-in-region-p small X Y)
  2278. implies (point-in-region-p large X Y)."
  2279. (declare (type region large small)
  2280. (clx-values boolean)))
  2281. (defun region-intersect-p (a b)
  2282. "Returns T if A intersects B.
  2283. That is, return T when there is some point common to regions A and B."
  2284. (declare (type region a b)
  2285. (clx-values boolean)))
  2286. (defun map-region (region function &rest args)
  2287. ;; Calls function with arguments (x y . args) for every point in REGION.
  2288. (declare (type region region)
  2289. (type (function x y &rest args) function)))
  2290. ;; Why isn't it better to augment
  2291. ;; gcontext-clip-mask to deal with
  2292. ;; (or null (member :none) pixmap rect-seq region)
  2293. ;; and force conversions on the caller?
  2294. ;; Good idea.
  2295. ;;(defun gcontext-clip-region (gcontext)
  2296. ;; ;; If the clip-mask of GCONTEXT is known, return it as a region.
  2297. ;; (declare (type gcontext gcontext)
  2298. ;; (clx-values (or null region))))
  2299. ;;(defsetf gcontext-clip-region (gcontext) (region)
  2300. ;; ;; Set the clip-rectangles or clip-mask for for GCONTEXT to include
  2301. ;; ;; only the pixels within REGION.
  2302. ;; (declare (type gcontext gcontext)
  2303. ;; (type region region)))
  2304. (defun image->region (image)
  2305. ;; Returns a region containing the 1 bits of a depth-1 image
  2306. ;; Signals an error if image isn't of depth 1.
  2307. (declare (type image image)
  2308. (clx-values region)))
  2309. (defun region->image (region)
  2310. ;; Returns a depth-1 image containg 1 bits for every pixel in REGION.
  2311. (declare (type region region)
  2312. (clx-values image)))
  2313. (defun polygon-region (points &optional (fill-rule :even-odd))
  2314. (declare (type sequence points) ;(repeat-seq (integer x) (integer y))
  2315. (type (member :even-odd :winding) fill-rule)
  2316. (clx-values region)))
  2317. ;;;-----------------------------------------------------------------------------
  2318. ;;; IMAGE functions
  2319. (deftype bitmap () '(array bit (* *)))
  2320. (deftype pixarray () '(array pixel (* *)))
  2321. (defconstant +lisp-byte-lsb-first-p+ #+lispm t #-lispm nil
  2322. "Byte order in pixel arrays")
  2323. (defstruct image
  2324. ;; Public structure
  2325. (width 0 :type card16 :read-only t)
  2326. (height 0 :type card16 :read-only t)
  2327. (depth 1 :type card8 :read-only t)
  2328. (plist nil :type list))
  2329. ;; Image-Plist accessors:
  2330. (defun image-name (image))
  2331. (defun image-x-hot (image))
  2332. (defun image-y-hot (image))
  2333. (defun image-red-mask (image))
  2334. (defun image-blue-mask (image))
  2335. (defun image-green-mask (image))
  2336. (defsetf image-name (image) (name))
  2337. (defsetf image-x-hot (image) (x))
  2338. (defsetf image-y-hot (image) (y))
  2339. (defsetf image-red-mask (image) (mask))
  2340. (defsetf image-blue-mask (image) (mask))
  2341. (defsetf image-green-mask (image) (mask))
  2342. (defstruct (image-x (:include image))
  2343. ;; Use this format for shoveling image data
  2344. ;; Private structure. Accessors for these NOT exported.
  2345. (format :z-pixmap :type (member :bitmap :xy-pixmap :z-pixmap))
  2346. (bytes-per-line 0 :type card16)
  2347. (scanline-pad 32 :type (member 8 16 32))
  2348. (bits-per-pixel 0 :type (member 1 4 8 16 24 32))
  2349. (bit-lsb-first-p nil :type boolean) ; Bit order
  2350. (byte-lsb-first-p nil :type boolean) ; Byte order
  2351. (data #() :type (array card8 (*)))) ; row-major
  2352. (defstruct (image-xy (:include image))
  2353. ;; Public structure
  2354. ;; Use this format for image processing
  2355. (bitmap-list nil :type (clx-list bitmap)))
  2356. (defstruct (image-z (:include image))
  2357. ;; Public structure
  2358. ;; Use this format for image processing
  2359. (bits-per-pixel 0 :type (member 1 4 8 16 24 32))
  2360. (pixarray #() :type pixarray))
  2361. (defun create-image (&key (width (required-arg width))
  2362. (height (required-arg height))
  2363. depth data plist name x-hot y-hot
  2364. red-mask blue-mask green-mask
  2365. bits-per-pixel format scanline-pad bytes-per-line
  2366. byte-lsb-first-p bit-lsb-first-p )
  2367. ;; Returns an image-x image-xy or image-z structure, depending on the
  2368. ;; type of the :DATA parameter.
  2369. (declare
  2370. (type card16 width height) ; Required
  2371. (type (or null card8) depth) ; Defualts to 1
  2372. (type (or (array card8 (*)) ;Returns image-x
  2373. (clx-list bitmap) ;Returns image-xy
  2374. pixarray) data) ;Returns image-z
  2375. (type list plist)
  2376. (type (or null stringable) name)
  2377. (type (or null card16) x-hot y-hot)
  2378. (type (or null pixel) red-mask blue-mask green-mask)
  2379. (type (or null (member 1 4 8 16 24 32)) bits-per-pixel)
  2380. ;; The following parameters are ignored for image-xy and image-z:
  2381. (type (or null (member :bitmap :xy-pixmap :z-pixmap))
  2382. format) ; defaults to :z-pixmap
  2383. (type (or null (member 8 16 32)) scanline-pad)
  2384. (type (or null card16) bytes-per-line) ;default from width and scanline-pad
  2385. (type boolean byte-lsb-first-p bit-lsb-first-p)
  2386. (clx-values image)))
  2387. (defun get-image (drawable &key
  2388. (x (required-arg x))
  2389. (y (required-arg y))
  2390. (width (required-arg width))
  2391. (height (required-arg height))
  2392. plane-mask format result-type)
  2393. ;; Get an image from the server.
  2394. ;; Format defaults to :z-pixmap. Result-Type defaults from Format,
  2395. ;; image-z for :z-pixmap, and image-xy for :xy-pixmap.
  2396. ;; Plane-mask defaults to #xFFFFFFFF.
  2397. ;; Returns an image-x image-xy or image-z structure, depending on the
  2398. ;; result-type parameter.
  2399. (declare (type drawable drawable)
  2400. (type int16 x y) ;; required
  2401. (type card16 width height) ;; required
  2402. (type (or null pixel) plane-mask)
  2403. (type (or null (member :xy-pixmap :z-pixmap)) format)
  2404. (type (or null (member image-x image-xy image-z)) result-type)
  2405. (clx-values image)))
  2406. (defun put-image (drawable gcontext image &key
  2407. (src-x 0) (src-y 0)
  2408. (x (required-arg x))
  2409. (y (required-arg y))
  2410. width height
  2411. bitmap-p)
  2412. ;; When BITMAP-P, force format to be :bitmap when depth=1
  2413. ;; This causes gcontext to supply foreground & background pixels.
  2414. (declare (type drawable drawable)
  2415. (type gcontext gcontext)
  2416. (type image image)
  2417. (type int16 x y) ;; required
  2418. (type (or null card16) width height)
  2419. (type boolean bitmap-p)))
  2420. (defun copy-image (image &key (x 0) (y 0) width height result-type)
  2421. ;; Copy with optional sub-imaging and format conversion.
  2422. ;; result-type defaults to (type-of image)
  2423. (declare (type image image)
  2424. (type card16 x y)
  2425. (type (or null card16) width height) ;; Default from image
  2426. (type (or null (member image-x image-xy image-z)) result-type)
  2427. (clx-values image)))
  2428. (defun read-bitmap-file (pathname)
  2429. ;; Creates an image from a C include file in standard X11 format
  2430. (declare (type (or pathname string stream) pathname)
  2431. (clx-values image)))
  2432. (defun write-bitmap-file (pathname image &optional name)
  2433. ;; Writes an image to a C include file in standard X11 format
  2434. ;; NAME argument used for variable prefixes. Defaults to "image"
  2435. (declare (type (or pathname string stream) pathname)
  2436. (type image image)
  2437. (type (or null stringable) name)))
  2438. ;;;-----------------------------------------------------------------------------
  2439. ;;; Resource data-base
  2440. (defun make-resource-database ()
  2441. ;; Returns an empty resource data-base
  2442. (declare (clx-values resource-database)))
  2443. (defun get-resource (database value-name value-class full-name full-class)
  2444. ;; Return the value of the resource in DATABASE whose partial name
  2445. ;; most closely matches (append full-name (list value-name)) and
  2446. ;; (append full-class (list value-class)).
  2447. (declare (type resource-database database)
  2448. (type stringable value-name value-class)
  2449. (type (clx-list stringable) full-name full-class)
  2450. (clx-values value)))
  2451. (defun add-resource (database name-list value)
  2452. ;; name-list is a list of either strings or symbols. If a symbol,
  2453. ;; case-insensitive comparisons will be used, if a string,
  2454. ;; case-sensitive comparisons will be used. The symbol '* or
  2455. ;; string "*" are used as wildcards, matching anything or nothing.
  2456. (declare (type resource-database database)
  2457. (type (clx-list stringable) name-list)
  2458. (type t value)))
  2459. (defun delete-resource (database name-list)
  2460. (declare (type resource-database database)
  2461. (type (clx-list stringable) name-list)))
  2462. (defun map-resource (database function &rest args)
  2463. ;; Call FUNCTION on each resource in DATABASE.
  2464. ;; FUNCTION is called with arguments (name-list value . args)
  2465. (declare (type resource-database database)
  2466. (type (function ((clx-list stringable) t &rest t) t) function)
  2467. (clx-values nil)))
  2468. (defun merge-resources (database with-database)
  2469. (declare (type resource-database database with-database)
  2470. (clx-values resource-database))
  2471. (map-resource #'add-resource database with-database)
  2472. with-database)
  2473. ;; Note: with-input-from-string can be used with read-resources to define
  2474. ;; default resources in a program file.
  2475. (defun read-resources (database pathname &key key test test-not)
  2476. ;; Merges resources from a file in standard X11 format with DATABASE.
  2477. ;; KEY is a function used for converting value-strings, the default is
  2478. ;; identity. TEST and TEST-NOT are predicates used for filtering
  2479. ;; which resources to include in the database. They are called with
  2480. ;; the name and results of the KEY function.
  2481. (declare (type resource-database database)
  2482. (type (or pathname string stream) pathname)
  2483. (type (or null (function (string) t)) key)
  2484. (type (or null (function ((clx-list string) t) boolean))
  2485. test test-not)
  2486. (clx-values resource-database)))
  2487. (defun write-resources (database pathname &key write test test-not)
  2488. ;; Write resources to PATHNAME in the standard X11 format.
  2489. ;; WRITE is a function used for writing values, the default is #'princ
  2490. ;; TEST and TEST-NOT are predicates used for filtering which resources
  2491. ;; to include in the database. They are called with the name and value.
  2492. (declare (type resource-database database)
  2493. (type (or pathname string stream) pathname)
  2494. (type (or null (function (string stream) t)) write)
  2495. (type (or null (function ((clx-list string) t) boolean))
  2496. test test-not)))
  2497. (defun root-resources (screen &key database key test test-not)
  2498. "Returns a resource database containing the contents of the root window
  2499. RESOURCE_MANAGER property for the given SCREEN. If SCREEN is a display,
  2500. then its default screen is used. If an existing DATABASE is given, then
  2501. resource values are merged with the DATABASE and the modified DATABASE is
  2502. returned.
  2503. TEST and TEST-NOT are predicates for selecting which resources are
  2504. read. Arguments are a resource name list and a resource value. The KEY
  2505. function, if given, is called to convert a resource value string to the
  2506. value given to TEST or TEST-NOT."
  2507. (declare (type (or screen display) screen)
  2508. (type (or null resource-database) database)
  2509. (type (or null (function (string) t)) key)
  2510. (type (or null (function list boolean)) test test-not)
  2511. (clx-values resource-database)))
  2512. (defsetf root-resources (screen &key test test-not (write 'princ)) (database)
  2513. "Changes the contents of the root window RESOURCE_MANAGER property for the
  2514. given SCREEN. If SCREEN is a display, then its default screen is used.
  2515. TEST and TEST-NOT are predicates for selecting which resources from the
  2516. DATABASE are written. Arguments are a resource name list and a resource
  2517. value. The WRITE function is used to convert a resource value into a
  2518. string stored in the property."
  2519. (declare (type (or screen display) screen)
  2520. (type (or null resource-database) database)
  2521. (type (or null (function list boolean)) test test-not)
  2522. (type (or null (function (string stream) t)) write)
  2523. (clx-values resource-database)))
  2524. ;;;-----------------------------------------------------------------------------
  2525. ;;; Shared GContext's
  2526. (defmacro using-gcontext ((var &rest options &key drawable
  2527. function plane-mask foreground background
  2528. line-width line-style cap-style
  2529. join-style fill-style fill-rule arc-mode
  2530. tile stipple ts-x ts-y font
  2531. subwindow-mode exposures clip-x clip-y
  2532. clip-mask clip-ordering dash-offset
  2533. dashes)
  2534. &body body)
  2535. ;; Equivalent to (let ((var (apply #'make-gcontext options))) ,@body)
  2536. ;; but more efficient because it uses a gcontext cache associated with
  2537. ;; drawable's display.
  2538. )
  2539. X11 Request Name CLX Function Name
  2540. ----------------- -----------------
  2541. AllocColor ALLOC-COLOR
  2542. AllocColorCells ALLOC-COLOR-CELLS
  2543. AllocColorPlanes ALLOC-COLOR-PLANES
  2544. AllocNamedColor ALLOC-COLOR
  2545. AllowEvents ALLOW-EVENTS
  2546. Bell BELL
  2547. ChangeAccessControl (setf (ACCESS-CONTROL display) boolean)
  2548. ChangeActivePointerGrab CHANGE-ACTIVE-POINTER-GRAB
  2549. ChangeCloseDownMode (setf (CLOSE-DOWN-MODE display) mode)
  2550. ChangeGC FORCE-GCONTEXT-CHANGES
  2551. ;; See WITH-GCONTEXT
  2552. (setf (gcontext-function gc) boole-constant)
  2553. (setf (gcontext-plane-mask gc) card32)
  2554. (setf (gcontext-foreground gc) card32)
  2555. (setf (gcontext-background gc) card32)
  2556. (setf (gcontext-line-width gc) card16)
  2557. (setf (gcontext-line-style gc) keyword)
  2558. (setf (gcontext-cap-style gc) keyword)
  2559. (setf (gcontext-join-style gc) keyword)
  2560. (setf (gcontext-fill-style gc) keyword)
  2561. (setf (gcontext-fill-rule gc) keyword)
  2562. (setf (gcontext-tile gc) pixmap)
  2563. (setf (gcontext-stipple gc) pixmap)
  2564. (setf (gcontext-ts-x gc) int16) ;; Tile-Stipple-X-origin
  2565. (setf (gcontext-ts-y gc) int16) ;; Tile-Stipple-Y-origin
  2566. (setf (gcontext-font gc &optional metrics-p) font)
  2567. (setf (gcontext-subwindow-mode gc) keyword)
  2568. (setf (gcontext-exposures gc) (member :on :off))
  2569. (setf (gcontext-clip-x gc) int16)
  2570. (setf (gcontext-clip-y gc) int16)
  2571. (setf (gcontext-clip-mask gc &optional ordering)
  2572. (or (member :none) pixmap rect-seq))
  2573. (setf (gcontext-dash-offset gc) card16)
  2574. (setf (gcontext-dashes gc) (or card8 sequence))
  2575. (setf (gcontext-arc-mode gc) (member :chord :pie-slice))
  2576. (setf (gcontext-clip-ordering gc) keyword)
  2577. ChangeHosts ADD-ACCESS-HOST
  2578. ChangeHosts REMOVE-ACCESS-HOST
  2579. ChangeKeyboardControl CHANGE-KEYBOARD-CONTROL
  2580. ChangePointerControl CHANGE-POINTER-CONTROL
  2581. ChangeProperty CHANGE-PROPERTY
  2582. ChangeSaveSet REMOVE-FROM-SAVE-SET
  2583. ChangeSaveSet ADD-TO-SAVE-SET
  2584. ChangeWindowAttributes
  2585. ;; See WITH-STATE
  2586. (setf (window-background window) value)
  2587. (setf (window-border window) value)
  2588. (setf (window-bit-gravity window) value)
  2589. (setf (window-gravity window) value)
  2590. (setf (window-backing-store window) value)
  2591. (setf (window-backing-planes window) value)
  2592. (setf (window-backing-pixel window) value)
  2593. (setf (window-override-redirect window) value)
  2594. (setf (window-save-under window) value)
  2595. (setf (window-colormap window) value)
  2596. (setf (window-cursor window) value)
  2597. (setf (window-event-mask window) value)
  2598. (setf (window-do-not-propagate-mask window) value)
  2599. CirculateWindow CIRCULATE-WINDOW-DOWN
  2600. CirculateWindow CIRCULATE-WINDOW-UP
  2601. ClearToBackground CLEAR-AREA
  2602. CloseFont CLOSE-FONT
  2603. ConfigureWindow
  2604. ;; See WITH-STATE
  2605. (setf (drawable-x drawable) integer)
  2606. (setf (drawable-y drawable) integer)
  2607. (setf (drawable-width drawable) integer)
  2608. (setf (drawable-height drawable) integer)
  2609. (setf (drawable-depth drawable) integer)
  2610. (setf (drawable-border-width drawable) integer)
  2611. (setf (window-priority window &optional sibling) integer)
  2612. ConvertSelection CONVERT-SELECTION
  2613. CopyArea COPY-AREA
  2614. CopyColormapAndFree COPY-COLORMAP-AND-FREE
  2615. CopyGC COPY-GCONTEXT
  2616. CopyGC COPY-GCONTEXT-COMPONENTS
  2617. CopyPlane COPY-PLANE
  2618. CreateColormap CREATE-COLORMAP
  2619. CreateCursor CREATE-CURSOR
  2620. CreateGC CREATE-GCONTEXT
  2621. CreateGlyphCursor CREATE-GLYPH-CURSOR
  2622. CreatePixmap CREATE-PIXMAP
  2623. CreateWindow CREATE-WINDOW
  2624. DeleteProperty DELETE-PROPERTY
  2625. DestroySubwindows DESTROY-SUBWINDOWS
  2626. DestroyWindow DESTROY-WINDOW
  2627. FillPoly DRAW-LINES
  2628. ForceScreenSaver RESET-SCREEN-SAVER
  2629. ForceScreenSaver ACTIVATE-SCREEN-SAVER
  2630. FreeColormap FREE-COLORMAP
  2631. FreeColors FREE-COLORS
  2632. FreeCursor FREE-CURSOR
  2633. FreeGC FREE-GCONTEXT
  2634. FreePixmap FREE-PIXMAP
  2635. GetAtomName ATOM-NAME
  2636. GetFontPath FONT-PATH
  2637. GetGeometry ;; See WITH-STATE
  2638. DRAWABLE-ROOT
  2639. DRAWABLE-X
  2640. DRAWABLE-Y
  2641. DRAWABLE-WIDTH
  2642. DRAWABLE-HEIGHT
  2643. DRAWABLE-DEPTH
  2644. DRAWABLE-BORDER-WIDTH
  2645. GetImage GET-RAW-IMAGE
  2646. GetInputFocus INPUT-FOCUS
  2647. GetKeyboardControl KEYBOARD-CONTROL
  2648. GetKeyboardMapping KEYBOARD-MAPPING
  2649. GetModifierMapping MODIFIER-MAPPING
  2650. GetMotionEvents MOTION-EVENTS
  2651. GetPointerControl POINTER-CONTROL
  2652. GetPointerMapping POINTER-MAPPING
  2653. GetProperty GET-PROPERTY
  2654. GetScreenSaver SCREEN-SAVER
  2655. GetSelectionOwner SELECTION-OWNER
  2656. GetWindowAttributes ;; See WITH-STATE
  2657. WINDOW-VISUAL-INFO
  2658. WINDOW-CLASS
  2659. WINDOW-BIT-GRAVITY
  2660. WINDOW-GRAVITY
  2661. WINDOW-BACKING-STORE
  2662. WINDOW-BACKING-PLANES
  2663. WINDOW-BACKING-PIXEL
  2664. WINDOW-SAVE-UNDER
  2665. WINDOW-OVERRIDE-REDIRECT
  2666. WINDOW-EVENT-MASK
  2667. WINDOW-DO-NOT-PROPAGATE-MASK
  2668. WINDOW-COLORMAP
  2669. WINDOW-COLORMAP-INSTALLED-P
  2670. WINDOW-ALL-EVENT-MASKS
  2671. WINDOW-MAP-STATE
  2672. GrabButton GRAB-BUTTON
  2673. GrabKey GRAB-KEY
  2674. GrabKeyboard GRAB-KEYBOARD
  2675. GrabPointer GRAB-POINTER
  2676. GrabServer GRAB-SERVER
  2677. ImageText16 DRAW-IMAGE-GLYPHS
  2678. ImageText16 DRAW-IMAGE-GLYPH
  2679. ImageText8 DRAW-IMAGE-GLYPHS
  2680. InstallColormap INSTALL-COLORMAP
  2681. InternAtom FIND-ATOM
  2682. InternAtom INTERN-ATOM
  2683. KillClient KILL-TEMPORARY-CLIENTS
  2684. KillClient KILL-CLIENT
  2685. ListExtensions LIST-EXTENSIONS
  2686. ListFonts LIST-FONT-NAMES
  2687. ListFontsWithInfo LIST-FONTS
  2688. ListHosts ACCESS-CONTROL
  2689. ListHosts ACCESS-HOSTS
  2690. ListInstalledColormaps INSTALLED-COLORMAPS
  2691. ListProperties LIST-PROPERTIES
  2692. LookupColor LOOKUP-COLOR
  2693. MapSubwindows MAP-SUBWINDOWS
  2694. MapWindow MAP-WINDOW
  2695. OpenFont OPEN-FONT
  2696. PolyArc DRAW-ARC
  2697. PolyArc DRAW-ARCS
  2698. PolyFillArc DRAW-ARC
  2699. PolyFillArc DRAW-ARCS
  2700. PolyFillRectangle DRAW-RECTANGLE
  2701. PolyFillRectangle DRAW-RECTANGLES
  2702. PolyLine DRAW-LINE
  2703. PolyLine DRAW-LINES
  2704. PolyPoint DRAW-POINT
  2705. PolyPoint DRAW-POINTS
  2706. PolyRectangle DRAW-RECTANGLE
  2707. PolyRectangle DRAW-RECTANGLES
  2708. PolySegment DRAW-SEGMENTS
  2709. PolyText16 DRAW-GLYPH
  2710. PolyText16 DRAW-GLYPHS
  2711. PolyText8 DRAW-GLYPHS
  2712. PutImage PUT-RAW-IMAGE
  2713. QueryBestSize QUERY-BEST-CURSOR
  2714. QueryBestSize QUERY-BEST-STIPPLE
  2715. QueryBestSize QUERY-BEST-TILE
  2716. QueryColors QUERY-COLORS
  2717. QueryExtension QUERY-EXTENSION
  2718. QueryFont FONT-NAME
  2719. FONT-NAME
  2720. FONT-DIRECTION
  2721. FONT-MIN-CHAR
  2722. FONT-MAX-CHAR
  2723. FONT-MIN-BYTE1
  2724. FONT-MAX-BYTE1
  2725. FONT-MIN-BYTE2
  2726. FONT-MAX-BYTE2
  2727. FONT-ALL-CHARS-EXIST-P
  2728. FONT-DEFAULT-CHAR
  2729. FONT-ASCENT
  2730. FONT-DESCENT
  2731. FONT-PROPERTIES
  2732. FONT-PROPERTY
  2733. CHAR-LEFT-BEARING
  2734. CHAR-RIGHT-BEARING
  2735. CHAR-WIDTH
  2736. CHAR-ASCENT
  2737. CHAR-DESCENT
  2738. CHAR-ATTRIBUTES
  2739. MIN-CHAR-LEFT-BEARING
  2740. MIN-CHAR-RIGHT-BEARING
  2741. MIN-CHAR-WIDTH
  2742. MIN-CHAR-ASCENT
  2743. MIN-CHAR-DESCENT
  2744. MIN-CHAR-ATTRIBUTES
  2745. MAX-CHAR-LEFT-BEARING
  2746. MAX-CHAR-RIGHT-BEARING
  2747. MAX-CHAR-WIDTH
  2748. MAX-CHAR-ASCENT
  2749. MAX-CHAR-DESCENT
  2750. MAX-CHAR-ATTRIBUTES
  2751. QueryKeymap QUERY-KEYMAP
  2752. QueryPointer GLOBAL-POINTER-POSITION
  2753. QueryPointer POINTER-POSITION
  2754. QueryPointer QUERY-POINTER
  2755. QueryTextExtents TEXT-EXTENTS
  2756. QueryTextExtents TEXT-WIDTH
  2757. QueryTree QUERY-TREE
  2758. RecolorCursor RECOLOR-CURSOR
  2759. ReparentWindow REPARENT-WINDOW
  2760. RotateProperties ROTATE-PROPERTIES
  2761. SendEvent SEND-EVENT
  2762. SetClipRectangles FORCE-GCONTEXT-CHANGES
  2763. ;; See WITH-GCONTEXT
  2764. (setf (gcontext-clip-x gc) int16)
  2765. (setf (gcontext-clip-y gc) int16)
  2766. (setf (gcontext-clip-mask gc &optional ordering)
  2767. (or (member :none) pixmap rect-seq))
  2768. (setf (gcontext-clip-ordering gc) keyword)
  2769. SetDashes FORCE-GCONTEXT-CHANGES
  2770. ;; See WITH-GCONTEXT
  2771. (setf (gcontext-dash-offset gc) card16)
  2772. (setf (gcontext-dashes gc) (or card8 sequence))
  2773. SetFontPath
  2774. (setf (font-path font) paths)
  2775. Where paths is (type (clx-sequence (or string pathname)))
  2776. SetInputFocus SET-INPUT-FOCUS
  2777. SetKeyboardMapping CHANGE-KEYBOARD-MAPPING
  2778. SetModifierMapping SET-MODIFIER-MAPPING
  2779. SetPointerMapping SET-POINTER-MAPPING
  2780. SetScreenSaver SET-SCREEN-SAVER
  2781. SetSelectionOwner SET-SELECTION-OWNER
  2782. StoreColors STORE-COLOR
  2783. StoreColors STORE-COLORS
  2784. StoreNamedColor STORE-COLOR
  2785. StoreNamedColor STORE-COLORS
  2786. TranslateCoords TRANSLATE-COORDINATES
  2787. UngrabButton UNGRAB-BUTTON
  2788. UngrabKey UNGRAB-KEY
  2789. UngrabKeyboard UNGRAB-KEYBOARD
  2790. UngrabPointer UNGRAB-POINTER
  2791. UngrabServer UNGRAB-SERVER
  2792. UninstallColormap UNINSTALL-COLORMAP
  2793. UnmapSubwindows UNMAP-SUBWINDOWS
  2794. UnmapWindow UNMAP-WINDOW
  2795. WarpPointer WARP-POINTER
  2796. WarpPointer WARP-POINTER-IF-INSIDE
  2797. WarpPointer WARP-POINTER-RELATIVE
  2798. WarpPointer WARP-POINTER-RELATIVE-IF-INSIDE
  2799. NoOperation NO-OPERATION
  2800. X11 Request Name CLX Function Name
  2801. ----------------- -----------------
  2802. ListHosts ACCESS-CONTROL
  2803. ListHosts ACCESS-HOSTS
  2804. ForceScreenSaver ACTIVATE-SCREEN-SAVER
  2805. ChangeHosts ADD-ACCESS-HOST
  2806. ChangeSaveSet ADD-TO-SAVE-SET
  2807. AllocColor ALLOC-COLOR
  2808. AllocNamedColor ALLOC-COLOR
  2809. AllocColorCells ALLOC-COLOR-CELLS
  2810. AllocColorPlanes ALLOC-COLOR-PLANES
  2811. AllowEvents ALLOW-EVENTS
  2812. GetAtomName ATOM-NAME
  2813. Bell BELL
  2814. ChangeActivePointerGrab CHANGE-ACTIVE-POINTER-GRAB
  2815. ChangeKeyboardControl CHANGE-KEYBOARD-CONTROL
  2816. SetKeyboardMapping CHANGE-KEYBOARD-MAPPING
  2817. ChangePointerControl CHANGE-POINTER-CONTROL
  2818. ChangeProperty CHANGE-PROPERTY
  2819. QueryFont CHAR-ASCENT
  2820. QueryFont CHAR-ATTRIBUTES
  2821. QueryFont CHAR-DESCENT
  2822. QueryFont CHAR-LEFT-BEARING
  2823. QueryFont CHAR-RIGHT-BEARING
  2824. QueryFont CHAR-WIDTH
  2825. CirculateWindow CIRCULATE-WINDOW-DOWN
  2826. CirculateWindow CIRCULATE-WINDOW-UP
  2827. ClearToBackground CLEAR-AREA
  2828. CloseFont CLOSE-FONT
  2829. ConvertSelection CONVERT-SELECTION
  2830. CopyArea COPY-AREA
  2831. CopyColormapAndFree COPY-COLORMAP-AND-FREE
  2832. CopyGC COPY-GCONTEXT
  2833. CopyGC COPY-GCONTEXT-COMPONENTS
  2834. CopyPlane COPY-PLANE
  2835. CreateColormap CREATE-COLORMAP
  2836. CreateCursor CREATE-CURSOR
  2837. CreateGC CREATE-GCONTEXT
  2838. CreateGlyphCursor CREATE-GLYPH-CURSOR
  2839. CreatePixmap CREATE-PIXMAP
  2840. CreateWindow CREATE-WINDOW
  2841. DeleteProperty DELETE-PROPERTY
  2842. DestroySubwindows DESTROY-SUBWINDOWS
  2843. DestroyWindow DESTROY-WINDOW
  2844. PolyArc DRAW-ARC
  2845. PolyArc DRAW-ARCS
  2846. PolyText16 DRAW-GLYPH
  2847. PolyText16 DRAW-GLYPHS
  2848. PolyText8 DRAW-GLYPHS
  2849. ImageText16 DRAW-IMAGE-GLYPH
  2850. ImageText16 DRAW-IMAGE-GLYPHS
  2851. ImageText8 DRAW-IMAGE-GLYPHS
  2852. PolyLine DRAW-LINE
  2853. PolyLine DRAW-LINES
  2854. PolyPoint DRAW-POINT
  2855. PolyPoint DRAW-POINTS
  2856. PolyFillRectangle DRAW-RECTANGLE
  2857. PolyRectangle DRAW-RECTANGLE
  2858. PolyFillRectangle DRAW-RECTANGLES
  2859. PolyRectangle DRAW-RECTANGLES
  2860. PolySegment DRAW-SEGMENTS
  2861. GetGeometry DRAWABLE-BORDER-WIDTH
  2862. GetGeometry DRAWABLE-DEPTH
  2863. GetGeometry DRAWABLE-HEIGHT
  2864. GetGeometry DRAWABLE-ROOT
  2865. GetGeometry DRAWABLE-WIDTH
  2866. GetGeometry DRAWABLE-X
  2867. GetGeometry DRAWABLE-Y
  2868. FillPoly FILL-POLYGON
  2869. InternAtom FIND-ATOM
  2870. QueryFont FONT-ALL-CHARS-EXIST-P
  2871. QueryFont FONT-ASCENT
  2872. QueryFont FONT-DEFAULT-CHAR
  2873. QueryFont FONT-DESCENT
  2874. QueryFont FONT-DIRECTION
  2875. QueryFont FONT-MAX-BYTE1
  2876. QueryFont FONT-MAX-BYTE2
  2877. QueryFont FONT-MAX-CHAR
  2878. QueryFont FONT-MIN-BYTE1
  2879. QueryFont FONT-MIN-BYTE2
  2880. QueryFont FONT-MIN-CHAR
  2881. QueryFont FONT-NAME
  2882. QueryFont FONT-NAME
  2883. GetFontPath FONT-PATH
  2884. QueryFont FONT-PROPERTIES
  2885. QueryFont FONT-PROPERTY
  2886. ChangeGC FORCE-GCONTEXT-CHANGES
  2887. SetClipRectangles FORCE-GCONTEXT-CHANGES
  2888. SetDashes FORCE-GCONTEXT-CHANGES
  2889. FreeColormap FREE-COLORMAP
  2890. FreeColors FREE-COLORS
  2891. FreeCursor FREE-CURSOR
  2892. FreeGC FREE-GCONTEXT
  2893. FreePixmap FREE-PIXMAP
  2894. GetProperty GET-PROPERTY
  2895. GetImage GET-RAW-IMAGE
  2896. QueryPointer GLOBAL-POINTER-POSITION
  2897. GrabButton GRAB-BUTTON
  2898. GrabKey GRAB-KEY
  2899. GrabKeyboard GRAB-KEYBOARD
  2900. GrabPointer GRAB-POINTER
  2901. GrabServer GRAB-SERVER
  2902. GrabServer WITH-SERVER-GRABBED
  2903. GetInputFocus INPUT-FOCUS
  2904. InstallColormap INSTALL-COLORMAP
  2905. ListInstalledColormaps INSTALLED-COLORMAPS
  2906. InternAtom INTERN-ATOM
  2907. GetKeyboardControl KEYBOARD-CONTROL
  2908. GetKeyboardMapping KEYBOARD-MAPPING
  2909. KillClient KILL-CLIENT
  2910. KillClient KILL-TEMPORARY-CLIENTS
  2911. ListExtensions LIST-EXTENSIONS
  2912. ListFonts LIST-FONT-NAMES
  2913. ListFontsWithInfo LIST-FONTS
  2914. ListProperties LIST-PROPERTIES
  2915. LookupColor LOOKUP-COLOR
  2916. MapSubwindows MAP-SUBWINDOWS
  2917. MapWindow MAP-WINDOW
  2918. QueryFont MAX-CHAR-ASCENT
  2919. QueryFont MAX-CHAR-ATTRIBUTES
  2920. QueryFont MAX-CHAR-DESCENT
  2921. QueryFont MAX-CHAR-LEFT-BEARING
  2922. QueryFont MAX-CHAR-RIGHT-BEARING
  2923. QueryFont MAX-CHAR-WIDTH
  2924. QueryFont MIN-CHAR-ASCENT
  2925. QueryFont MIN-CHAR-ATTRIBUTES
  2926. QueryFont MIN-CHAR-DESCENT
  2927. QueryFont MIN-CHAR-LEFT-BEARING
  2928. QueryFont MIN-CHAR-RIGHT-BEARING
  2929. QueryFont MIN-CHAR-WIDTH
  2930. GetModifierMapping MODIFIER-MAPPING
  2931. GetMotionEvents MOTION-EVENTS
  2932. NoOperation NO-OPERATION
  2933. OpenFont OPEN-FONT
  2934. GetPointerControl POINTER-CONTROL
  2935. GetPointerMapping POINTER-MAPPING
  2936. QueryPointer POINTER-POSITION
  2937. PutImage PUT-RAW-IMAGE
  2938. QueryBestSize QUERY-BEST-CURSOR
  2939. QueryBestSize QUERY-BEST-STIPPLE
  2940. QueryBestSize QUERY-BEST-TILE
  2941. QueryColors QUERY-COLORS
  2942. QueryExtension QUERY-EXTENSION
  2943. QueryKeymap QUERY-KEYMAP
  2944. QueryPointer QUERY-POINTER
  2945. QueryTree QUERY-TREE
  2946. RecolorCursor RECOLOR-CURSOR
  2947. ChangeHosts REMOVE-ACCESS-HOST
  2948. ChangeSaveSet REMOVE-FROM-SAVE-SET
  2949. ReparentWindow REPARENT-WINDOW
  2950. ForceScreenSaver RESET-SCREEN-SAVER
  2951. RotateProperties ROTATE-PROPERTIES
  2952. GetScreenSaver SCREEN-SAVER
  2953. GetSelectionOwner SELECTION-OWNER
  2954. SendEvent SEND-EVENT
  2955. ChangeAccessControl SET-ACCESS-CONTROL
  2956. ChangeCloseDownMode SET-CLOSE-DOWN-MODE
  2957. SetInputFocus SET-INPUT-FOCUS
  2958. SetModifierMapping SET-MODIFIER-MAPPING
  2959. SetPointerMapping SET-POINTER-MAPPING
  2960. SetScreenSaver SET-SCREEN-SAVER
  2961. SetSelectionOwner SET-SELECTION-OWNER
  2962. StoreColors STORE-COLOR
  2963. StoreColors STORE-COLORS
  2964. StoreNamedColor STORE-COLOR
  2965. StoreNamedColor STORE-COLORS
  2966. QueryTextExtents TEXT-EXTENTS
  2967. QueryTextExtents TEXT-WIDTH
  2968. TranslateCoords TRANSLATE-COORDINATES
  2969. UngrabButton UNGRAB-BUTTON
  2970. UngrabKey UNGRAB-KEY
  2971. UngrabKeyboard UNGRAB-KEYBOARD
  2972. UngrabPointer UNGRAB-POINTER
  2973. UngrabServer UNGRAB-SERVER
  2974. UngrabServer WITH-SERVER-GRABBED
  2975. UninstallColormap UNINSTALL-COLORMAP
  2976. UnmapSubwindows UNMAP-SUBWINDOWS
  2977. UnmapWindow UNMAP-WINDOW
  2978. WarpPointer WARP-POINTER
  2979. WarpPointer WARP-POINTER-IF-INSIDE
  2980. WarpPointer WARP-POINTER-RELATIVE
  2981. WarpPointer WARP-POINTER-RELATIVE-IF-INSIDE
  2982. GetWindowAttributes WINDOW-ALL-EVENT-MASKS
  2983. GetWindowAttributes WINDOW-BACKING-PIXEL
  2984. GetWindowAttributes WINDOW-BACKING-PLANES
  2985. GetWindowAttributes WINDOW-BACKING-STORE
  2986. GetWindowAttributes WINDOW-BIT-GRAVITY
  2987. GetWindowAttributes WINDOW-CLASS
  2988. GetWindowAttributes WINDOW-COLORMAP
  2989. GetWindowAttributes WINDOW-COLORMAP-INSTALLED-P
  2990. GetWindowAttributes WINDOW-DO-NOT-PROPAGATE-MASK
  2991. GetWindowAttributes WINDOW-EVENT-MASK
  2992. GetWindowAttributes WINDOW-GRAVITY
  2993. GetWindowAttributes WINDOW-MAP-STATE
  2994. GetWindowAttributes WINDOW-OVERRIDE-REDIRECT
  2995. GetWindowAttributes WINDOW-SAVE-UNDER
  2996. GetWindowAttributes WINDOW-VISUAL-INFO
  2997. ConfigureWindow (SETF (DRAWABLE-BORDER-WIDTH DRAWABLE) INTEGER)
  2998. ConfigureWindow (SETF (DRAWABLE-DEPTH DRAWABLE) INTEGER)
  2999. ConfigureWindow (SETF (DRAWABLE-HEIGHT DRAWABLE) INTEGER)
  3000. ConfigureWindow (SETF (DRAWABLE-WIDTH DRAWABLE) INTEGER)
  3001. ConfigureWindow (SETF (DRAWABLE-X DRAWABLE) INTEGER)
  3002. ConfigureWindow (SETF (DRAWABLE-Y DRAWABLE) INTEGER)
  3003. SetFontPath (SETF (FONT-PATH FONT) PATHS)
  3004. ChangeGC (SETF (GCONTEXT-ARC-MODE GC) (MEMBER CHORD PIE-SLICE))
  3005. ChangeGC (SETF (GCONTEXT-BACKGROUND GC) CARD32)
  3006. ChangeGC (SETF (GCONTEXT-CAP-STYLE GC) KEYWORD)
  3007. SetClipRectangles (SETF (GCONTEXT-CLIP-MASK GC &OPTIONAL ORDERING)
  3008. (OR (MEMBER NONE) PIXMAP RECT-SEQ))
  3009. SetClipRectangles (SETF (GCONTEXT-CLIP-ORDERING GC) KEYWORD)
  3010. SetClipRectangles (SETF (GCONTEXT-CLIP-X GC) INT16)
  3011. SetClipRectangles (SETF (GCONTEXT-CLIP-Y GC) INT16)
  3012. SetDashes (SETF (GCONTEXT-DASH-OFFSET GC) CARD16)
  3013. SetDashes (SETF (GCONTEXT-DASHES GC) (OR CARD8 SEQUENCE))
  3014. ChangeGC (SETF (GCONTEXT-EXPOSURES GC) (MEMBER ON OFF))
  3015. ChangeGC (SETF (GCONTEXT-FILL-RULE GC) KEYWORD)
  3016. ChangeGC (SETF (GCONTEXT-FILL-STYLE GC) KEYWORD)
  3017. ChangeGC (SETF (GCONTEXT-FONT GC &OPTIONAL METRICS-P) FONT)
  3018. ChangeGC (SETF (GCONTEXT-FOREGROUND GC) CARD32)
  3019. ChangeGC (SETF (GCONTEXT-FUNCTION GC) BOOLE-CONSTANT)
  3020. ChangeGC (SETF (GCONTEXT-JOIN-STYLE GC) KEYWORD)
  3021. ChangeGC (SETF (GCONTEXT-LINE-STYLE GC) KEYWORD)
  3022. ChangeGC (SETF (GCONTEXT-LINE-WIDTH GC) CARD16)
  3023. ChangeGC (SETF (GCONTEXT-PLANE-MASK GC) CARD32)
  3024. ChangeGC (SETF (GCONTEXT-STIPPLE GC) PIXMAP)
  3025. ChangeGC (SETF (GCONTEXT-SUBWINDOW-MODE GC) KEYWORD)
  3026. ChangeGC (SETF (GCONTEXT-TILE GC) PIXMAP)
  3027. ChangeGC (SETF (GCONTEXT-TS-X GC) INT16)
  3028. ChangeGC (SETF (GCONTEXT-TS-Y GC) INT16)
  3029. ChangeWindowAttributes (SETF (WINDOW-BACKGROUND WINDOW) VALUE)
  3030. ChangeWindowAttributes (SETF (WINDOW-BACKING-PIXEL WINDOW) VALUE)
  3031. ChangeWindowAttributes (SETF (WINDOW-BACKING-PLANES WINDOW) VALUE)
  3032. ChangeWindowAttributes (SETF (WINDOW-BACKING-STORE WINDOW) VALUE)
  3033. ChangeWindowAttributes (SETF (WINDOW-BIT-GRAVITY WINDOW) VALUE)
  3034. ChangeWindowAttributes (SETF (WINDOW-BORDER WINDOW) VALUE)
  3035. ChangeWindowAttributes (SETF (WINDOW-COLORMAP WINDOW) VALUE)
  3036. ChangeWindowAttributes (SETF (WINDOW-CURSOR WINDOW) VALUE)
  3037. ChangeWindowAttributes (SETF (WINDOW-DO-NOT-PROPAGATE-MASK WINDOW) VALUE)
  3038. ChangeWindowAttributes (SETF (WINDOW-EVENT-MASK WINDOW) VALUE)
  3039. ChangeWindowAttributes (SETF (WINDOW-GRAVITY WINDOW) VALUE)
  3040. ChangeWindowAttributes (SETF (WINDOW-OVERRIDE-REDIRECT WINDOW) VALUE)
  3041. ConfigureWindow (SETF (WINDOW-PRIORITY WINDOW &OPTIONAL SIBLING) INTEGER)
  3042. ChangeWindowAttributes (SETF (WINDOW-SAVE-UNDER WINDOW) VALUE)
  3043. ;; Here's a list of the CLX functions that don't directly correspond to
  3044. ;; X Window System requests. The've been categorized by function:
  3045. ;Display Management
  3046. CLOSE-DISPLAY
  3047. CLOSE-DOWN-MODE
  3048. DISPLAY-AFTER-FUNCTION ;; SETF'able
  3049. DISPLAY-FINISH-OUTPUT
  3050. DISPLAY-FORCE-OUTPUT
  3051. DISPLAY-INVOKE-AFTER-FUNCTION
  3052. OPEN-DISPLAY
  3053. WITH-DISPLAY
  3054. WITH-EVENT-QUEUE
  3055. ;Extensions
  3056. DECLARE-EVENT
  3057. DECODE-CORE-ERROR
  3058. DEFAULT-ERROR-HANDLER
  3059. DEFINE-CONDITION
  3060. DEFINE-ERROR
  3061. DEFINE-EXTENSION
  3062. DEFINE-GCONTEXT-ACCESSOR
  3063. EXTENSION-OPCODE
  3064. ;Events
  3065. EVENT-CASE
  3066. EVENT-LISTEN
  3067. MAPPING-NOTIFY
  3068. PROCESS-EVENT
  3069. EVENT-HANDLER
  3070. MAKE-EVENT-HANDLERS
  3071. QUEUE-EVENT
  3072. ;Image
  3073. COPY-IMAGE
  3074. CREATE-IMAGE
  3075. GET-IMAGE
  3076. IMAGE-BLUE-MASK
  3077. IMAGE-DEPTH
  3078. IMAGE-GREEN-MASK
  3079. IMAGE-HEIGHT
  3080. IMAGE-NAME
  3081. IMAGE-PIXMAP
  3082. IMAGE-PLIST
  3083. IMAGE-RED-MASK
  3084. IMAGE-WIDTH
  3085. IMAGE-X-HOT
  3086. IMAGE-Y-HOT
  3087. PUT-IMAGE
  3088. READ-BITMAP-FILE
  3089. WRITE-BITMAP-FILE
  3090. ;Keysyms
  3091. CHARACTER->KEYSYMS
  3092. CHARACTER-IN-MAP-P
  3093. DEFAULT-KEYSYM-INDEX
  3094. DEFAULT-KEYSYM-TRANSLATE
  3095. DEFINE-KEYSYM
  3096. DEFINE-KEYSYM-SET
  3097. KEYCODE->CHARACTER
  3098. KEYCODE->KEYSYM
  3099. KEYSYM
  3100. KEYSYM->CHARACTER
  3101. KEYSYM-IN-MAP-P
  3102. KEYSYM-SET
  3103. UNDEFINE-KEYSYM
  3104. ;Properties
  3105. CUT-BUFFER
  3106. GET-STANDARD-COLORMAP
  3107. GET-WM-CLASS
  3108. ICON-SIZES
  3109. MAKE-WM-HINTS
  3110. MAKE-WM-SIZE-HINTS
  3111. ROTATE-CUT-BUFFERS
  3112. SET-STANDARD-COLORMAP
  3113. SET-WM-CLASS
  3114. TRANSIENT-FOR
  3115. WM-CLIENT-MACHINE
  3116. WM-COMMAND
  3117. WM-HINTS
  3118. WM-HINTS-FLAGS
  3119. WM-HINTS-ICON-MASK
  3120. WM-HINTS-ICON-PIXMAP
  3121. WM-HINTS-ICON-WINDOW
  3122. WM-HINTS-ICON-X
  3123. WM-HINTS-ICON-Y
  3124. WM-HINTS-INITIAL-STATE
  3125. WM-HINTS-INPUT
  3126. WM-HINTS-P
  3127. WM-HINTS-WINDOW-GROUP
  3128. WM-ICON-NAME
  3129. WM-NAME
  3130. WM-NORMAL-HINTS
  3131. WM-SIZE-HINTS-HEIGHT
  3132. WM-SIZE-HINTS-HEIGHT-INC
  3133. WM-SIZE-HINTS-MAX-ASPECT
  3134. WM-SIZE-HINTS-MAX-HEIGHT
  3135. WM-SIZE-HINTS-MAX-WIDTH
  3136. WM-SIZE-HINTS-MIN-ASPECT
  3137. WM-SIZE-HINTS-MIN-HEIGHT
  3138. WM-SIZE-HINTS-MIN-WIDTH
  3139. WM-SIZE-HINTS-P
  3140. WM-SIZE-HINTS-USER-SPECIFIED-POSITION-P
  3141. WM-SIZE-HINTS-USER-SPECIFIED-SIZE-P
  3142. WM-SIZE-HINTS-WIDTH
  3143. WM-SIZE-HINTS-WIDTH-INC
  3144. WM-SIZE-HINTS-X
  3145. WM-SIZE-HINTS-Y
  3146. WM-ZOOM-HINTS
  3147. ;Misc.
  3148. MAKE-COLOR
  3149. MAKE-EVENT-KEYS
  3150. MAKE-EVENT-MASK
  3151. MAKE-RESOURCE-DATABASE
  3152. MAKE-STATE-KEYS
  3153. MAKE-STATE-MASK
  3154. DISCARD-FONT-INFO
  3155. TRANSLATE-DEFAULT
  3156. ;Structures
  3157. BITMAP-FORMAT-LSB-FIRST-P
  3158. BITMAP-FORMAT-P
  3159. BITMAP-FORMAT-PAD
  3160. BITMAP-FORMAT-UNIT
  3161. BITMAP-IMAGE
  3162. COLOR-BLUE
  3163. COLOR-GREEN
  3164. COLOR-P
  3165. COLOR-RED
  3166. COLOR-RGB
  3167. COLORMAP-DISPLAY
  3168. COLORMAP-EQUAL
  3169. COLORMAP-ID
  3170. COLORMAP-P
  3171. COLORMAP-VISUAL-INFO
  3172. CURSOR-DISPLAY
  3173. CURSOR-EQUAL
  3174. CURSOR-ID
  3175. CURSOR-P
  3176. DRAWABLE-DISPLAY
  3177. DRAWABLE-EQUAL
  3178. DRAWABLE-ID
  3179. DRAWABLE-P
  3180. FONT-DISPLAY
  3181. FONT-EQUAL
  3182. FONT-ID
  3183. FONT-MAX-BOUNDS
  3184. FONT-MIN-BOUNDS
  3185. FONT-P
  3186. FONT-PLIST
  3187. GCONTEXT-DISPLAY
  3188. GCONTEXT-EQUAL
  3189. GCONTEXT-ID
  3190. GCONTEXT-P
  3191. GCONTEXT-PLIST
  3192. DISPLAY-AUTHORIZATION-DATA
  3193. DISPLAY-AUTHORIZATION-NAME
  3194. DISPLAY-BITMAP-FORMAT
  3195. DISPLAY-BYTE-ORDER
  3196. DISPLAY-DEFAULT-SCREEN
  3197. DISPLAY-DISPLAY
  3198. DISPLAY-ERROR-HANDLER
  3199. DISPLAY-IMAGE-LSB-FIRST-P
  3200. DISPLAY-KEYCODE-RANGE
  3201. DISPLAY-MAX-KEYCODE
  3202. DISPLAY-MAX-REQUEST-LENGTH
  3203. DISPLAY-MIN-KEYCODE
  3204. DISPLAY-MOTION-BUFFER-SIZE
  3205. DISPLAY-NSCREENS
  3206. DISPLAY-P
  3207. DISPLAY-PIXMAP-FORMATS
  3208. DISPLAY-PLIST
  3209. DISPLAY-PROTOCOL-MAJOR-VERSION
  3210. DISPLAY-PROTOCOL-MINOR-VERSION
  3211. DISPLAY-PROTOCOL-VERSION
  3212. DISPLAY-RELEASE-NUMBER
  3213. DISPLAY-RESOURCE-ID-BASE
  3214. DISPLAY-RESOURCE-ID-MASK
  3215. DISPLAY-ROOTS
  3216. DISPLAY-SQUISH
  3217. DISPLAY-VENDOR
  3218. DISPLAY-VENDOR-NAME
  3219. DISPLAY-VERSION-NUMBER
  3220. DISPLAY-XDEFAULTS
  3221. DISPLAY-XID
  3222. PIXMAP-DISPLAY
  3223. PIXMAP-EQUAL
  3224. PIXMAP-FORMAT-BITS-PER-PIXEL
  3225. PIXMAP-FORMAT-DEPTH
  3226. PIXMAP-FORMAT-P
  3227. PIXMAP-FORMAT-SCANLINE-PAD
  3228. PIXMAP-ID
  3229. PIXMAP-P
  3230. PIXMAP-PLIST
  3231. SCREEN-BACKING-STORES
  3232. SCREEN-BLACK-PIXEL
  3233. SCREEN-DEFAULT-COLORMAP
  3234. SCREEN-DEPTHS
  3235. SCREEN-EVENT-MASK-AT-OPEN
  3236. SCREEN-HEIGHT
  3237. SCREEN-HEIGHT-IN-MILLIMETERS
  3238. SCREEN-MAX-INSTALLED-MAPS
  3239. SCREEN-MIN-INSTALLED-MAPS
  3240. SCREEN-P
  3241. SCREEN-PLIST
  3242. SCREEN-ROOT
  3243. SCREEN-ROOT-DEPTH
  3244. SCREEN-ROOT-VISUAL-INFO
  3245. SCREEN-SAVE-UNDERS-P
  3246. SCREEN-WHITE-PIXEL
  3247. SCREEN-WIDTH
  3248. SCREEN-WIDTH-IN-MILLIMETERS
  3249. VISUAL-INFO
  3250. VISUAL-INFO-BITS-PER-RGB
  3251. VISUAL-INFO-BLUE-MASK
  3252. VISUAL-INFO-CLASS
  3253. VISUAL-INFO-COLORMAP-ENTRIES
  3254. VISUAL-INFO-GREEN-MASK
  3255. VISUAL-INFO-ID
  3256. VISUAL-INFO-P
  3257. VISUAL-INFO-PLIST
  3258. VISUAL-INFO-RED-MASK
  3259. WINDOW-DISPLAY
  3260. WINDOW-EQUAL
  3261. WINDOW-ID
  3262. WINDOW-P
  3263. WINDOW-PLIST