/usr/share/common-lisp/source/clx/shape.lisp is in cl-clx-sbcl 0.7.4.20160323-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: XLIB; -*-
;;; ---------------------------------------------------------------------------
;;; Title: X11 Shape extension
;;; Created: 1999-05-14 11:31
;;; Author: Gilbert Baumann <unk6@rz.uni-karlsruhe.de>
;;; ---------------------------------------------------------------------------
;;; (c) copyright 1999 by Gilbert Baumann
;;;
;;; Permission is granted to any individual or institution to use,
;;; copy, modify, and distribute this software, provided that this
;;; complete copyright and permission notice is maintained, intact, in
;;; all copies and supporting documentation.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;;;
;;; Use xc/doc/hardcopy/Xext/shape.PS.gz obtainable from e.g.
;; ftp://ftp.xfree86.org/pub/XFree86/current/untarred/xc/hardcopy/Xext/shape.PS.gz
(in-package :xlib)
(export '(shape-query-version
shape-rectangles
shape-mask
shape-combine
shape-offset
shape-query-extents
shape-select-input
shape-input-selected-p
shape-get-rectangles)
:xlib)
(define-extension "SHAPE"
:events (:shape-notify))
(declare-event :shape-notify
((data (member8 :bounding :clip)) kind) ;shape kind
(card16 sequence)
(window (window event-window)) ;affected window
(int16 x) ;extents
(int16 y)
(card16 width)
(card16 height)
((or null card32) time) ;timestamp
(boolean shaped-p))
(defun encode-shape-kind (kind)
(ecase kind
(:bounding 0)
(:clip 1)))
(defun encode-shape-operation (operation)
(ecase operation
(:set 0)
(:union 1)
(:interset 2)
(:subtract 3)
(:invert 4)))
(defun encode-shape-rectangle-ordering (ordering)
(ecase ordering
((:unsorted :un-sorted nil) 0)
((:y-sorted) 1)
((:yx-sorted) 2)
((:yx-banded) 3)))
(defun shape-query-version (display)
(with-buffer-request-and-reply (display (extension-opcode display "SHAPE")
nil :sizes 16)
((data 0))
(values
(card16-get 8)
(card16-get 10))))
(defun shape-rectangles (window rectangles
&key (kind :bounding)
(x-offset 0)
(y-offset 0)
(operation :set)
(ordering :unsorted))
(let* ((display (xlib:window-display window)))
(with-buffer-request (display (extension-opcode display "SHAPE"))
(data 1)
(card8 (encode-shape-operation operation))
(card8 (encode-shape-kind kind))
(card8 (encode-shape-rectangle-ordering ordering))
(card8 0) ;unused
(window window)
(int16 x-offset)
(int16 y-offset)
((sequence :format int16) rectangles))))
(defun shape-mask (window pixmap
&key (kind :bounding)
(x-offset 0)
(y-offset 0)
(operation :set))
(let* ((display (xlib:window-display window)))
(with-buffer-request (display (extension-opcode display "SHAPE"))
(data 2)
(card8 (encode-shape-operation operation))
(card8 (encode-shape-kind kind))
(card16 0) ;unused
(window window)
(int16 x-offset)
(int16 y-offset)
((or pixmap (member :none)) pixmap))))
(defun shape-combine (window source-window
&key (kind :bounding)
(source-kind :bounding)
(x-offset 0)
(y-offset 0)
(operation :set))
(let* ((display (xlib:window-display window)))
(with-buffer-request (display (extension-opcode display "SHAPE"))
(data 3)
(card8 (encode-shape-operation operation))
(card8 (encode-shape-kind kind))
(card8 (encode-shape-kind source-kind))
(card8 0) ;unused
(window window)
(int16 x-offset)
(int16 y-offset)
(window source-window))))
(defun shape-offset (window &key (kind :bounding) (x-offset 0) (y-offset 0))
(let* ((display (xlib:window-display window)))
(with-buffer-request (display (extension-opcode display "SHAPE"))
(data 4)
(card8 (encode-shape-kind kind))
(card8 0) (card8 0) (card8 0) ;unused
(window window)
(int16 x-offset)
(int16 y-offset))))
(defun shape-query-extents (window)
(let* ((display (xlib:window-display window)))
(with-buffer-request-and-reply (display (extension-opcode display "SHAPE")
nil :sizes (8 16 32))
((data 5)
(window window))
(values
(boolean-get 8) ;bounding shaped
(boolean-get 9) ;clip shaped
(int16-get 12) ;bounding shape extents x
(int16-get 14) ;bounding shape extents y
(card16-get 16) ;bounding shape extents width
(card16-get 18) ;bounding shape extents height
(int16-get 20) ;clip shape extents x
(int16-get 22) ;clip shape extents y
(card16-get 24) ;clip shape extents width
(card16-get 26))))) ;clip shape extents height
(defun shape-select-input (window selected-p)
(let* ((display (window-display window)))
(with-buffer-request (display (extension-opcode display "SHAPE"))
(data 6)
(window window)
(boolean selected-p)) ))
(defun shape-input-selected-p (window)
(let* ((display (window-display window)))
(with-buffer-request-and-reply (display (extension-opcode display "SHAPE")
nil :sizes (8))
((data 7) ;also wrong in documentation
(window window))
(boolean-get 1))))
(defun shape-get-rectangles (window &optional (kind :bounding)
(result-type 'list))
(let* ((display (window-display window)))
(with-buffer-request-and-reply (display (extension-opcode display "SHAPE")
nil :sizes (8 16 32))
((data 8) ;this was wrong in the specification
(window window)
(card8 (ecase kind
(:bounding 0)
(:clip 1))))
(values
(sequence-get :length (print (* 4 (card32-get 8)))
:result-type result-type
:format int16
:index +replysize+)
(ecase (card8-get 1)
(0 :unsorted)
(1 :y-sorted)
(2 :yx-sorted)
(3 :yx-banded) )))))
|