Re: [gtk-list] gdk_window_get_geometry issue.
- From: "Andre' Karwath" <Andre Karwath informatik tu-chemnitz de>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] gdk_window_get_geometry issue.
- Date: Sat, 9 Jan 1999 21:36:20 +0100
Hello,
> 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)
Today I had exactly the same problem and searched in my archive of
this mailing list for a solution. Now, I only found your posting with
the same question. After searching the GDK "documentation" a little
bit, I found the solution for both problems:
gdk_window_get_root_origin (window, &x, &y);
It stores the correct position - including the window manager
border offset - in x and y. And you get the correct value without
the requirement to move the window first, as well.
Altough I got the same value 22 during my tests, it is not hard wired
and depends on the window manager. If I increase the font size for the
window title (I'm using the Window Maker, btw), the value is increased
too.
--
_____ _ _ _____
( _ )( ) ( )( _ ) PENGUINS ARE COOL
| (_) || |/'/ | (_) |
| _ || , < | _ | ---------------------------------------
| | | || |\ \ | | | | andre.karwath@informatik.tu-chemnitz.de
(_) (_)(_) (_)(_) (_) http://www.tu-chemnitz.de/~aka
.............................................................
the best way to have a friend is to be one
.............................................................
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]