about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2010-04-01 00:14:15 +0100
committerAnselm R Garbe <anselm@garbe.us>2010-04-01 00:14:15 +0100
commitaa9f2be24ea9ea6d9419cad1975bf34c5b64b6e5 (patch)
tree5bde4c862fd4e25b886468c910c61537b1dffa93 /dwm.c
parentc53b29e60b1fcc0f7f095eaabccf38b3630e28fa (diff)
downloaddwm-aa9f2be24ea9ea6d9419cad1975bf34c5b64b6e5.tar.gz
more debug output, experimental focus optimisation
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index b989e8a..b1f77cc 100644
--- a/dwm.c
+++ b/dwm.c
@@ -815,8 +815,12 @@ void
 focus(Client *c) {
 	if(!c || !ISVISIBLE(c))
 		for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
-/*	if(selmon->sel)
-		unfocus(selmon->sel);*/
+	if(c && c == selmon->sel) {
+		D fprintf(stderr, "focus, optimising focus away\n");
+		return;
+	}
+	if(selmon->sel)
+		unfocus(selmon->sel);
 	if(c) {
 		if(c->mon != selmon)
 			selmon = c->mon;
@@ -848,7 +852,8 @@ focusmon(const Arg *arg) {
 
 	if(!mons->next)
 		return;
-	m = dirtomon(arg->i);
+	if((m = dirtomon(arg->i)) == selmon)
+		return;
 	unfocus(selmon->sel);
 	selmon = m;
 	focus(NULL);
@@ -1406,7 +1411,7 @@ run(void) {
 	/* main event loop */
 	XSync(dpy, False);
 	while(running && !XNextEvent(dpy, &ev)) {
-		D fprintf(stderr, "run event %s\n", evname[ev.type]);
+		D fprintf(stderr, "run event %s %ld\n", evname[ev.type], ev.xany.window);
 		if(handler[ev.type])
 			handler[ev.type](&ev); /* call handler */
 	}