comparison lisp/term/sun-mouse.el @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents cc15677e0335
children
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
135 (defconst sm::DoubleBits 64) ; Bit 7. 135 (defconst sm::DoubleBits 64) ; Bit 7.
136 (defconst sm::UpBits 128) ; Bit 8. 136 (defconst sm::UpBits 128) ; Bit 8.
137 137
138 ;;; All the useful code bits 138 ;;; All the useful code bits
139 (defmacro sm::hit-code (hit) 139 (defmacro sm::hit-code (hit)
140 (` (nth 0 (, hit)))) 140 `(nth 0 ,hit))
141 ;;; The button, or buttons if a chord. 141 ;;; The button, or buttons if a chord.
142 (defmacro sm::hit-button (hit) 142 (defmacro sm::hit-button (hit)
143 (` (logand sm::ButtonBits (nth 0 (, hit))))) 143 `(logand sm::ButtonBits (nth 0 ,hit)))
144 ;;; The shift, control, and meta flags. 144 ;;; The shift, control, and meta flags.
145 (defmacro sm::hit-shiftmask (hit) 145 (defmacro sm::hit-shiftmask (hit)
146 (` (logand sm::ShiftmaskBits (nth 0 (, hit))))) 146 `(logand sm::ShiftmaskBits (nth 0 ,hit)))
147 ;;; Set if a double click (but not a chord). 147 ;;; Set if a double click (but not a chord).
148 (defmacro sm::hit-double (hit) 148 (defmacro sm::hit-double (hit)
149 (` (logand sm::DoubleBits (nth 0 (, hit))))) 149 `(logand sm::DoubleBits (nth 0 ,hit)))
150 ;;; Set on button release (as opposed to button press). 150 ;;; Set on button release (as opposed to button press).
151 (defmacro sm::hit-up (hit) 151 (defmacro sm::hit-up (hit)
152 (` (logand sm::UpBits (nth 0 (, hit))))) 152 `(logand sm::UpBits (nth 0 ,hit)))
153 ;;; Screen x position. 153 ;;; Screen x position.
154 (defmacro sm::hit-x (hit) (list 'nth 1 hit)) 154 (defmacro sm::hit-x (hit) `(nth 1 ,hit))
155 ;;; Screen y position. 155 ;;; Screen y position.
156 (defmacro sm::hit-y (hit) (list 'nth 2 hit)) 156 (defmacro sm::hit-y (hit) `(nth 2 ,hit))
157 ;;; Milliseconds since last hit. 157 ;;; Milliseconds since last hit.
158 (defmacro sm::hit-delta (hit) (list 'nth 3 hit)) 158 (defmacro sm::hit-delta (hit) `(nth 3 ,hit))
159 159
160 (defmacro sm::hit-up-p (hit) ; A predicate. 160 (defmacro sm::hit-up-p (hit) ; A predicate.
161 (` (not (zerop (sm::hit-up (, hit)))))) 161 `(not (zerop (sm::hit-up ,hit))))
162 162
163 ;;; 163 ;;;
164 ;;; Loc accessors. for sm::window-xy 164 ;;; Loc accessors. for sm::window-xy
165 ;;; 165 ;;;
166 (defmacro sm::loc-w (loc) (list 'nth 0 loc)) 166 (defmacro sm::loc-w (loc) `(nth 0 ,loc))
167 (defmacro sm::loc-x (loc) (list 'nth 1 loc)) 167 (defmacro sm::loc-x (loc) `(nth 1 ,loc))
168 (defmacro sm::loc-y (loc) (list 'nth 2 loc)) 168 (defmacro sm::loc-y (loc) `(nth 2 ,loc))
169 169
170 ;;; this is used extensively by sun-fns.el 170 ;;; this is used extensively by sun-fns.el
171 ;;; 171 ;;;
172 (defmacro eval-in-window (window &rest forms) 172 (defmacro eval-in-window (window &rest forms)
173 "Switch to WINDOW, evaluate FORMS, return to original window." 173 "Switch to WINDOW, evaluate FORMS, return to original window."
174 (` (let ((OriginallySelectedWindow (selected-window))) 174 `(let ((OriginallySelectedWindow (selected-window)))
175 (unwind-protect 175 (unwind-protect
176 (progn 176 (progn
177 (select-window (, window)) 177 (select-window ,window)
178 (,@ forms)) 178 ,@forms)
179 (select-window OriginallySelectedWindow))))) 179 (select-window OriginallySelectedWindow))))
180 (put 'eval-in-window 'lisp-indent-function 1) 180 (put 'eval-in-window 'lisp-indent-function 1)
181 181
182 ;;; 182 ;;;
183 ;;; handy utility, generalizes window_loop 183 ;;; handy utility, generalizes window_loop
184 ;;; 184 ;;;
186 ;;; It's a macro (and does not evaluate its arguments). 186 ;;; It's a macro (and does not evaluate its arguments).
187 (defmacro eval-in-windows (form &optional yesmini) 187 (defmacro eval-in-windows (form &optional yesmini)
188 "Switches to each window and evaluates FORM. Optional argument 188 "Switches to each window and evaluates FORM. Optional argument
189 YESMINI says to include the minibuffer as a window. 189 YESMINI says to include the minibuffer as a window.
190 This is a macro, and does not evaluate its arguments." 190 This is a macro, and does not evaluate its arguments."
191 (` (let ((OriginallySelectedWindow (selected-window))) 191 `(let ((OriginallySelectedWindow (selected-window)))
192 (unwind-protect 192 (unwind-protect
193 (while (progn 193 (while (progn
194 (, form) 194 ,form
195 (not (eq OriginallySelectedWindow 195 (not (eq OriginallySelectedWindow
196 (select-window 196 (select-window
197 (next-window nil (, yesmini))))))) 197 (next-window nil ,yesmini))))))
198 (select-window OriginallySelectedWindow))))) 198 (select-window OriginallySelectedWindow))))
199 (put 'eval-in-window 'lisp-indent-function 0) 199 (put 'eval-in-window 'lisp-indent-function 0)
200 200
201 (defun move-to-loc (x y) 201 (defun move-to-loc (x y)
202 "Move cursor to window location X, Y. 202 "Move cursor to window location X, Y.
203 Handles wrapped and horizontally scrolled lines correctly." 203 Handles wrapped and horizontally scrolled lines correctly."