diff options
Diffstat (limited to 'ui.c')
| -rw-r--r-- | ui.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -16,6 +16,7 @@ static int scr; static unsigned long fg, bg; static XSizeHints szhint; static GC gc; +static Atom wm_delete_window; static Font freg, fital; @@ -55,6 +56,9 @@ ui_init(int argc, char **argv) XSelectInput(dsp, win, KeyPressMask | ExposureMask); XMapRaised(dsp, win); + wm_delete_window = XInternAtom(dsp, "WM_DELETE_WINDOW", False); + XSetWMProtocols(dsp, win, &wm_delete_window, 1); + freg = XLoadFont(dsp, "-*-new century schoolbook-medium-r-*-*-24-*-*-*-*-*-*-*"); fital = XLoadFont(dsp, "-*-new century schoolbook-medium-i-*-*-24-*-*-*-*-*-*-*"); } @@ -99,6 +103,12 @@ loop: case Expose: e->type = UI_REDRAW; return 1; + case ClientMessage: + if (ev.xclient.data.l[0] == wm_delete_window) { + e->type = UI_QUIT; + return 1; + } + break; } fprintf(stderr, "[Unknown event %d]\n", ev.type); goto loop; |
