more debug output, experimental focus optimisation

This commit is contained in:
Anselm R Garbe 2010-04-01 00:14:15 +01:00
parent c53b29e60b
commit aa9f2be24e

13
dwm.c
View file

@ -815,8 +815,12 @@ void
focus(Client *c) { focus(Client *c) {
if(!c || !ISVISIBLE(c)) if(!c || !ISVISIBLE(c))
for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
/* if(selmon->sel) if(c && c == selmon->sel) {
unfocus(selmon->sel);*/ D fprintf(stderr, "focus, optimising focus away\n");
return;
}
if(selmon->sel)
unfocus(selmon->sel);
if(c) { if(c) {
if(c->mon != selmon) if(c->mon != selmon)
selmon = c->mon; selmon = c->mon;
@ -848,7 +852,8 @@ focusmon(const Arg *arg) {
if(!mons->next) if(!mons->next)
return; return;
m = dirtomon(arg->i); if((m = dirtomon(arg->i)) == selmon)
return;
unfocus(selmon->sel); unfocus(selmon->sel);
selmon = m; selmon = m;
focus(NULL); focus(NULL);
@ -1406,7 +1411,7 @@ run(void) {
/* main event loop */ /* main event loop */
XSync(dpy, False); XSync(dpy, False);
while(running && !XNextEvent(dpy, &ev)) { 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]) if(handler[ev.type])
handler[ev.type](&ev); /* call handler */ handler[ev.type](&ev); /* call handler */
} }