emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `posn-at-point' and `posn-at-x-y' not in manual


From: David PONCE
Subject: Re: `posn-at-point' and `posn-at-x-y' not in manual
Date: Fri, 4 Jun 2004 14:15:52 +0200 (CEST)

>>About the `posn-at-point' function, any idea on how to convert the
>>pixel coordinates it returns, which are relative to a window, into
>>coordinates relative to the selected frame, to display a tool tip at
>>point for example?
> 
> 
> window-inside-pixel-edges or window-pixel-edges ?

Of course!  Thanks!
As an example, here is an implementation of a `set-mouse-at-point'
function that seems to work very well :-)

(defun set-mouse-at-point ()
  "Move the mouse pointer to pixel position of point."
  (let* ((pos (posn-at-point))
         (x-y (posn-x-y pos))
         (wnd (posn-window pos))
         (frm (window-frame wnd))
         (edg (window-pixel-edges wnd)))
    (set-mouse-pixel-position
     frm
     (+ (car x-y) (car  edg) (frame-char-width frm))
     (+ (cdr x-y) (cadr edg) (/ (frame-char-height frm) 2)))
    ))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]