Mercurial > hg > xemacs-beta
comparison lisp/packages/avoid.el @ 134:34a5b81f86ba r20-2b1
Import from CVS: tag r20-2b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:30:11 +0200 |
parents | 1ce6082ce73f |
children | 489f57a838ef |
comparison
equal
deleted
inserted
replaced
133:b27e67717092 | 134:34a5b81f86ba |
---|---|
70 | 70 |
71 ;;; Code: | 71 ;;; Code: |
72 | 72 |
73 (provide 'avoid) | 73 (provide 'avoid) |
74 | 74 |
75 (defgroup avoid nil | |
76 "Make mouse pointer stay out of the way of editing." | |
77 :prefix "mouse-avoidance-" | |
78 :group 'mouse) | |
79 | |
80 | |
75 ;;;###autoload | 81 ;;;###autoload |
76 (defvar mouse-avoidance-mode nil | 82 (defvar mouse-avoidance-mode nil |
77 "Value is t or a symbol if the mouse pointer should avoid the cursor. | 83 "Value is t or a symbol if the mouse pointer should avoid the cursor. |
78 See function `mouse-avoidance-mode' for possible values. Changing this | 84 See function `mouse-avoidance-mode' for possible values. Changing this |
79 variable is NOT the recommended way to change modes; use that function | 85 variable is NOT the recommended way to change modes; use that function |
80 instead.") | 86 instead.") |
81 | 87 |
82 (defvar mouse-avoidance-nudge-dist 15 | 88 (defcustom mouse-avoidance-nudge-dist 15 |
83 "*Average distance that mouse will be moved when approached by cursor. | 89 "*Average distance that mouse will be moved when approached by cursor. |
84 Only applies in mouse-avoidance-mode `jump' and its derivatives. | 90 Only applies in mouse-avoidance-mode `jump' and its derivatives. |
85 For best results make this larger than `mouse-avoidance-threshold'.") | 91 For best results make this larger than `mouse-avoidance-threshold'." |
86 | 92 :type 'integer |
87 (defvar mouse-avoidance-nudge-var 10 | 93 :group 'avoid) |
88 "*Variability of `mouse-avoidance-nudge-dist' (which see).") | 94 |
89 | 95 (defcustom mouse-avoidance-nudge-var 10 |
90 (defvar mouse-avoidance-animation-delay .01 | 96 "*Variability of `mouse-avoidance-nudge-dist' (which see)." |
91 "Delay between animation steps, in seconds.") | 97 :type 'integer |
92 | 98 :group 'avoid) |
93 (defvar mouse-avoidance-threshold 5 | 99 |
100 (defcustom mouse-avoidance-animation-delay .01 | |
101 "Delay between animation steps, in seconds." | |
102 :type 'number | |
103 :group 'avoid) | |
104 | |
105 (defcustom mouse-avoidance-threshold 5 | |
94 "*Mouse-pointer's flight distance. | 106 "*Mouse-pointer's flight distance. |
95 If the cursor gets closer than this, the mouse pointer will move away. | 107 If the cursor gets closer than this, the mouse pointer will move away. |
96 Only applies in mouse-avoidance-modes `animate' and `jump'.") | 108 Only applies in mouse-avoidance-modes `animate' and `jump'." |
109 :type 'integer | |
110 :group 'avoid) | |
97 | 111 |
98 ;; Internal variables | 112 ;; Internal variables |
99 (defvar mouse-avoidance-state nil) | 113 (defvar mouse-avoidance-state nil) |
100 (defvar mouse-avoidance-pointer-shapes nil) | 114 (defvar mouse-avoidance-pointer-shapes nil) |
101 (defvar mouse-avoidance-n-pointer-shapes 0) | 115 (defvar mouse-avoidance-n-pointer-shapes 0) |
279 (cdr (cdr old-pos))))))) | 293 (cdr (cdr old-pos))))))) |
280 | 294 |
281 (defun mouse-avoidance-kbd-command (key) | 295 (defun mouse-avoidance-kbd-command (key) |
282 "Return t if the KEYSEQENCE is composed of keyboard events only. | 296 "Return t if the KEYSEQENCE is composed of keyboard events only. |
283 Return nil if there are any lists in the key sequence." | 297 Return nil if there are any lists in the key sequence." |
284 (cond ((null key) nil) ; Null event seems to be | 298 (cond ((null key) nil) ; Null event seems to be |
285 ; returned occasionally. | 299 ; returned occasionally. |
286 ((not (vectorp key)) t) ; Strings are keyboard events. | 300 ((not (vectorp key)) t) ; Strings are keyboard events. |
287 ((catch 'done | 301 ((catch 'done |
288 (let ((i 0) | 302 (let ((i 0) |
289 (l (length key))) | 303 (l (length key))) |
290 (while (< i l) | 304 (while (< i l) |
291 (if (listp (aref key i)) | 305 ;; XEmacs change: (Emacs version was: (listp (aref key i))) |
306 (if (not (key-press-event-p (aref key i))) | |
292 (throw 'done nil)) | 307 (throw 'done nil)) |
293 (setq i (1+ i)))) | 308 (setq i (1+ i)))) |
294 t)))) | 309 t)))) |
295 | 310 |
296 ;;;###autoload | 311 ;;;###autoload |