Function: mouse-avoidance-delta
mouse-avoidance-delta is a byte-compiled function defined in
avoid.el.gz.
Signature
(mouse-avoidance-delta CUR DELTA DIST VAR MIN MAX)
Source Code
;; Defined in /usr/src/emacs/lisp/avoid.el.gz
(defsubst mouse-avoidance-delta (cur delta dist var min max)
;; Decide how far to move in either dimension.
;; Args are the CURRENT location, the desired DELTA for
;; warp-conservation, the DISTANCE we like to move, the VARIABILITY
;; in distance allowed, and the MIN and MAX possible window positions.
;; Returns something as close to DELTA as possible within the constraints.
(let ((L1 (max (- min cur) (+ (- dist) (- var))))
(R1 (+ (- dist) var ))
(L2 (+ dist (- var)))
(R2 (min (- max cur) (+ dist var))))
(if (< R1 (- min cur)) (setq L1 nil R1 nil))
(if (> L2 (- max cur)) (setq L2 nil R2 nil))
(cond ((and L1 (< delta L1)) L1)
((and R1 (< delta R1)) delta)
((and R1 (< delta 0)) R1)
((and L2 (< delta L2)) L2)
((and R2 (< delta R2)) delta)
(R2)
((or R1 L2))
(t 0))))