equal
deleted
inserted
replaced
813 |
813 |
814 void |
814 void |
815 focus(Client *c) { |
815 focus(Client *c) { |
816 if(!c || !ISVISIBLE(c)) |
816 if(!c || !ISVISIBLE(c)) |
817 for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); |
817 for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext); |
818 /* if(selmon->sel) |
818 if(c && c == selmon->sel) { |
819 unfocus(selmon->sel);*/ |
819 D fprintf(stderr, "focus, optimising focus away\n"); |
|
820 return; |
|
821 } |
|
822 if(selmon->sel) |
|
823 unfocus(selmon->sel); |
820 if(c) { |
824 if(c) { |
821 if(c->mon != selmon) |
825 if(c->mon != selmon) |
822 selmon = c->mon; |
826 selmon = c->mon; |
823 if(c->isurgent) |
827 if(c->isurgent) |
824 clearurgent(c); |
828 clearurgent(c); |
846 focusmon(const Arg *arg) { |
850 focusmon(const Arg *arg) { |
847 Monitor *m = NULL; |
851 Monitor *m = NULL; |
848 |
852 |
849 if(!mons->next) |
853 if(!mons->next) |
850 return; |
854 return; |
851 m = dirtomon(arg->i); |
855 if((m = dirtomon(arg->i)) == selmon) |
|
856 return; |
852 unfocus(selmon->sel); |
857 unfocus(selmon->sel); |
853 selmon = m; |
858 selmon = m; |
854 focus(NULL); |
859 focus(NULL); |
855 } |
860 } |
856 |
861 |
1404 [UnmapNotify] = "unmapnotify" |
1409 [UnmapNotify] = "unmapnotify" |
1405 }; |
1410 }; |
1406 /* main event loop */ |
1411 /* main event loop */ |
1407 XSync(dpy, False); |
1412 XSync(dpy, False); |
1408 while(running && !XNextEvent(dpy, &ev)) { |
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 if(handler[ev.type]) |
1415 if(handler[ev.type]) |
1411 handler[ev.type](&ev); /* call handler */ |
1416 handler[ev.type](&ev); /* call handler */ |
1412 } |
1417 } |
1413 } |
1418 } |
1414 |
1419 |