diff options
| author | Richard M. Stallman | 1998-02-27 21:52:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-02-27 21:52:27 +0000 |
| commit | f2e6033d73ceebf4d889c9ba80529529bb2c07da (patch) | |
| tree | ba82dba4f70aa9414d2f010d8321d12f9b1d91fa /lisp/avoid.el | |
| parent | 33aa088183a963ce75192c46a76c3342aa0d005b (diff) | |
| download | emacs-f2e6033d73ceebf4d889c9ba80529529bb2c07da.tar.gz emacs-f2e6033d73ceebf4d889c9ba80529529bb2c07da.zip | |
(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.el | 43 |
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." | |||
| 267 | 267 | ||
| 268 | (defun mouse-avoidance-banish-hook () | 268 | (defun mouse-avoidance-banish-hook () |
| 269 | (if (and (not executing-kbd-macro) ; don't check inside macro | 269 | (if (and (not executing-kbd-macro) ; don't check inside macro |
| 270 | ;; Don't check while mouse is down. | 270 | ;; Don't do anything if last event was a mouse event. |
| 271 | (not (and (consp last-input-event) | 271 | (not (and (consp last-input-event) |
| 272 | (symbolp (car last-input-event)) | 272 | (symbolp (car last-input-event)) |
| 273 | (memq 'down (event-modifiers (car last-input-event))))) | 273 | (let ((modifiers (event-modifiers (car last-input-event)))) |
| 274 | (mouse-avoidance-kbd-command (this-command-keys))) | 274 | (or (memq (car last-input-event) |
| 275 | '(mouse-movement scroll-bar-movement)) | ||
| 276 | (memq 'click modifiers) | ||
| 277 | (memq 'drag modifiers) | ||
| 278 | (memq 'down modifiers)))))) | ||
| 275 | (mouse-avoidance-banish-mouse))) | 279 | (mouse-avoidance-banish-mouse))) |
| 276 | 280 | ||
| 277 | (defun mouse-avoidance-exile-hook () | 281 | (defun mouse-avoidance-exile-hook () |
| 278 | ;; For exile mode, the state is nil when the mouse is in its normal | 282 | ;; For exile mode, the state is nil when the mouse is in its normal |
| 279 | ;; position, and set to the old mouse-position when the mouse is in exile. | 283 | ;; position, and set to the old mouse-position when the mouse is in exile. |
| 280 | (if (and (not executing-kbd-macro) | 284 | (if (and (not executing-kbd-macro) |
| 285 | ;; Don't do anything if last event was a mouse event. | ||
| 281 | (not (and (consp last-input-event) | 286 | (not (and (consp last-input-event) |
| 282 | (symbolp (car last-input-event)) | 287 | (symbolp (car last-input-event)) |
| 283 | (memq 'down (event-modifiers (car last-input-event))))) | 288 | (let ((modifiers (event-modifiers (car last-input-event)))) |
| 284 | (mouse-avoidance-kbd-command (this-command-keys))) | 289 | (or (memq (car last-input-event) |
| 290 | '(mouse-movement scroll-bar-movement)) | ||
| 291 | (memq 'click modifiers) | ||
| 292 | (memq 'drag modifiers) | ||
| 293 | (memq 'down modifiers)))))) | ||
| 285 | (let ((mp (mouse-position))) | 294 | (let ((mp (mouse-position))) |
| 286 | (cond ((and (not mouse-avoidance-state) | 295 | (cond ((and (not mouse-avoidance-state) |
| 287 | (mouse-avoidance-too-close-p mp)) | 296 | (mouse-avoidance-too-close-p mp)) |
| @@ -300,10 +309,15 @@ redefine this function to suit your own tastes." | |||
| 300 | (defun mouse-avoidance-fancy-hook () | 309 | (defun mouse-avoidance-fancy-hook () |
| 301 | ;; Used for the "fancy" modes, ie jump et al. | 310 | ;; Used for the "fancy" modes, ie jump et al. |
| 302 | (if (and (not executing-kbd-macro) ; don't check inside macro | 311 | (if (and (not executing-kbd-macro) ; don't check inside macro |
| 312 | ;; Don't do anything if last event was a mouse event. | ||
| 303 | (not (and (consp last-input-event) | 313 | (not (and (consp last-input-event) |
| 304 | (symbolp (car last-input-event)) | 314 | (symbolp (car last-input-event)) |
| 305 | (memq 'down (event-modifiers (car last-input-event))))) | 315 | (let ((modifiers (event-modifiers (car last-input-event)))) |
| 306 | (mouse-avoidance-kbd-command (this-command-keys)) | 316 | (or (memq (car last-input-event) |
| 317 | '(mouse-movement scroll-bar-movement)) | ||
| 318 | (memq 'click modifiers) | ||
| 319 | (memq 'drag modifiers) | ||
| 320 | (memq 'down modifiers))))) | ||
| 307 | (mouse-avoidance-too-close-p (mouse-position))) | 321 | (mouse-avoidance-too-close-p (mouse-position))) |
| 308 | (let ((old-pos (mouse-position))) | 322 | (let ((old-pos (mouse-position))) |
| 309 | (mouse-avoidance-nudge-mouse) | 323 | (mouse-avoidance-nudge-mouse) |
| @@ -311,21 +325,6 @@ redefine this function to suit your own tastes." | |||
| 311 | ;; This should never happen. | 325 | ;; This should never happen. |
| 312 | (apply 'set-mouse-position old-pos))))) | 326 | (apply 'set-mouse-position old-pos))))) |
| 313 | 327 | ||
| 314 | (defun mouse-avoidance-kbd-command (key) | ||
| 315 | "Return t if the KEYSEQENCE is composed of keyboard events only. | ||
| 316 | Return nil if there are any lists in the key sequence." | ||
| 317 | (cond ((null key) nil) ; Null event seems to be | ||
| 318 | ; returned occasionally. | ||
| 319 | ((not (vectorp key)) t) ; Strings are keyboard events. | ||
| 320 | ((catch 'done | ||
| 321 | (let ((i 0) | ||
| 322 | (l (length key))) | ||
| 323 | (while (< i l) | ||
| 324 | (if (listp (aref key i)) | ||
| 325 | (throw 'done nil)) | ||
| 326 | (setq i (1+ i)))) | ||
| 327 | t)))) | ||
| 328 | |||
| 329 | ;;;###autoload | 328 | ;;;###autoload |
| 330 | (defun mouse-avoidance-mode (&optional mode) | 329 | (defun mouse-avoidance-mode (&optional mode) |
| 331 | "Set cursor avoidance mode to MODE. | 330 | "Set cursor avoidance mode to MODE. |