summary refs log tree commit diff
path: root/calmwm.c
diff options
context:
space:
mode:
authorokan <okan>2019-03-11 15:25:46 +0000
committerokan <okan>2019-03-11 15:25:46 +0000
commit85d88f33042f7c397b75513e1561b361815caad7 (patch)
tree5ce311934b167cd4b8514edf062923fd2910eb84 /calmwm.c
parent412b0c9ef4429d48c200910ffcc8a18b60f815ea (diff)
parent9a7528f5b99bd234f724aa229cbf75fb6a813282 (diff)
downloadcwm-85d88f33042f7c397b75513e1561b361815caad7.tar.gz
cwm-85d88f33042f7c397b75513e1561b361815caad7.tar.xz
cwm-85d88f33042f7c397b75513e1561b361815caad7.zip
cvsimport
* refs/heads/master: (23 commits)
  Check the atom type on propertynotify before iterating.
  use screen_find() for xrandr crtc changes
  Find the managed screen from the parent window for client_current().
  Print window id in hex; while here, remove unnecessary newline.
  Similar to keypress event, fetch the screen from the event root window in the buttonpress handler; bail if we don't manage the screen. Allows us to find the current client based on the screen/event root.
  extend verbose logging for key/button events
  [keypress event] turns out we've been checking the wrong window for a matching client thus always falling back to client_current(); while the current client is problaby right in most cases, use event's subwindow (not window) to find the client. Bail early if this event came to us from a screen we don't manage. This is result of us grabing all keybindings off the root window instead of selectively.
  add parans for readibility
  Teach client_current() to use a screen to find the current client instead of iterating over all (fallback if no screen provided for now). Initially convert trivial uses of client_current().
  check cc->gc directly
  zip extra lines
  gc clientq inside groups, instead use the better maintained one per-screen
  shuffle deck chairs: rename group actions to match intent for clarity
  same thing as screen_find()
  Separate out the menu window from the client resize/move geom window; in each case, create and destroy on-demand. Isolate more menu specific code.
  fix a few misplaced (and misnamed) ewmh root window functions
  _NET_WORKAREA needs ngroups, so screen_update_geometry() needs to come after conf_group().
  simplify xftcolor config
  Tie group number and name together during config.
  Move the group index (desktop number) check to the only 2 callers that require checking due to ewmh.
  ...
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/calmwm.c b/calmwm.c
index c809695..4111d95 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -55,7 +55,7 @@ main(int argc, char **argv)
 {
 	char		*display_name = NULL;
 	char		*fallback;
-	int		 ch, xfd;
+	int		 ch, xfd, nflag = 0;
 	struct pollfd	 pfd[1];
 
 	if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
@@ -66,7 +66,7 @@ main(int argc, char **argv)
 
 	fallback = u_argv(argv);
 	Conf.wm_argv = u_argv(argv);
-	while ((ch = getopt(argc, argv, "c:d:v")) != -1) {
+	while ((ch = getopt(argc, argv, "c:d:nv")) != -1) {
 		switch (ch) {
 		case 'c':
 			free(Conf.conf_file);
@@ -75,6 +75,9 @@ main(int argc, char **argv)
 		case 'd':
 			display_name = optarg;
 			break;
+		case 'n':
+			nflag = 1;
+			break;
 		case 'v':
 			Conf.debug++;
 			break;
@@ -90,8 +93,13 @@ main(int argc, char **argv)
 	if (signal(SIGHUP, sighdlr) == SIG_ERR)
 		err(1, "signal");
 
-	if (parse_config(Conf.conf_file, &Conf) == -1)
+	if (parse_config(Conf.conf_file, &Conf) == -1) {
 		warnx("error parsing config file");
+		if (nflag)
+			return 1;
+	}
+	if (nflag)
+		return 0;
 
 	xfd = x_init(display_name);
 	cwm_status = CWM_RUNNING;
@@ -159,8 +167,6 @@ x_teardown(void)
 			    DefaultColormap(X_Dpy, sc->which),
 			    &sc->xftcolor[i]);
 		XftFontClose(X_Dpy, sc->xftfont);
-		XftDrawDestroy(sc->menu.xftdraw);
-		XDestroyWindow(X_Dpy, sc->menu.win);
 		XUngrabKey(X_Dpy, AnyKey, AnyModifier, sc->rootwin);
 	}
 	XUngrabPointer(X_Dpy, CurrentTime);
@@ -221,7 +227,7 @@ usage(void)
 {
 	extern char	*__progname;
 
-	(void)fprintf(stderr, "usage: %s [-v] [-c file] [-d display]\n",
+	(void)fprintf(stderr, "usage: %s [-nv] [-c file] [-d display]\n",
 	    __progname);
 	exit(1);
 }