Compare commits

..

3 Commits
5.3 ... 5.3.1

2 changed files with 22 additions and 29 deletions

View File

@ -56,3 +56,4 @@ d6d3085307d8d98b8b012b669e858fd787befeb1 4.7
06eb9644e2dad7667d97495eb7d7bc62aa0429e8 5.0 06eb9644e2dad7667d97495eb7d7bc62aa0429e8 5.0
ce355cea9bb89e162f61913737a46908cdfa7e45 5.1 ce355cea9bb89e162f61913737a46908cdfa7e45 5.1
e4bcaca8e6ef13d2c3b81f1218ad15e5da4d68bd 5.2 e4bcaca8e6ef13d2c3b81f1218ad15e5da4d68bd 5.2
4004d61160355d869a7d2672561caad440751ba0 5.3

50
dwm.c
View File

@ -138,7 +138,7 @@ static void attachstack(Client *c);
static void buttonpress(XEvent *e); static void buttonpress(XEvent *e);
static void checkotherwm(void); static void checkotherwm(void);
static void cleanup(void); static void cleanup(void);
static void clearurgent(void); static void clearurgent(Client *c);
static void configure(Client *c); static void configure(Client *c);
static void configurenotify(XEvent *e); static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e); static void configurerequest(XEvent *e);
@ -182,7 +182,6 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setup(void); static void setup(void);
static void showhide(Client *c); static void showhide(Client *c);
static void sigchld(int signal);
static void spawn(const Arg *arg); static void spawn(const Arg *arg);
static void tag(const Arg *arg); static void tag(const Arg *arg);
static int textnw(const char *text, unsigned int len); static int textnw(const char *text, unsigned int len);
@ -366,20 +365,15 @@ cleanup(void) {
} }
void void
clearurgent(void) { clearurgent(Client *c) {
XWMHints *wmh; XWMHints *wmh;
Client *c;
for(c = clients; c; c = c->next) c->isurgent = False;
if(ISVISIBLE(c) && c->isurgent) { if(!(wmh = XGetWMHints(dpy, c->win)))
c->isurgent = False; return;
if (!(wmh = XGetWMHints(dpy, c->win))) wmh->flags &= ~XUrgencyHint;
continue; XSetWMHints(dpy, c->win, wmh);
XFree(wmh);
wmh->flags &= ~XUrgencyHint;
XSetWMHints(dpy, c->win, wmh);
XFree(wmh);
}
} }
void void
@ -618,6 +612,8 @@ focus(Client *c) {
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
} }
if(c) { if(c) {
if(c->isurgent)
clearurgent(c);
detachstack(c); detachstack(c);
attachstack(c); attachstack(c);
grabbuttons(c, True); grabbuttons(c, True);
@ -1392,24 +1388,22 @@ showhide(Client *c) {
} }
} }
void
sigchld(int signal) {
while(0 < waitpid(-1, NULL, WNOHANG));
}
void void
spawn(const Arg *arg) { spawn(const Arg *arg) {
signal(SIGCHLD, sigchld); /* The double-fork construct avoids zombie processes and keeps the code
* clean from stupid signal handlers. */
if(fork() == 0) { if(fork() == 0) {
if(dpy) if(fork() == 0) {
close(ConnectionNumber(dpy)); if(dpy)
setsid(); close(ConnectionNumber(dpy));
execvp(((char **)arg->v)[0], (char **)arg->v); setsid();
fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); execvp(((char **)arg->v)[0], (char **)arg->v);
perror(" failed"); fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
perror(" failed");
}
exit(0); exit(0);
} }
wait(0);
} }
void void
@ -1503,7 +1497,6 @@ toggleview(const Arg *arg) {
if(mask) { if(mask) {
tagset[seltags] = mask; tagset[seltags] = mask;
clearurgent();
arrange(); arrange();
} }
} }
@ -1676,7 +1669,6 @@ view(const Arg *arg) {
seltags ^= 1; /* toggle sel tagset */ seltags ^= 1; /* toggle sel tagset */
if(arg->ui & TAGMASK) if(arg->ui & TAGMASK)
tagset[seltags] = arg->ui & TAGMASK; tagset[seltags] = arg->ui & TAGMASK;
clearurgent();
arrange(); arrange();
} }