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=5dp1JbK70aXIXDtPKihC+1E8A+rMHR3IK0vMEvFPWZs=; b=ua+ZzxN1RYs93vn+nMH54zRCVbVEJ29KCQJhBQoeBHpjSw9eYmXtKKZlRw/ei7DDiLTkkgLLwVkNwBMWCu7k3wVJDpKBa8vR0WJHiqbUUeVq23zvK5Ba4U1EM7w4A9A5wfQGATfYJyz4CbcB4If/6iMKF61KmLHrC/htLr6vlgs= 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=PLQMrpb2AXNdAu2Uot9CbwSPPNVoOAbj3GtPIeOWd+ZKP1DTtv5XaR7aUkXMiAheXHfeF0JzA8MFinC4DfVat4gIPuZ6XkjZcnPSJvoQUTjNPggyqQOFunMwAedasg6q4sdhYlYqLItLUStvm+/zc4nrjuZRxn1cy5Hs81YvsXc= Message-ID: Date: Wed, 26 Mar 2008 01:47:10 -0400 From: "Jacques Le Normand" To: lablgtk at yquem.inria.fr Subject: Re: [Lablgtk] getting the origin of a window In-Reply-To: MIME-Version: 1.0 References: <20080326.141518.71085990.garrigue@math.nagoya-u.ac.jp> Mime-version: 1.0 Content-Type: multipart/mixed; boundary="===============1954378992==" Content-Length: 5033 --===============1954378992== Content-Type: multipart/alternative; boundary="----=_Part_21304_29247639.1206510430504" ------=_Part_21304_29247639.1206510430504 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline small typo: 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 view#misc#window in (rectangle.x+x_origin,rectangle.y+y_origin) On Wed, Mar 26, 2008 at 1:46 AM, Jacques Le Normand wrote: > 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_21304_29247639.1206510430504 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline small typo:

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 view#misc#window in
  (rectangle.x+x_origin,rectangle.y+y_origin)


On Wed, Mar 26, 2008 at 1:46 AM, Jacques Le Normand <rathereasy@gmail.com> wrote:
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_21304_29247639.1206510430504-- --===============1954378992== 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 --===============1954378992==--