mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-21 23:05:59 +01:00
Adding the patch of David Dufberg Töttrup to implement WM_DELETE_WINDOW. Thank you!
This commit is contained in:
parent
bf6cf05ba5
commit
7efa4514d1
1 changed files with 12 additions and 3 deletions
15
st.c
15
st.c
|
@ -197,7 +197,7 @@ typedef struct {
|
||||||
Colormap cmap;
|
Colormap cmap;
|
||||||
Window win;
|
Window win;
|
||||||
XdbeBackBuffer buf;
|
XdbeBackBuffer buf;
|
||||||
Atom xembed;
|
Atom xembed, wmdeletewin;
|
||||||
XIM xim;
|
XIM xim;
|
||||||
XIC xic;
|
XIC xic;
|
||||||
XftDraw *xft_draw;
|
XftDraw *xft_draw;
|
||||||
|
@ -850,12 +850,15 @@ execsh(void) {
|
||||||
void
|
void
|
||||||
sigchld(int a) {
|
sigchld(int a) {
|
||||||
int stat = 0;
|
int stat = 0;
|
||||||
|
|
||||||
if(waitpid(pid, &stat, 0) < 0)
|
if(waitpid(pid, &stat, 0) < 0)
|
||||||
die("Waiting for pid %hd failed: %s\n", pid, SERRNO);
|
die("Waiting for pid %hd failed: %s\n", pid, SERRNO);
|
||||||
if(WIFEXITED(stat))
|
|
||||||
|
if(WIFEXITED(stat)) {
|
||||||
exit(WEXITSTATUS(stat));
|
exit(WEXITSTATUS(stat));
|
||||||
else
|
} else {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2173,6 +2176,8 @@ xinit(void) {
|
||||||
&(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
|
&(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
|
||||||
|
|
||||||
xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
|
xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
|
||||||
|
xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
|
||||||
|
XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
|
||||||
|
|
||||||
xresettitle();
|
xresettitle();
|
||||||
XMapWindow(xw.dpy, xw.win);
|
XMapWindow(xw.dpy, xw.win);
|
||||||
|
@ -2475,6 +2480,10 @@ cmessage(XEvent *e) {
|
||||||
} else if(e->xclient.data.l[1] == XEMBED_FOCUS_OUT) {
|
} else if(e->xclient.data.l[1] == XEMBED_FOCUS_OUT) {
|
||||||
xw.state &= ~WIN_FOCUSED;
|
xw.state &= ~WIN_FOCUSED;
|
||||||
}
|
}
|
||||||
|
} else if(e->xclient.data.l[0] == xw.wmdeletewin) {
|
||||||
|
/* Send SIGHUP to shell */
|
||||||
|
kill(pid, SIGHUP);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue