Improved buttonhandler
This commit is contained in:
parent
30103c0c07
commit
365a047960
19
dwmblocks.c
19
dwmblocks.c
|
@ -44,25 +44,24 @@ void
|
||||||
buttonhandler(int signal, siginfo_t *si, void *ucontext)
|
buttonhandler(int signal, siginfo_t *si, void *ucontext)
|
||||||
{
|
{
|
||||||
signal = si->si_value.sival_int >> 8;
|
signal = si->si_value.sival_int >> 8;
|
||||||
switch (fork()) {
|
for (Block *current = blocks; current->pathu; current++)
|
||||||
case -1:
|
if (current->signal == signal)
|
||||||
perror("buttonhandler - fork");
|
switch (fork()) {
|
||||||
exit(1);
|
case -1:
|
||||||
case 0:
|
perror("buttonhandler - fork");
|
||||||
close(ConnectionNumber(dpy));
|
break;
|
||||||
for (Block *current = blocks; current->pathu; current++) {
|
case 0:
|
||||||
if (current->signal == signal) {
|
{
|
||||||
char button[] = { '0' + (si->si_value.sival_int & 0xff), '\0' };
|
char button[] = { '0' + (si->si_value.sival_int & 0xff), '\0' };
|
||||||
char *arg[] = { current->pathc, button, NULL };
|
char *arg[] = { current->pathc, button, NULL };
|
||||||
|
|
||||||
|
close(ConnectionNumber(dpy));
|
||||||
setsid();
|
setsid();
|
||||||
execv(arg[0], arg);
|
execv(arg[0], arg);
|
||||||
perror("buttonhandler - child - execv");
|
perror("buttonhandler - child - execv");
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue