From 2cb4df9350c9405235c969ee39c644edea42fb0e Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Sun, 29 May 2005 09:32:18 +0000 Subject: [PATCH] Close properly. SVN revision: 15007 --- dox/dox.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dox/dox.c b/dox/dox.c index 904fb138..d309b329 100644 --- a/dox/dox.c +++ b/dox/dox.c @@ -57,6 +57,9 @@ Imlib_Image *im_next1, *im_next2; Imlib_Image *im_exit1, *im_exit2; char *docdir = NULL; +static Atom ATOM_WM_DELETE_WINDOW = None; +static Atom ATOM_WM_PROTOCOLS = None; + static Window FindRootWindow(Display * dpy) { @@ -153,6 +156,10 @@ CreateWindow(Window parent, int x, int y, int ww, int hh) hnt.max_height = hh; XSetWMNormalHints(disp, win, &hnt); + ATOM_WM_PROTOCOLS = XInternAtom(disp, "WM_PROTOCOLS", False); + ATOM_WM_DELETE_WINDOW = XInternAtom(disp, "WM_DELETE_WINDOW", False); + XSetWMProtocols(disp, win, &ATOM_WM_DELETE_WINDOW, 1); + return win; } @@ -664,10 +671,17 @@ main(int argc, char **argv) } } break; + case ClientMessage: + if (ev.xclient.message_type == ATOM_WM_PROTOCOLS && + (Atom) ev.xclient.data.l[0] == ATOM_WM_DELETE_WINDOW) + goto done; + break; default: break; } } + done: + return 0; } void