Path: utzoo!utgpu!news-server.csri.toronto.edu!orasis.vis.toronto.edu!tjhorton Newsgroups: comp.windows.x From: tjhorton@vis.toronto.edu ("Timothy J. Horton") Subject: Re: how to trap f.kill Message-ID: <91Jan27.005904est.8688@orasis.vis.toronto.edu> Keywords: XSetIOErrorHandler Organization: Department of Computer Science, University of Toronto References: <1991Jan22.010234.15702@sat.uucp> <521@decvax.decvax.dec.com.UUCP> Date: 27 Jan 91 05:59:18 GMT Lines: 21 tony@sat.uucp writes: > I need to trap the f.kill issued by the window manager (at user command) > and do some cleaning up before my application exits; is there any way to > trap this "event or signal" ? f.kill processing works via ICCM (Inter-Client Communication). What you have to do is XIternAtom "WM_DELETE_WINDOW", and add a protocol callback for that atom. Sorry that I don't know the code offhand (left it at my last contract site). Keep in mind that after your callback returns control, the mainLoop exits. This does not trap loss of connection to the server (although you didn't ask specifically, it seems necessary). That half of a good solution was given earlier by someone else: evans@decvax.DEC.COM writes: >Use the XSetIOErrorHandler function to set up a function to be called when >the Fatal IO error occurs, one of which would be a server disconnection. You >will need to be careful here, in that the only other X calls you should make >are to free memory. The function is not expected to return, so be sure that >it doesn't.