summaryrefslogtreecommitdiff
path: root/lisp/avoid.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2006-05-05 23:15:29 +0000
committerKim F. Storm <storm@cua.dk>2006-05-05 23:15:29 +0000
commitb7f9e119fa53e1ebb13abccc179dfc69b1cafcb4 (patch)
tree0ec3ab359bd0365823c24c2fcd2a77b059ca6d87 /lisp/avoid.el
parentf1c2df02fdf78c1c4bec1aa7ae7d41f1eab195f6 (diff)
downloademacs-b7f9e119fa53e1ebb13abccc179dfc69b1cafcb4.tar.gz
(mouse-avoidance-point-position): Use posn-at-point instead of compute-motion.
Diffstat (limited to 'lisp/avoid.el')
-rw-r--r--lisp/avoid.el22
1 files changed, 6 insertions, 16 deletions
diff --git a/lisp/avoid.el b/lisp/avoid.el
index 1d97dd306db..1868707720e 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -139,23 +139,13 @@ Only applies in mouse-avoidance-modes `animate' and `jump'."
(defun mouse-avoidance-point-position ()
"Return the position of point as (FRAME X . Y).
Analogous to `mouse-position'."
- (let* ((w (selected-window))
- (edges (window-inside-edges w))
- (list
- (compute-motion (max (window-start w) (point-min)) ; start pos
- ;; window-start can be < point-min if the
- ;; latter has changed since the last redisplay
- '(0 . 0) ; start XY
- (point) ; stop pos
- nil ; stop XY: none
- nil ; width
- (cons (window-hscroll w) 0) ; 0 may not be right?
- (selected-window))))
- ;; compute-motion returns (pos HPOS VPOS prevhpos contin)
- ;; we want: (frame hpos . vpos)
+ (let ((edges (window-inside-edges))
+ (x-y (posn-x-y (posn-at-point))))
(cons (selected-frame)
- (cons (+ (car edges) (car (cdr list)))
- (+ (car (cdr edges)) (car (cdr (cdr list))))))))
+ (cons (+ (car edges)
+ (/ (car x-y) (frame-char-width)))
+ (+ (car (cdr edges))
+ (/ (cdr x-y) (frame-char-height)))))))
;(defun mouse-avoidance-point-position-test ()
; (interactive)