Re: [gtk-list] Re: How can i trap the Close Event
- From: Otto Hammersmith <otto redhat com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: How can i trap the Close Event
- Date: Wed, 2 Jul 1997 11:38:33 -0400
On Wed, Jul 02, 1997 at 08:16:58AM -0700, Raph Levien wrote:
>
>
> On 2 Jul 1997, Fritz Heinrichmeyer wrote:
>
> >
> > I wonder how it is possible to react on the Close Event (to save work on
> > files ..)?
>
> Looking at the code, I don't think GTK has support for this yet. The
> relevant code is gtk_main_iteration () in gtk+/gtk/gtkmain.c. You'll need
> to somehow disable the gtk_widget_destroy (event_widget) call in the
> GDK_DESTROY case if the signal is handled. Something like:
>
> if (!gtk_widget_event (event_widget, &event_copy))
> gtk_widget_destroy (event_widget);
>
> Then, you just need to connect to the delete_event signal of the window,
> and return TRUE if you don't want to destroy the window.
>
> I haven't checked through the signal code to make sure that the
> gtk_widget_event will reliably return a FALSE in the case that there is
> no handler for the delete_event signal, but it seems like a good bet.
>
> Raph
Hrmph?
Maybe I'm misunderstanding, but I think you're talking about the
window manager telling a window to close itself, right?
That's easy enough to catch... just attach a function to the "destroy"
signal of the main window. testgtk does it, does it not? At least, to
call gtk_exit to exit cleanly, rather than haning around for no good
reason.
--
-Otto.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]