gdk_window_get_geometry issue.




First off my system is a RH5.2, w/ Xfree86 3.3.3 (via tarballs).
Everything gtk+ and gnome related was checked out of cvs about 2 nights
ago.

I am not sure if this is actually a bug, or just a missunderstanding on my
part, but when running the code:
(where window is the top level widget returned in this case from a call to
gnome_app_new)

--
gdk_window_get_geometry (window->window, &os_x, &os_y, &os_w, &os_h,
NULL);
g_print("X:%d Y:%d W:%d H:%d\n",os_x,os_y,os_w, os_h);

gdk_window_get_position(window->window,&os_x,&os_y);
gdk_window_get_size(window->window,&os_w,&os_h);
g_print("X:%d Y:%d W:%d H:%d\n",os_x,os_y,os_w, os_h);
--

I noticed that while the size is the same for both get_geometry and
get_size, the positions are wildly different.  It seems that get_position
reports the actual position, while get_geometry reports 0,22.

Actually that is not entirely true.  My test app prints this when it
exits. If I open the application and close it again without moving it, 
then _BOTH_ say 0,22 even though the app was started with something 
like gtk_widget_set_uposition(100,100).  (and actually started at 100,100)

Looking at the code, it seems that get_geometry calls XGetGeometry, while
get_size and get_position just check member variabls.  My thought then
is that the member variables get initialized with incorrect information,
but that they are updated correctly when the app moves.

I am assuming that XGetGeometry is sometimes (always?) returning an
incorrect value for position, though again, this could just be a
missunderstanding on my part, and I haven't looked too much deeper.  0,22
sounds suspicously like an offset inside the window, like say the positon
the gdk window is in with respect to windowmanagers frame (which seems to
be a 1 pixel left border and a 20something pixel titlebar.)

If this really is a problem and someone wants I'll look into it more.  But
I want to make sure I am investigating a bug and not a design decision. :)

Thanks
-chris


*************************************************************
Christopher Rogers      Stevens Institute of Technology
gandalf@pobox.com       http://www.pobox.com/~gandalf
Find my PGP PublicKey - http://www.pobox.com/~gandalf/CDR.asc
*************************************************************

Top 20 Replies by Programmers when their programs don't work:
#3. Why do you want to do it that way?




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