Re: Can't get x position of a window
- From: Santiago Capel <bluefish ono com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Can't get x position of a window
- Date: Sat, 22 Dec 2001 10:12:10 +0100
If you are calculating the x position of a toplevel window, your code
**must** work well. But if the window is a child window or a simple widget
of your application, the X coordinate is relative to its parents. You
should then try a code like this:
/* Calculate the absolute coords. of the widget, following the parents */
GtkWidget *tmpwin = my_unknown_located_window;
gint wx, wy;
gint posx = 0;
gint posy = 0;
while (tmpwin) {
switch (GTK_OBJECT_TYPE(tmpwin)) {
/* Ignore the following containers */
case 49429: /* GtkTable */
case 46101: /* GtkHBox */
case 40725: /* GtkVBox */
break;
default:
gdk_window_get_position(tmpwin->window, &wx, &wy);
posx += wx;
posy += wy;
}
tmpwin = tmpwin->parent;
}
posx = absolute x position of my_unknown_located_window;
posy = absolute y position of my_unknown_located_window;
If anybody knows a better method to do this, please, tell me :-)
Paul Cheyrou escribió:
Hi,
Can't get x position of a window, despite I tried :
gdk_window_get_root_origin (window, &x, &y);
gdk_window_get_position (window, &x, &y);
gdk_window_get_deskrelative_origin (window, &x, &y);
on Xfree 3, 4 on enlightenment, twm, fvwm, windowmaker...
And alway get a good y postion but x is always equal to 0
Any Clue ?
Paul.
ps : Amaya 5.3 is out with a GTK version working very well, try it out !
(despite the save window geometry bug on x position ;)
Homepage : http://www.w3.org/Amaya/
Binaries : http://www.w3.org/Amaya/User/BinDist.html
Source : http://www.w3.org/Amaya/User/SourceDist.html
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]