Re: Window Size

"Brian C. Lane" <> writes:

>   I seem to be having a problem getting the size of my main window.
> Everything I try is returning 1x1...
>   I create the main window, realize it, create some hboxes and a vbox and
> pack them into the window, showing them after they are packed. I pack a
> bunch of buttons into the boxes, showing them after they are packed. I
> then call gdk_window_get_size( window->window, &width, &height) to get the
> size of the window. I get 1x1. I've also tried looking directly at
> window->allocate.width/height with the same result.
>   It does the same thing when I show the main window before doing the size
> check.
>   I've stepped through it with gdb, and the width/heigh never get changed.
> What actually updates these values? Does it wait until the main gtk loop
> is entered?

Yep. The size of the toplevel window is completely under the control
of the window manager - even though GTK asks for a 100x100 window,
the window manager could deny that and give it a 50x50 window.

So GDK doesn't update the size of a toplevel window until it gets 
a ConfigureNotify event back from X saying what the real size

You should be able to, however, check the size GTK asked for by
looking at window->allocation. GTK, in expectation of a cooperative
window manager lays everything out at the desired size, and then
does it again if the actual size given is something different.


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