Re: How to be notified before GdkWindow is destroyed



On 13 May 2001, Havoc Pennington wrote:

> 
> Gustavo Joćo Alves Marques Carneiro <ee96090 fe up pt> writes:
> >   I have a GtkDrawingArea widget on which I'm using an external library
> > (libplot) to draw directly to widget->window. I need to receive a
> > notification when the widget is about to be destroyed but *before* the
> > GdkWindow is destroyed, because libplot is still using the window.
> > 
> >   Which signal should I connect to? I already tried "destroy" and
> > "unrealize", but those happen too late---the window is already destroyed.
> > I also tried to keep a reference to the GdkWindow (with g_object_ref) to
> > prevent it from being destroyed, but it didn't work. Any idea will be
> > deeply appreciated.
> > 
> 
> "unrealize" would normally work except that probably the window gets
> implicitly blown away when the toplevel GtkWindow is unrealized. 
> So maybe unmap_event or "unrealize" on the toplevel?

  Shouldn't the child widget's window be unrealized before the parent?
Can't GTK be changed to force child widgets to be unrealized before their
parents? It would really make programming this sort of thing much more
elegant, and it has more logic: child widgets should be destroyed before
their parents. I'd really like to make a self-contained library that
doesn't depend on the widget's parent at all.
  Any way, thanks, I'll try your idea soon...

> 
> There may be better ideas out there.
> 
> Havoc
> 

-- 
Gustavo J. A. M. Carneiro
[http://linuxdeec.fe.up.pt/~ee96090]






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