summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/avoid.el27
2 files changed, 20 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 68da7842fbd..dc35d035076 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -4,6 +4,9 @@
2000-11-23 Gerd Moellmann <gerd@gnu.org>
+ * avoid.el (mouse-avoidance-too-close-p): Return nil if mouse
+ is in the tool bar.
+
* dired-aux.el (dired-add-entry): Don't call dired-get-filename
with `no-dir'; we want the directory part to be able to remove
it.
diff --git a/lisp/avoid.el b/lisp/avoid.el
index 1f01eced204..2aa2b28f1c3 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -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 <boris@gnu.org>
;; Keywords: mouse
@@ -173,15 +173,22 @@ Analogous to mouse-position."
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.