summary refs log tree commit diff
path: root/calmwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/calmwm.c b/calmwm.c
index 4111d95..04acc2e 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -44,6 +44,7 @@ struct screen_q		 Screenq = TAILQ_HEAD_INITIALIZER(Screenq);
 struct conf		 Conf;
 volatile sig_atomic_t	 cwm_status;
 
+__dead void	usage(void);
 static void	sighdlr(int);
 static int	x_errorhandler(Display *, XErrorEvent *);
 static int	x_init(const char *);
@@ -88,11 +89,12 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
-	if (signal(SIGCHLD, sighdlr) == SIG_ERR)
+	if (signal(SIGCHLD, sighdlr) == SIG_ERR ||
+	    signal(SIGHUP, sighdlr) == SIG_ERR ||
+	    signal(SIGINT, sighdlr) == SIG_ERR ||
+	    signal(SIGTERM, sighdlr) == SIG_ERR)
 		err(1, "signal");
-	if (signal(SIGHUP, sighdlr) == SIG_ERR)
-		err(1, "signal");
-
+ 
 	if (parse_config(Conf.conf_file, &Conf) == -1) {
 		warnx("error parsing config file");
 		if (nflag)
@@ -126,7 +128,7 @@ main(int argc, char **argv)
 		u_exec(fallback);
 	}
 
-	return(0);
+	return 0;
 }
 
 static int
@@ -144,7 +146,7 @@ x_init(const char *dpyname)
 
 	Conf.xrandr = XRRQueryExtension(X_Dpy, &Conf.xrandr_event_base, &i);
 
-	conf_atoms();
+	xu_atom_init();
 	conf_cursor(&Conf);
 
 	for (i = 0; i < ScreenCount(X_Dpy); i++)
@@ -182,7 +184,7 @@ static int
 x_wmerrorhandler(Display *dpy, XErrorEvent *e)
 {
 	errx(1, "root window unavailable - perhaps another wm is running?");
-	return(0);
+	return 0;
 }
 
 static int
@@ -198,7 +200,7 @@ x_errorhandler(Display *dpy, XErrorEvent *e)
 
 	warnx("%s(0x%x): %s", req, (unsigned int)e->resourceid, msg);
 #endif
-	return(0);
+	return 0;
 }
 
 static void
@@ -217,6 +219,10 @@ sighdlr(int sig)
 	case SIGHUP:
 		cwm_status = CWM_EXEC_WM;
 		break;
+	case SIGINT:
+	case SIGTERM:
+		cwm_status = CWM_QUIT;
+		break;
 	}
 
 	errno = save_errno;