unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* posn-absolute-x-y
@ 2004-06-07  5:11 Miles Bader
  0 siblings, 0 replies; only message in thread
From: Miles Bader @ 2004-06-07  5:11 UTC (permalink / raw)


Hi, I stole the following from x-dnd.el; does this look right?  Is
there an existing function to do this?

[The intent is to get something that I can use with `x-show-tip' to pop
up a tooltip at a specified (pixel) offset from point.]

   ;; large parts stolen from `x-dnd-get-drop-x-y'
   (defun posn-absolute-x-y (posn)
     "Return absolute (relative to window-system root) x-y coordinates of POSN."
     (let* ((win (posn-window posn))
            (frame (window-frame win))
            (frame-left (frame-parameter frame 'left))
            ;; If the frame is outside the display, frame-left looks like
            ;; '(0 -16).  Extract the -16.
            (frame-real-left (if (consp frame-left) (car (cdr frame-left))
                               frame-left))
            (frame-top (frame-parameter frame 'top))
            (frame-real-top (if (consp frame-top) (car (cdr frame-top))
                              frame-top))
            (win-edges (window-inside-pixel-edges win)))
       (cons
        (+ frame-real-left (nth 0 win-edges) (car (posn-x-y posn)))
        (+ frame-real-top (nth 1 win-edges) (cdr (posn-x-y posn))))))

Thanks,

-Miles
-- 
"Though they may have different meanings, the cries of 'Yeeeee-haw!' and
 'Allahu akbar!' are, in spirit, not actually all that different."

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-07  5:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-07  5:11 posn-absolute-x-y Miles Bader

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).