summaryrefslogtreecommitdiff
path: root/lisp/avoid.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-02-27 21:52:27 +0000
committerRichard M. Stallman <rms@gnu.org>1998-02-27 21:52:27 +0000
commitf2e6033d73ceebf4d889c9ba80529529bb2c07da (patch)
treeba82dba4f70aa9414d2f010d8321d12f9b1d91fa /lisp/avoid.el
parent33aa088183a963ce75192c46a76c3342aa0d005b (diff)
downloademacs-f2e6033d73ceebf4d889c9ba80529529bb2c07da.tar.gz
(mouse-avoidance-kbd-command): Function deleted.
(mouse-avoidance-fancy-hook, mouse-avoidance-exile-hook) (mouse-avoidance-banish-hook): Test whether last command was a mouse command of any kind.
Diffstat (limited to 'lisp/avoid.el')
-rw-r--r--lisp/avoid.el43
1 files changed, 21 insertions, 22 deletions
diff --git a/lisp/avoid.el b/lisp/avoid.el
index 1d80ed9f8c1..e9351844989 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -267,21 +267,30 @@ redefine this function to suit your own tastes."
(defun mouse-avoidance-banish-hook ()
(if (and (not executing-kbd-macro) ; don't check inside macro
- ;; Don't check while mouse is down.
+ ;; Don't do anything if last event was a mouse event.
(not (and (consp last-input-event)
(symbolp (car last-input-event))
- (memq 'down (event-modifiers (car last-input-event)))))
- (mouse-avoidance-kbd-command (this-command-keys)))
+ (let ((modifiers (event-modifiers (car last-input-event))))
+ (or (memq (car last-input-event)
+ '(mouse-movement scroll-bar-movement))
+ (memq 'click modifiers)
+ (memq 'drag modifiers)
+ (memq 'down modifiers))))))
(mouse-avoidance-banish-mouse)))
(defun mouse-avoidance-exile-hook ()
;; For exile mode, the state is nil when the mouse is in its normal
;; position, and set to the old mouse-position when the mouse is in exile.
(if (and (not executing-kbd-macro)
+ ;; Don't do anything if last event was a mouse event.
(not (and (consp last-input-event)
(symbolp (car last-input-event))
- (memq 'down (event-modifiers (car last-input-event)))))
- (mouse-avoidance-kbd-command (this-command-keys)))
+ (let ((modifiers (event-modifiers (car last-input-event))))
+ (or (memq (car last-input-event)
+ '(mouse-movement scroll-bar-movement))
+ (memq 'click modifiers)
+ (memq 'drag modifiers)
+ (memq 'down modifiers))))))
(let ((mp (mouse-position)))
(cond ((and (not mouse-avoidance-state)
(mouse-avoidance-too-close-p mp))
@@ -300,10 +309,15 @@ redefine this function to suit your own tastes."
(defun mouse-avoidance-fancy-hook ()
;; Used for the "fancy" modes, ie jump et al.
(if (and (not executing-kbd-macro) ; don't check inside macro
+ ;; Don't do anything if last event was a mouse event.
(not (and (consp last-input-event)
(symbolp (car last-input-event))
- (memq 'down (event-modifiers (car last-input-event)))))
- (mouse-avoidance-kbd-command (this-command-keys))
+ (let ((modifiers (event-modifiers (car last-input-event))))
+ (or (memq (car last-input-event)
+ '(mouse-movement scroll-bar-movement))
+ (memq 'click modifiers)
+ (memq 'drag modifiers)
+ (memq 'down modifiers)))))
(mouse-avoidance-too-close-p (mouse-position)))
(let ((old-pos (mouse-position)))
(mouse-avoidance-nudge-mouse)
@@ -311,21 +325,6 @@ redefine this function to suit your own tastes."
;; This should never happen.
(apply 'set-mouse-position old-pos)))))
-(defun mouse-avoidance-kbd-command (key)
- "Return t if the KEYSEQENCE is composed of keyboard events only.
-Return nil if there are any lists in the key sequence."
- (cond ((null key) nil) ; Null event seems to be
- ; returned occasionally.
- ((not (vectorp key)) t) ; Strings are keyboard events.
- ((catch 'done
- (let ((i 0)
- (l (length key)))
- (while (< i l)
- (if (listp (aref key i))
- (throw 'done nil))
- (setq i (1+ i))))
- t))))
-
;;;###autoload
(defun mouse-avoidance-mode (&optional mode)
"Set cursor avoidance mode to MODE.