Start New Discussion within our Software Development Community

Hello Team:
I have users who use Reflection-X (we are on AIX 4.3)when execution our application software. If they do not "back out" of the application (... Select X on the various menu screens...) gracefully, and just "click" on the "RED X", in the upper right hand corner of the window, the application does NOT receive the SIGNAL that the session has stopped, and we are stuck with a bunch of "ZOMBIE" processes and things begin to spiral downaward.
My Question: Is there a way to TRAP or get the SIGNAL from the Reflection-X session when a user clicks on the "RED-X". Or, what kind of SIGNAL can I TRAP for in my code so that I can "kill-off" the orphaned processes?
Thanks in advance for your help!

Based on the information provided, I believe you want to close a window based on clicking on a 'close' control in the window manager's decoration for the window. If so, you need to intern an Atom named "WM_DELETE_WINDOW" and then in your event handler look for a ClientMessage that has a value of the interned atom. Here's some pseudo-code to demonstrate...

int handleEvents(XEvent *e, Atom wm_del) { XClientMessageEvent *xcme; int ret = 1;

switch (e->type) {
case ClientMessage:
xcme = (XClientMessage)e;
if ((Atom)xcme->data.l[0] == wm_del) {
XDestroyWindow(xcme->display, xcme->window); ret = 0; } break;

default:
break;
}
}

int main(int argc, char *argv[])
{
Display *dpy;
Window win;
Atom wm_del;
XEvent e;
int ret = 1;

dpy = XOpenDisplay(NULL);
win = makeAndMapWindow(dpy); // use your imagination wm_del = XInternAtom(dpy, "WM_DESTOY_WINDOW", False); while (ret != 0) { XNextEvent(dpy, &e) ; ret = handleEvents(&e, wm_del) ; } XCloseDisplay(dpy); }

This article has been dead for over six months. Start a new discussion instead.