From 3879d17f3bd0bd1c32a18ab393185f923c04d31a Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 5 Apr 2021 09:31:44 +0200 Subject: support delete wm events Thanks to shepard47@protonmail.com for the patch. --- x11.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/x11.c b/x11.c index faff022..f7f88ca 100644 --- a/x11.c +++ b/x11.c @@ -12,7 +12,7 @@ void die(char *); -#define FONTNAME "Monaco:pixelsize=10" +#define FONTNAME "noto mono:pixelsize=14" enum { HMargin = 16, @@ -35,6 +35,7 @@ XftDraw *xft; static int w, h; static XIC xic; static XIM xim; +static Atom del; static int init() @@ -93,6 +94,9 @@ init() gui_x11.actionr.w = HMargin - 3; gui_x11.actionr.h = VMargin + font->height; + del = XInternAtom(d, "WM_DELETE_WINDOW", False); + XSetWMProtocols(d, win, &del, 1); + return XConnectionNumber(d); } @@ -354,6 +358,11 @@ nextevent(GEvent *gev) break; } + case ClientMessage: + if (e.xclient.data.l[0] == del) + exit(0); + break; + default: continue; } -- cgit v1.2.3