;;;* Last edited: Sep  8 10:28 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.  



;;; Move standard control mouse bindings to shift mouse
(global-set-key [S-down-mouse-1] 'mouse-set-font)
(global-set-key [S-down-mouse-2] 'facemenu-menu)
(global-set-key [S-down-mouse-3] 'mouse-major-mode-menu)

;;; Bind this stuff to control mouse
(global-set-key [C-down-mouse-1] 'mouse-adjust-down)
(global-set-key [C-down-mouse-2] 'noop)
(global-set-key [C-down-mouse-3] 'mouse-adjust-up)

(global-set-key [C-mouse-1] 'noop)
(global-set-key [C-mouse-2] 'noop)
(global-set-key [C-mouse-3] 'noop)

;;;(global-set-key [C-mouse-1] 'mouse-adjust-down)
;;;(global-set-key [C-mouse-3] 'mouse-adjust-up)

(defun noop ()
  (interactive))

(defun event-y (event) (cdr (third (cadr event))))

(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 ((posn (event-end event))
	(current-window (selected-window)))
    (select-window (posn-window posn))
    (scroll-up (cdr (posn-col-row posn)))
    (select-window current-window)))


(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 ((posn (event-end event))
	(current-window (selected-window)))
    (select-window (posn-window posn))
    (scroll-up (- (cdr (posn-col-row posn)) (window-height) -2))
    (select-window current-window)))

;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
