Re: finding the position of a (just created) widget

Thanks for the reply, which was rather what I feared.

No, because you can't know (for sure) what size the window manager
will assign a window until the window appears onscreen. Also, you

This is strictly but not morally true; I know that the window manager
is not going to go anywhere near the widget in question, since it's a
great-great-...-great grandchild of a top level window, and I also
happen to know that it isn't going to cause any change to the size of
the top level window, or indeed to anything except its immediate
parent. (I know this because if there wasn't enough space, I'd have
bailed out long ago.)

For most layout setups (where you expect the widget to get exactly its
requisition), you can just gtk_widget_size_request().

I don't want to know the *size* of the widget (I know that), I want to
know its position.

If you have a more complex layout you'd have to size_request() the
toplevel window, size_allocate it the whole size it requested, then
look at widget->allocation on your widget. But this won't properly

Maybe that's what I can do. If I size_allocate the nearest parent that
I "know" isn't going to change size, will that force the resize for
all its descendants (incidentally including my widget's parent)?

The clean solution is to just do anything that depends on the size in
a size_allocate signal handler, then your app will automatically
adjust to users resizing the window as a bonus.

Hmm. Another possibility, but I'd have to be careful, since I'm trying
to do a one-off event depending on the position.

Perhaps I should state the *real* problem, in case I'm just thinking
in some stupid way.
What I actually want to do is to animate the move of a widget from one
place in my layout to another. It's not just a question of literally
moving in a fixed layout, it's actually moving across the widget
hierarchy. So what I'm doing is destroying the widget in the old
position, creating a widget in the new position (and I rely on gtk to
find the new position in a box hierarchy), animating a floating
window from the old to the new positions and then mapping the new

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