X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/187bd11cd3543eeb0fbe4524b69576bfba30afc2..a53692379f6caed5e6d1686a1933914751dd64fe:/lisp/avoid.el diff --git a/lisp/avoid.el b/lisp/avoid.el index 1f01eced20..5a5a09622c 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 ;; Keywords: mouse @@ -131,8 +131,9 @@ Only applies in mouse-avoidance-modes `animate' and `jump'." (defsubst mouse-avoidance-set-pointer-shape (shape) "Set the shape of the mouse pointer to SHAPE." - (setq x-pointer-shape shape) - (set-mouse-color nil)) + (when (boundp 'x-pointer-shape) + (setq x-pointer-shape shape) + (set-mouse-color nil))) (defun mouse-avoidance-point-position () "Return the position of point as (FRAME X . Y). @@ -173,15 +174,24 @@ 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))) + (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)))))) (defun mouse-avoidance-banish-destination () "The position to which mouse-avoidance-mode `banish' moves the mouse. @@ -379,7 +389,8 @@ definition of \"random distance\".)" (run-with-idle-timer 0.1 t 'mouse-avoidance-fancy-hook)) (setq mouse-avoidance-mode mode mouse-avoidance-state (cons 0 0) - mouse-avoidance-old-pointer-shape x-pointer-shape)) + mouse-avoidance-old-pointer-shape + (and (boundp 'x-pointer-shape) x-pointer-shape))) ((eq mode 'exile) (setq mouse-avoidance-timer (run-with-idle-timer 0.1 t 'mouse-avoidance-exile-hook)) @@ -405,4 +416,5 @@ definition of \"random distance\".)" (if mouse-avoidance-mode (mouse-avoidance-mode mouse-avoidance-mode)) +;;; arch-tag: 64ad4ef8-a870-4183-8d96-3aa93b7a6800 ;;; avoid.el ends here