[comp.windows.x] Xt/Xaw: Detecting KillClient from a WorkProc?

hades@uni-paderborn.de (Hans-Detlef Siewert) (06/13/91)

I am using a WorkProc function -- added with XtAppAddWorkProc() -- to
communicate with a child process. When the application is destroyed by a
KillClient from the window manager, the WorkProc keeps running.
Now I need to know how I could detect this case so that I could
finish up the WorkProc and the child process.

Please reply directly by mail.

Thanks in advance,
	Hans-Detlef Siewert

-- 
/**\  Hans-Detlef Siewert, CS student at UGHS Paderborn
*  *  hades@uni-paderborn.de
*  *  ...!uunet!unido!pbinfo!hades
\**/  (old: hades@pbinfo.uucp)

swick@athena.mit.EDU (Ralph Swick) (06/14/91)

    When the application is destroyed by a
    KillClient from the window manager, the WorkProc keeps running.
    Now I need to know how I could detect this case so that I could
    finish up the WorkProc and the child process.

Xt will not interrupt work procs, if that's what you're expecting
to happen.  But, since work procs are supposed to execute for only
a short time relative to human response time, this should not be
a major issue; when your work proc returns, you have the opportunity
to handle whatever is in the Xlib queue.

However, handling KillClient is hard; from the client side it
usually looks like an XIOError.  For this reason, the ICCCM provides
a much better alternative.

What you really want to do is use the WM_PROTOTOLS window property
and a well-behaved window manager to avoid ever seeing KillClient.
Look up WM_DELETE_WINDOW in the ICCCM (page 543 of the Digital Press
book), XSetWMProtocols (307) and the <ClientMessage> translation
specification in Xt (page 885 of the other Digital Press book).