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=1FY2xQjSeyasLm1314DffdRkiT9goidb3bKH5wh+hzM=; b=Nu+oVcElzfQ21EJeN91TCy499ye5e492pAtn7Nr6OSrLhwB+Q2fqvjAKNeOHaed8m+rfGd3Mg4NqCu5/MkYVOqAUEOp3LWVKmKwmI+IsuyqcRKNafyj/KxzSug+pYMxt/3laL3nkAXAKYb0IPbHPuHNznt7Mji8fPJxkbMK4QQM= 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=ZudrIDt4hmOd5Fm0/svlnyK12H+pfp79tfkD5bXfvdncU4rnQxOGWYQtJnyE73J42k0+PY4L07yaPLLAAy+cElM7Dq74OiqmoGRWHGMq1omg1yt9FcyEte73JRahqBJjaGdA9IXx4D+TdBcuCLQyUXdLabx4HC5Kh/oNO5dTIu0= Message-ID: Date: Wed, 26 Mar 2008 01:46:06 -0400 From: "Jacques Le Normand" To: lablgtk at yquem.inria.fr Subject: Re: [Lablgtk] getting the origin of a window In-Reply-To: <20080326.141518.71085990.garrigue at math.nagoya-u.ac.jp> MIME-Version: 1.0 References: <20080326.141518.71085990.garrigue@math.nagoya-u.ac.jp> Mime-version: 1.0 Content-Type: multipart/mixed; boundary="===============0588070766==" Content-Length: 3901 --===============0588070766== Content-Type: multipart/alternative; boundary="----=_Part_21300_26251823.1206510366389" ------=_Part_21300_26251823.1206510366389 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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) ? On Wed, Mar 26, 2008 at 1:15 AM, Jacques Garrigue < garrigue@math.nagoya-u.ac.jp> wrote: > From: "Jacques Le Normand" > > > is there a way to get the position of a window in lablgtk? > > in gtk you would use > > > > gtk_window_get_position(window,&x,&y) > > > > in haskell you would do > > > > do > > dw <- widgetGetDrawWindow window > > drawWindowGetOrigin dw > > Lablgtk is close to Haskell: > > Gdk.Window.get_position w#misc#window > > Note however that this is not the same thing as > gtk_window_get_position, which takes decorations and gravity into > account. (Look at the gtk documentation.) > This last function is not interfaced currently. > If you really need it, please tell us. > > Jacques > ------=_Part_21300_26251823.1206510366389 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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) ?




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

> is there a way to get the position of a window in lablgtk?
> in gtk you would use
>
> gtk_window_get_position(window,&x,&y)
>
> in haskell you would do
>
> do
>   dw <- widgetGetDrawWindow window
>   drawWindowGetOrigin dw

Lablgtk is close to Haskell:

 Gdk.Window.get_position w#misc#window

Note however that this is not the same thing as
gtk_window_get_position, which takes decorations and gravity into
account. (Look at the gtk documentation.)
This last function is not interfaced currently.
If you really need it, please tell us.

  Jacques

------=_Part_21300_26251823.1206510366389-- --===============0588070766== 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 --===============0588070766==--