Re: desktop exit signals



zentara wrote  on 11/29/2005 06:54 PM:
Jaap Karssenberg wrote:
I was wondering which signal I need to intercept if I want to know when the desktop exits while my application is still open. I tried catching SIGHUP, SIGTERM and SIGKILL but no luck so far. (The obvious purpose of this is to save the state of the application before it exits.)

I have this working on ICEWM. It will save on a logout from X, but
not a Control-Alt-Backspace. It will also save if you accidently
hit the X in the Window Manager's toolbar. You can prevent Cntrl-Alt-BS in Xorg.conf, so it might be useful.

.. 8< .. Test script catching $SIG{INT} and $SIG{__DIE__}

Your test script doesn't work with the xfce desktop, so I'm afraid this behaviour is desktop-specific :( It would be nice if the desktop just send a SIGHUP before killing the X server.

The thing that makes me wonder is that my application exits with "Terminated" or with the error that the connection to the X server was lost. Either way I think it is Gtk that notices that the display is gone and throws an exception. So should it be possible to catch this exception from perl ? Or does Gtk exit immediatly without returning control to perl ?

This is a serious issue for me because I want to be sure all documents are saved before my application exits. I think exiting the desktop with the application still open should not be regarded as an abnormal exit.

Any help appreciated

-- Jaap <pardus cpan org>

P.S. now running gtk+ 2.8.7 with perl 5.8.7 and Gtk2 1.101



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