Re: [gtk-list] Re: How to redirect Alt-F4 to hide instead of destroy.



Hi, Havoc Pennington 
> 
> Hi,
> 
> Here is the deal: most window managers have two different things they can
> do to your window. One is usually called "Kill", and it calls
> XKillClient(),  which basically nukes the application; you can't recover
> from this, you have to exit. The "Close" button on window managers will
> generally send you a delete_event; you can choose how to respond to
> delete_event with a signal handler (if the signal _emission_ returns TRUE
> then the default action will not happen; the default action is to
> gtk_widget_destroy() your window).
> 
> So, you need to know whether Alt-F4 does the kill or the delete_event. If
> it just does delete_event, all you have to do is connect a delete_event
> handler which returns TRUE and hides the window. If it sends kill, then
> your whole app has been nuked.


Thank you for the hint it's the first suggestion that throws more light on my
problem.

So it show suffice to write

 gtk_signal_connect (GTK_OBJECT (toplevel_widget), "delete-event",
 		     GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete), NULL);

in order to redirect the Close from the Window manager in order to hide the
widget intead of destroying it.
(Looking at the source of gtk_widget_hide_on_delete, you'll realize, that
gtk_widget_hide_on_delete is a handler, that calls gtk_widget_hide and returns
TRUE)


  Wolfgang

BTW: Could you send me a reference of your book? We are dealing more and more
with gtk, so buying abook on it may be valuable for us...

--
Mag. Wolfgang Glas
Institut fuer hydraulische Stroemungsmaschinen
Kopernikusgasse 24                              Phone:++43/316/873/7578
A-8010 Graz                                     Fax:  ++43/316/873/7577

mailto:Wolfgang.Glas@hfm.tu-graz.ac.at   
http://fhysmsg01.tu-graz.ac.at/Wolfgang.Glas/



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