From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David PONCE Newsgroups: gmane.emacs.devel Subject: Re: `posn-at-point' and `posn-at-x-y' not in manual Date: Fri, 4 Jun 2004 14:15:52 +0200 (CEST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <16878127.1086351352498.JavaMail.www@wwinf1002> Reply-To: david.ponce@wanadoo.fr NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1086351384 32459 80.91.224.253 (4 Jun 2004 12:16:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 4 Jun 2004 12:16:24 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Jun 04 14:16:17 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BWDcP-0007BS-00 for ; Fri, 04 Jun 2004 14:16:17 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BWDcP-0001nN-00 for ; Fri, 04 Jun 2004 14:16:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BWDcn-0001Xn-4E for emacs-devel@quimby.gnus.org; Fri, 04 Jun 2004 08:16:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BWDck-0001Xe-JU for emacs-devel@gnu.org; Fri, 04 Jun 2004 08:16:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BWDcj-0001XL-0x for emacs-devel@gnu.org; Fri, 04 Jun 2004 08:16:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BWDci-0001XI-OS for emacs-devel@gnu.org; Fri, 04 Jun 2004 08:16:36 -0400 Original-Received: from [193.252.22.21] (helo=mwinf1004.wanadoo.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BWDc1-00080c-7Y; Fri, 04 Jun 2004 08:15:53 -0400 Original-Received: from wwinf1002 (wwinf1002 [172.22.141.29]) by mwinf1004.wanadoo.fr (SMTP Server) with ESMTP id 7D0FD180011A; Fri, 4 Jun 2004 14:15:52 +0200 (CEST) Original-To: dak@gnu.org X-Originating-IP: [194.2.245.141] X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-CC: |~| X-WUM-REPLYTO: |~| X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24524 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24524 >>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))) ))