summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dwm.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/dwm.c b/dwm.c
index 5934a6c..04fcc90 100644
--- a/dwm.c
+++ b/dwm.c
@@ -177,6 +177,7 @@ static void focusstack(const Arg *arg);
177static Client *getclient(Window w); 177static Client *getclient(Window w);
178static unsigned long getcolor(const char *colstr); 178static unsigned long getcolor(const char *colstr);
179static Monitor *getmon(Window w); 179static Monitor *getmon(Window w);
180static Monitor *getmonn(unsigned int n);
180static Monitor *getmonxy(int x, int y); 181static Monitor *getmonxy(int x, int y);
181static Bool getrootpointer(int *x, int *y); 182static Bool getrootpointer(int *x, int *y);
182static long getstate(Window w); 183static long getstate(Window w);
@@ -800,18 +801,13 @@ focusin(XEvent *e) { /* there are some broken focus acquiring clients */
800#ifdef XINERAMA 801#ifdef XINERAMA
801void 802void
802focusmon(const Arg *arg) { 803focusmon(const Arg *arg) {
803 unsigned int i; 804 Monitor *m;
804 Monitor *m; 805
805 806 if(!(m = getmonn(arg->ui)) || m == selmon)
806 for(i = 0, m = mons; m; m = m->next, i++) 807 return;
807 if(i == arg->ui) { 808 unfocus(selmon->sel);
808 if(m == selmon) 809 selmon = m;
809 return; 810 focus(NULL);
810 unfocus(selmon->sel);
811 selmon = m;
812 focus(NULL);
813 break;
814 }
815} 811}
816#endif /* XINERAMA */ 812#endif /* XINERAMA */
817 813
@@ -880,6 +876,15 @@ getmon(Window w) {
880} 876}
881 877
882Monitor * 878Monitor *
879getmonn(unsigned int n) {
880 unsigned int i;
881 Monitor *m;
882
883 for(m = mons, i = 0; m && i != n; m = m->next, i++);
884 return m;
885}
886
887Monitor *
883getmonxy(int x, int y) { 888getmonxy(int x, int y) {
884 Monitor *m; 889 Monitor *m;
885 890
@@ -1542,17 +1547,11 @@ tag(const Arg *arg) {
1542#ifdef XINERAMA 1547#ifdef XINERAMA
1543void 1548void
1544tagmon(const Arg *arg) { 1549tagmon(const Arg *arg) {
1545 unsigned int i;
1546 Client *c;
1547 Monitor *m; 1550 Monitor *m;
1548 1551
1549 if(!(c = selmon->sel)) 1552 if(!selmon->sel || !(m = getmonn(arg->ui)))
1550 return; 1553 return;
1551 for(i = 0, m = mons; m; m = m->next, i++) 1554 sendmon(selmon->sel, m);
1552 if(i == arg->ui) {
1553 sendmon(c, m);
1554 break;
1555 }
1556} 1555}
1557#endif /* XINERAMA */ 1556#endif /* XINERAMA */
1558 1557