# HG changeset patch # User Gerd Moellmann # Date 974989279 0 # Node ID 19c8badbcb1505ce27e82e6fe0231914c47a5b28 # Parent 8ed6e47891a686a1564a2c28435a717b3747837f (mouse-avoidance-too-close-p): Return nil if mouse is in the tool bar. diff -r 8ed6e47891a6 -r 19c8badbcb15 lisp/avoid.el --- a/lisp/avoid.el Thu Nov 23 14:03:22 2000 +0000 +++ b/lisp/avoid.el Thu Nov 23 14:21:19 2000 +0000 @@ -1,6 +1,6 @@ ;;; avoid.el --- make mouse pointer stay out of the way of editing -;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. +;;; Copyright (C) 1993, 1994, 2000 Free Software Foundation, Inc. ;; Author: Boris Goldowsky ;; Keywords: mouse @@ -173,15 +173,22 @@ t)) (defun mouse-avoidance-too-close-p (mouse) - ;; 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))) + (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)))))) (defun mouse-avoidance-banish-destination () "The position to which mouse-avoidance-mode `banish' moves the mouse.