Re: Getting window coordinates of a GnomeCanvasItem



Marc Mulcahy <marc mulcahy sun com> writes: 
> gdouble world_x1, world_y1, world_x2, world_y2;
> gdouble win_x1, win_y1, win_x2, win_y2;
> GnomeCanvasItem *item;
> ...
> gnome_canvas_item_get_bounds (item,
> 	&world_x1, &world_y1,
> 	&world_x2, &world_y2);
> gnome_canvas_world_to_window (item->canvas,
> 	world_x1, world_y1,
> 	&win_x1, &win_y1);
> ...
> 
> Am I even close?

That should be about right. I'd have to go in and double-check that
get_bounds() returns world coords though. I think my book has some
reasonable docs on this coordinate stuff.

> Our accessibility API returns geometry information as gints-- can
> win_x1 and win_y1 be safely cast to gints?

Yes, those are just pixel values in GTK_LAYOUT (canvas)->bin_window.

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]