- ;; Return t if mouse pointer and point cursor are too close.
- ;; Acceptable distance is defined by mouse-avoidance-threshold.
- (let ((point (mouse-avoidance-point-position)))
- (and (eq (car mouse) (car point))
- (car (cdr mouse))
- (< (abs (- (car (cdr mouse)) (car (cdr point))))
- mouse-avoidance-threshold)
- (< (abs (- (cdr (cdr mouse)) (cdr (cdr point))))
- mouse-avoidance-threshold))))
+ "Return t if mouse pointer and point cursor are too close.
+MOUSE is the current mouse position as returned by `mouse-position'.
+Acceptable distance is defined by `mouse-avoidance-threshold'."
+ (let* ((frame (car mouse))
+ (mouse-y (cdr (cdr mouse)))
+ (tool-bar-lines (frame-parameter nil 'tool-bar-lines)))
+ (or tool-bar-lines
+ (setq tool-bar-lines 0))
+ (if (and mouse-y (< mouse-y tool-bar-lines))
+ nil
+ (let ((point (mouse-avoidance-point-position))
+ (mouse-x (car (cdr mouse))))
+ (and (eq frame (car point))
+ (not (null mouse-x))
+ (< (abs (- mouse-x (car (cdr point))))
+ mouse-avoidance-threshold)
+ (< (abs (- mouse-y (cdr (cdr point))))
+ mouse-avoidance-threshold))))))