Re: [gtk-list] A quicky (window manager related)





On Thu, 16 Oct 1997, Leon Gierat wrote:

> 
> I'm running window maker 0.6.3, and I've got gtk release 970925, and I
> can't seem to get windows to die using the window manager. I'm using the
> window manager "destroy" signal to trigger off either a gtk_widget_destroy
> on the main window and/or gtk_main_quit (it all depends, I've tried many 
> but probably missed the one combination that works).
> 
> I really don't think the window manager is emitting this "destroy" signal;
> the best way to test this would be to eun under a different wm I suppose,
> but that means installing one......(lazy lazy lazy!).
> 
> Anybody come across similair problems/found a solution?

Yep. This should have found its way into my gtk nits post a few days ago too.

The problem is that teh default action for the window delete signal 
handler (i.e. the FALSE return) is to do nothing. I think that a better 
solution would have been to make the default destroy the window, and for 
signal handlers that wanted to catch the signal to return TRUE. This 
would be consistent with many of the other event handlers in GTK - FALSE 
means "I didn't handle it, pass it up to the next guy", TRUE means "I got 
it, return now".

In the meantime, add this code for all windows created:

/* A signal handler for the window manager delete signal. Returns true
   so that the window gets destroyed. */
static gboolean
handle_delete (GtkWidget *widget, void *dummy)
{
  return TRUE;
}

gtk_signal_connect (GTK_OBJECT (window), GTK_SIGNAL_FUNC (handle_delete), 
NULL);

Good luck!

Raph



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