more debug output, experimental focus optimisation
aa9f2be2
1 file(s) · +9 −4
| 815 | 815 | focus(Client *c) { |
|
| 816 | 816 | if(!c || !ISVISIBLE(c)) |
|
| 817 | 817 | for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); |
|
| 818 | - | /* if(selmon->sel) |
|
| 819 | - | unfocus(selmon->sel);*/ |
|
| 818 | + | if(c && c == selmon->sel) { |
|
| 819 | + | D fprintf(stderr, "focus, optimising focus away\n"); |
|
| 820 | + | return; |
|
| 821 | + | } |
|
| 822 | + | if(selmon->sel) |
|
| 823 | + | unfocus(selmon->sel); |
|
| 820 | 824 | if(c) { |
|
| 821 | 825 | if(c->mon != selmon) |
|
| 822 | 826 | selmon = c->mon; |
|
| 848 | 852 | ||
| 849 | 853 | if(!mons->next) |
|
| 850 | 854 | return; |
|
| 851 | - | m = dirtomon(arg->i); |
|
| 855 | + | if((m = dirtomon(arg->i)) == selmon) |
|
| 856 | + | return; |
|
| 852 | 857 | unfocus(selmon->sel); |
|
| 853 | 858 | selmon = m; |
|
| 854 | 859 | focus(NULL); |
|
| 1406 | 1411 | /* main event loop */ |
|
| 1407 | 1412 | XSync(dpy, False); |
|
| 1408 | 1413 | while(running && !XNextEvent(dpy, &ev)) { |
|
| 1409 | - | D fprintf(stderr, "run event %s\n", evname[ev.type]); |
|
| 1414 | + | D fprintf(stderr, "run event %s %ld\n", evname[ev.type], ev.xany.window); |
|
| 1410 | 1415 | if(handler[ev.type]) |
|
| 1411 | 1416 | handler[ev.type](&ev); /* call handler */ |
|
| 1412 | 1417 | } |
|