Handle WM_DELETE_WINDOW messages correctly, thanks to fungt
This commit is contained in:
parent
a5335e8ddd
commit
d731741f04
4
main.c
4
main.c
|
@ -475,6 +475,10 @@ void run() {
|
|||
timeout = 1;
|
||||
}
|
||||
break;
|
||||
case ClientMessage:
|
||||
if ((Atom) ev.xclient.data.l[0] == wm_delete_win)
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
6
window.c
6
window.c
|
@ -28,9 +28,10 @@
|
|||
|
||||
static Cursor arrow;
|
||||
static Cursor hand;
|
||||
|
||||
static GC bgc;
|
||||
|
||||
Atom wm_delete_win;
|
||||
|
||||
void win_set_sizehints(win_t *win) {
|
||||
XSizeHints sizehints;
|
||||
|
||||
|
@ -123,6 +124,9 @@ void win_open(win_t *win) {
|
|||
XMapWindow(e->dpy, win->xwin);
|
||||
XFlush(e->dpy);
|
||||
|
||||
wm_delete_win = XInternAtom(e->dpy, "WM_DELETE_WINDOW", False);
|
||||
XSetWMProtocols(e->dpy, win->xwin, &wm_delete_win, 1);
|
||||
|
||||
if (options->fullscreen)
|
||||
win_toggle_fullscreen(win);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue