[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Simplification to mouse-avoidance-mode (patch) + redisplay bug?
From: |
Kim F. Storm |
Subject: |
Simplification to mouse-avoidance-mode (patch) + redisplay bug? |
Date: |
Tue, 02 May 2006 14:23:18 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Using posn-at-point seems to be much simpler than compute-motion:
Index: avoid.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/avoid.el,v
retrieving revision 1.40
diff -c -r1.40 avoid.el
*** avoid.el 6 Feb 2006 14:33:32 -0000 1.40
--- avoid.el 2 May 2006 12:19:57 -0000
***************
*** 139,161 ****
(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)
(cons (selected-frame)
! (cons (+ (car edges) (car (cdr list)))
! (+ (car (cdr edges)) (car (cdr (cdr list))))))))
;(defun mouse-avoidance-point-position-test ()
; (interactive)
--- 139,151 ----
(defun mouse-avoidance-point-position ()
"Return the position of point as (FRAME X . Y).
Analogous to `mouse-position'."
! (let ((edges (window-inside-edges))
! (x-y (posn-x-y (posn-at-point))))
(cons (selected-frame)
! (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)
I notice that the final cursor shape often gets it wrong if I set the
style to "cat-and-mouse", it seems to happen if the cursor passes over
an area (eg. void or a mode line) along the chosen path. That looks
like a redisplay bug.
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Simplification to mouse-avoidance-mode (patch) + redisplay bug?,
Kim F. Storm <=
- Re: Simplification to mouse-avoidance-mode (patch) + redisplay bug?, Richard Stallman, 2006/05/02
- Re: Simplification to mouse-avoidance-mode (patch) + redisplay bug?, Kim F. Storm, 2006/05/10
- Re: Simplification to mouse-avoidance-mode (patch) + redisplay bug?, Richard Stallman, 2006/05/10
- Re: Simplification to mouse-avoidance-mode (patch) + redisplay bug?, Jan Djärv, 2006/05/11
- Re: Simplification to mouse-avoidance-mode (patch) + redisplay bug?, Kim F. Storm, 2006/05/11
- Re: Simplification to mouse-avoidance-mode (patch) + redisplay bug?, Jan Djärv, 2006/05/12
- Re: Simplification to mouse-avoidance-mode (patch) + redisplay bug?, Kim F. Storm, 2006/05/13