Hi -
Here are a couple of links from people who've asked similar (the same?) questions:
http://www.linuxquestions.org/questi...43#post2747343
http://www.linuxquestions.org/questi...95#post2188995
See also comp.windows.x FAQ #188:
http://www.faqs.org/faqs/x-faq/part7/section-40.html
<= Good explanation of what's going on...
The basic issue is that the little "X" (close window) icon isn't really an Xlib thing; it's actually more of a Windows manager thing.
Here is one possible solution:
http://groups.google.com/group/comp....44530709ea65aa
Code:
...
Atom wm_protocols;
Atom wm_delete_window;
...
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
XSetWMProtocols(dpy, win, &wm_delete_window, 1);
...
for (;;) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case ClientMessage:
if (event.xclient.message_type == wm_protocols &&
event.xclient.data.l[0] == wm_delete_window) {
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
exit(0);
}
break;
...
default:
break;
}
}
'Hope that helps .. PSM