;;;* Last edited: Jul 19 20:57 1995 (sw)

;;; This implements some mouse functionality that was inspired 
;;; by the "sun-mouse" bindings from when an emacs ran on
;;; a vax displaying on an early sun, which was used as 
;;; a network terminal.  


(global-set-key '(meta button3) 'mouse-adjust-up)
(global-set-key '(meta button1) 'mouse-adjust-down)

(defun mouse-adjust-up (event)
  "scroll the window the mouse hit so that the line that
was hit is at the top of the screen (if possible)"
  (interactive "@e")
  (let ((window (event-window event))
	(pos (event-point event)))
    (or window (error (gettext "not in a window")))
    (let ((rel-coords (coordinates-in-window-p 
		       (list (event-x event) (event-y event)) 
		       window)))
      (scroll-up (cadr rel-coords)))))

(defun mouse-adjust-down (event)
  "scroll the window the mouse hit so that the line that
was hit is at the bottom of the screen (if possible)"
  (interactive "@e")
  (let ((window (event-window event))
	(pos (event-point event)))
    (or window (error (gettext "not in a window")))
    (let ((rel-coords (coordinates-in-window-p 
		       (list (event-x event) (event-y event)) 
		       window)))
      (scroll-up (- (cadr rel-coords) (window-height) -2)))))

;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
