about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-06-12 13:10:14 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-06-12 13:10:14 +0100
commit709da0b85879f4ce3275993e4ffc1af2ca4dde93 (patch)
tree946894b4851b4ce9d8aa486fd8346f80064f3810 /dwm.c
parent5cd65f8cd85928a0f26c80a209c82781cb342365 (diff)
downloaddwm-709da0b85879f4ce3275993e4ffc1af2ca4dde93.tar.gz
some bugfixes of the patch application yesterday
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/dwm.c b/dwm.c
index 4153f41..d531965 100644
--- a/dwm.c
+++ b/dwm.c
@@ -315,23 +315,23 @@ buttonpress(XEvent *e) {
 	click = ClkRootWin;
 	if(ev->window == barwin) {
 		x = 0;
-		for(i = 0; i < LENGTH(tags) && ev->x >= x; i++) {
+		for(i = 0; i < LENGTH(tags) && ev->x >= x; i++)
 			x += TEXTW(tags[i]);
-			if(i < LENGTH(tags) || ev->x <= x)
-				click = i - 1;
-			else if(ev->x < x + blw)
-				click = ClkLtSymbol;
-			else if(ev->x > wx + ww - TEXTW(stext))
-				click = ClkStatusText;
-			else
-				click = ClkWinTitle;
-		}
+		if(i < LENGTH(tags) || ev->x <= x)
+			click = i - 1;
+		else if(ev->x < x + blw)
+			click = ClkLtSymbol;
+		else if(ev->x > wx + ww - TEXTW(stext))
+			click = ClkStatusText;
+		else
+			click = ClkWinTitle;
 	}
 	else if((c = getclient(ev->window)))
 		click = ClkClientWin;
 
 	for(i = 0; i < LENGTH(buttons); i++)
-		if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
+		if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
+		   && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
 			buttons[i].func(&buttons[i].arg);
 }
 
@@ -1646,7 +1646,7 @@ updatewmhints(Client *c) {
 void
 view(const Arg *arg) {
 	seltags ^= 1; /* toggle sel tagset */
-	if(arg && (arg->ui & TAGMASK) && (arg->ui & TAGMASK) != tagset[seltags ^ 1])
+	if(arg && (arg->ui & TAGMASK))
 		tagset[seltags] = arg->i & TAGMASK;
 	arrange();
 }
ighlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
 * © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
 * See LICENSE file for license details. */
#include "dwm.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>

/* extern */

void *
emallocz(unsigned int size) {
	void *res = calloc(1, size);

	if(!res)
		eprint("fatal: could not malloc() %u bytes\n", size);
	return res;
}

void
eprint(const char *errstr, ...) {
	va_list ap;

	va_start(ap, errstr);
	vfprintf(stderr, errstr, ap);
	va_end(ap);
	exit(EXIT_FAILURE);
}

void
spawn(const char *arg) {
	static char *shell = NULL;

	if(!shell && !(shell = getenv("SHELL")))
		shell = "/bin/sh";
	if(!arg)
		return;
	/* The double-fork construct avoids zombie processes and keeps the code
	 * clean from stupid signal handlers. */
	if(fork() == 0) {
		if(fork() == 0) {
			if(dpy)
				close(ConnectionNumber(dpy));
			setsid();
			execl(shell, shell, "-c", arg, (char *)NULL);
			fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg);
			perror(" failed");
		}
		exit(0);
	}
	wait(0);
}