Delivered-To: lablgtk at yquem.inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=ENSgOmOTd05WQz2wKkHSZ6eO8Tx0oYQ+kK7IQoTU3fc=; b=PX63kDFbvoCP4hzd6SYZyyrVm5GuVx2FGNMJMluqJI2NDLS7IsfF9aOVjtQwdYH8u52ewHAEj5ajCWF9A6mXTpcNKUgoxWVsask3/TP3loj7zvClImdfR44XMWxFgPZ6IkEhnrE0UsbsH+CZR12FiADsRtmoIUlbG55VxY8ARBc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=tl7OEejJezxTt+L4K3a9Twe4+hCB6rbZbzXd6QfzupK8sQ23wnNukJi4RcWiIhXCBltI2+XwWAvEB9oQGPDz3Ffzj/dqITunSH2K1vB4yG8YTmZF4+1siPLDEEUY6ZlAC9hPvPbmz4+GixgJjQaCkjc2ifcnpEA3JQwPkGr9HX0= Message-ID: Date: Wed, 26 Mar 2008 15:35:57 -0400 From: "Jacques Le Normand" To: lablgtk at yquem.inria.fr Subject: Re: [Lablgtk] getting the origin of a window In-Reply-To: <20080326.152926.21593485.garrigue at math.nagoya-u.ac.jp> MIME-Version: 1.0 References: <20080326.141518.71085990.garrigue@math.nagoya-u.ac.jp> <20080326.152926.21593485.garrigue@math.nagoya-u.ac.jp> Mime-version: 1.0 Content-Type: multipart/mixed; boundary="===============2050672927==" Content-Length: 3400 --===============2050672927== Content-Type: multipart/alternative; boundary="----=_Part_5895_20139060.1206560157728" ------=_Part_5895_20139060.1206560157728 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I want to place another window at those coordinates, similar to what spellcheckers do (they place a window beside a word and give you possible options) On Wed, Mar 26, 2008 at 2:29 AM, Jacques Garrigue < garrigue@math.nagoya-u.ac.jp> wrote: > From: "Jacques Le Normand" > > > I need to get to get the coordinates of a position in a textview. > Consider > > this function: > > > > let get_coordinates_at_offset buffer view i = > > let iter = buffer#get_iter (`OFFSET i) in > > let rectangle = view#get_iter_location iter in > > let x_origin,y_origin = Gdk.Window.get_position w#misc#window in > > (rectangle.x+x_origin,rectangle.y+y_origin) > > > > which takes a textbuffer and a textview and an offset and returns the > (x,y) > > coordinate of the offset. Is this correct? Or do I need > > gtk_window_get_position(window,&x,&y) ? > > I'm not sure why you need the absolute coordinates of the position > rather than the relative, but this doesn't seem to require > gtk_window_get_position. > > Jacques > ------=_Part_5895_20139060.1206560157728 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I want to place another window at those coordinates, similar to what spellcheckers do (they place a window beside a word and give you possible options)

On Wed, Mar 26, 2008 at 2:29 AM, Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> wrote:
From: "Jacques Le Normand" <rathereasy@gmail.com>

> I need to get to get the coordinates of a position in a textview. Consider
> this function:
>
> let get_coordinates_at_offset buffer view i =
>   let iter =  buffer#get_iter (`OFFSET i) in
>   let rectangle = view#get_iter_location iter in
>   let x_origin,y_origin = Gdk.Window.get_position w#misc#window in
>   (rectangle.x+x_origin,rectangle.y+y_origin)
>
> which takes a textbuffer and a textview and an offset and returns the (x,y)
> coordinate of the offset. Is this correct? Or do I need
> gtk_window_get_position(window,&x,&y) ?

I'm not sure why you need the absolute coordinates of the position
rather than the relative, but this doesn't seem to require
gtk_window_get_position.

       Jacques

------=_Part_5895_20139060.1206560157728-- --===============2050672927== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk --===============2050672927==--