Re: [gtk-list] Re: reparenting containers with a window of t



On Tue, 3 Feb 1998, Patrice Fortier wrote:

> Owen wrote:
> > Patrice Fortier <Patrice.Fortier@aquarel.fr> writes:
> > > You mean that when you want to reparent a widget, you unmap it,
> > > then unrealize it (destroy it), rerealize it (create it) with
> > > an other parent, and then remap it!???!
> > > And you'd like to do that trick recursively???
> > > I can't even believe that *you* wrote this!
> > > 
> > > There are a REPARENT X event and an XReparentWindow function for
> > > that.
> > > Why don't you use it?
> > 
> > When possible I do. 
> > 
> > "When possible" means:
> >    
> >     GTK_WIDGET_REALIZED (widget) && GTK_WIDGET_REALIZED (new_parent)
> > 
> > I'd like you see do better than that! (Actually, if the widget
> > is a container without a window, then we may have to do multiple
> > gdk_window_reparent()'s - but that again is unavoidable)
    ^^^^^^^^^^^^^^^^^^^
    now what does this look loike, Patrice?
    incase you are not familiar with gdk_window_reparent(), it
    will _reparent_ the childs window.
    
> 
> The thing that bugs me is that you unrealize the widget, which in fact
> destroys it and its windows, the children, and then rerealize them
> (recreate them).

this is not the case, take a closer look at owens words.

> Why don't you just unmap the widget (or the closest children if it's
> a NO_WINDOW), reparent the(ir) widget->window, and remap it (them).

you don't need to do the unmapping, X will do that for you.

> 
> In this case you don't have to bother about un/realizing the widget
> and even less to do that recursively to all the children.
> 
> Realize/Unrealize is a huge overhead, and useually it's not a good
> thing to play with memory allocation/deallocation (or ref_counting)
> when unnecessary.
> 
> Patrice.
> 

---
ciaoTJ



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