all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Simplification to mouse-avoidance-mode (patch) + redisplay bug?
@ 2006-05-02 12:23 Kim F. Storm
  2006-05-02 21:37 ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Kim F. Storm @ 2006-05-02 12:23 UTC (permalink / raw)



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 <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-05-14  0:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-02 12:23 Simplification to mouse-avoidance-mode (patch) + redisplay bug? Kim F. Storm
2006-05-02 21:37 ` Richard Stallman
2006-05-10 14:01   ` Kim F. Storm
2006-05-11  3:46     ` Richard Stallman
2006-05-11  7:50     ` Jan Djärv
2006-05-11 10:03       ` Kim F. Storm
2006-05-12  7:07         ` Jan Djärv
2006-05-14  0:12           ` Kim F. Storm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.