[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
posn-absolute-x-y
From: |
Miles Bader |
Subject: |
posn-absolute-x-y |
Date: |
Mon, 07 Jun 2004 14:11:19 +0900 |
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."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- posn-absolute-x-y,
Miles Bader <=