Mercurial > emacs
comparison lisp/mouse.el @ 7932:ac4b606bcfa2
(mouse-scroll-subr): New arg WINDOW.
(mouse-drag-region, mouse-drag-secondary): Pass new arg.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 17 Jun 1994 00:51:33 +0000 |
parents | 28f9608f3c58 |
children | 76118755a179 |
comparison
equal
deleted
inserted
replaced
7931:359834d749db | 7932:ac4b606bcfa2 |
---|---|
155 this many seconds between scroll steps. Scrolling stops when you move | 155 this many seconds between scroll steps. Scrolling stops when you move |
156 the mouse back into the window, or release the button. | 156 the mouse back into the window, or release the button. |
157 This variable's value may be non-integral. | 157 This variable's value may be non-integral. |
158 Setting this to zero causes Emacs to scroll as fast as it can.") | 158 Setting this to zero causes Emacs to scroll as fast as it can.") |
159 | 159 |
160 (defun mouse-scroll-subr (jump &optional overlay start) | 160 (defun mouse-scroll-subr (window jump &optional overlay start) |
161 "Scroll the selected window JUMP lines at a time, until new input arrives. | 161 "Scroll the window WINDOW, JUMP lines at a time, until new input arrives. |
162 If OVERLAY is an overlay, let it stretch from START to the far edge of | 162 If OVERLAY is an overlay, let it stretch from START to the far edge of |
163 the newly visible text. | 163 the newly visible text. |
164 Upon exit, point is at the far edge of the newly visible text." | 164 Upon exit, point is at the far edge of the newly visible text." |
165 (while (progn | 165 (while (progn |
166 (goto-char (window-start)) | 166 (goto-char (window-start window)) |
167 (if (not (zerop (vertical-motion jump))) | 167 (if (not (zerop (vertical-motion jump window))) |
168 (progn | 168 (progn |
169 (set-window-start (selected-window) (point)) | 169 (set-window-start window (point)) |
170 (if (natnump jump) | 170 (if (natnump jump) |
171 (progn | 171 (progn |
172 (goto-char (window-end (selected-window))) | 172 (goto-char (window-end window)) |
173 ;; window-end doesn't reflect the window's new | 173 ;; window-end doesn't reflect the window's new |
174 ;; start position until the next redisplay. Hurrah. | 174 ;; start position until the next redisplay. Hurrah. |
175 (vertical-motion (1- jump))) | 175 (vertical-motion (1- jump) window)) |
176 (goto-char (window-start (selected-window)))) | 176 (goto-char (window-start window))) |
177 (if overlay | 177 (if overlay |
178 (move-overlay overlay start (point))) | 178 (move-overlay overlay start (point))) |
179 (if (not (eobp)) | 179 (if (not (eobp)) |
180 (sit-for mouse-scroll-delay)))))) | 180 (sit-for mouse-scroll-delay)))))) |
181 (point)) | 181 (point)) |
236 (t | 236 (t |
237 (let ((mouse-row (cdr (cdr (mouse-position))))) | 237 (let ((mouse-row (cdr (cdr (mouse-position))))) |
238 (cond | 238 (cond |
239 ((null mouse-row)) | 239 ((null mouse-row)) |
240 ((< mouse-row top) | 240 ((< mouse-row top) |
241 (mouse-scroll-subr | 241 (mouse-scroll-subr start-window (- mouse-row top) |
242 (- mouse-row top) mouse-drag-overlay start-point)) | 242 mouse-drag-overlay start-point)) |
243 ((and (not (eobp)) | 243 ((and (not (eobp)) |
244 (>= mouse-row bottom)) | 244 (>= mouse-row bottom)) |
245 (mouse-scroll-subr (1+ (- mouse-row bottom)) | 245 (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) |
246 mouse-drag-overlay start-point))))))))) | 246 mouse-drag-overlay start-point))))))))) |
247 | 247 |
248 (if (and (eq (get (event-basic-type event) 'event-kind) 'mouse-click) | 248 (if (and (eq (get (event-basic-type event) 'event-kind) 'mouse-click) |
249 (eq (posn-window (event-end event)) start-window) | 249 (eq (posn-window (event-end event)) start-window) |
250 (numberp (posn-point (event-end event)))) | 250 (numberp (posn-point (event-end event)))) |
633 (t | 633 (t |
634 (let ((mouse-row (cdr (cdr (mouse-position))))) | 634 (let ((mouse-row (cdr (cdr (mouse-position))))) |
635 (cond | 635 (cond |
636 ((null mouse-row)) | 636 ((null mouse-row)) |
637 ((< mouse-row top) | 637 ((< mouse-row top) |
638 (mouse-scroll-subr | 638 (mouse-scroll-subr start-window (- mouse-row top) |
639 (- mouse-row top) mouse-secondary-overlay start-point)) | 639 mouse-secondary-overlay start-point)) |
640 ((and (not (eobp)) | 640 ((and (not (eobp)) |
641 (>= mouse-row bottom)) | 641 (>= mouse-row bottom)) |
642 (mouse-scroll-subr (1+ (- mouse-row bottom)) | 642 (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) |
643 mouse-secondary-overlay start-point))))))))) | 643 mouse-secondary-overlay start-point))))))))) |
644 | 644 |
645 (if (and (eq (get (event-basic-type event) 'event-kind) 'mouse-click) | 645 (if (and (eq (get (event-basic-type event) 'event-kind) 'mouse-click) |
646 (eq (posn-window (event-end event)) start-window) | 646 (eq (posn-window (event-end event)) start-window) |
647 (numberp (posn-point (event-end event)))) | 647 (numberp (posn-point (event-end event)))) |