Re: How to get Widgets absolute X/Y co-ordinates.
- From: Tim Evans <t evans aranz com>
- To: gtk-app-devel-list gnome org
- Subject: Re: How to get Widgets absolute X/Y co-ordinates.
- Date: Fri, 05 Nov 2004 09:38:03 +1300
Olexiy Avramchenko wrote:
[snip]
Absolute screen coordinates is much harder. Here's what we have:
1) Widget's real size and position inside the *parent window* stored
in GtkWidget::allocation field.
2) gtk_widget_get_parent_window() function can give us a pointer to
the parent window.
3) Parent window coordinates in *root window* (screen coordinates)
accessible via gdk_window_get_root_origin().
Looks simple ? Yep, but there's a window manager application that runs
somewhere on your box and decorates your windows with nice titlebars and
frames. Your widgets will be packed in decorated window with some
offset, known by window manager.
So also we have:
4) gdk_window_get_frame_extents() function can talk to window manager
and ask it about decorated window coordinates.
The function gdk_window_get_origin() gives you the root window
coordinates without the window manager frame. This simplifies things
somewhat.
--
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]