diff options
author | Tor Andersson <tor@ghostscript.com> | 2011-02-02 12:24:07 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2011-02-02 12:24:07 +0000 |
commit | 170c7930be0f73d4e0c63ba72b66d86802065990 (patch) | |
tree | 4b95e4662b7e92f3e78f328abbedd3fc85de6166 /apps/x11_main.c | |
parent | 8267c470c33395f6197bbf86d4fd34c7c5de223a (diff) | |
download | mupdf-170c7930be0f73d4e0c63ba72b66d86802065990.tar.xz |
Handle WM_DELETE client messages.
Diffstat (limited to 'apps/x11_main.c')
-rw-r--r-- | apps/x11_main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/x11_main.c b/apps/x11_main.c index 9ef08012..1fcc8b4c 100644 --- a/apps/x11_main.c +++ b/apps/x11_main.c @@ -51,6 +51,7 @@ static Display *xdpy; static Atom XA_TARGETS; static Atom XA_TIMESTAMP; static Atom XA_UTF8_STRING; +static Atom WM_DELETE_WINDOW; static int x11fd; static int xscr; static Window xwin; @@ -113,6 +114,7 @@ static void winopen(void) XA_TARGETS = XInternAtom(xdpy, "TARGETS", False); XA_TIMESTAMP = XInternAtom(xdpy, "TIMESTAMP", False); XA_UTF8_STRING = XInternAtom(xdpy, "UTF8_STRING", False); + WM_DELETE_WINDOW = XInternAtom(xdpy, "WM_DELETE_WINDOW", False); xscr = DefaultScreen(xdpy); @@ -177,6 +179,8 @@ static void winopen(void) XFree(classhint); } + XSetWMProtocols(xdpy, xwin, &WM_DELETE_WINDOW, 1); + x11fd = ConnectionNumber(xdpy); } @@ -715,6 +719,11 @@ int main(int argc, char **argv) xevt.xselectionrequest.property, xevt.xselectionrequest.time); break; + + case ClientMessage: + if (xevt.xclient.format == 33 && xevt.xclient.data.l[0] == WM_DELETE_WINDOW) + closing = 1; + break; } } while (!closing && XPending(xdpy)); |