diff options
| author | Anselm R Garbe <anselm@garbe.us> | 2009-06-27 18:50:50 +0100 |
|---|---|---|
| committer | Anselm R Garbe <anselm@garbe.us> | 2009-06-27 18:50:50 +0100 |
| commit | 029655bb2271a18d3a191f22502cbd9b713a9189 (patch) | |
| tree | ce6bc8068cc81ab706186b374ab042ca8eebd4fc /dwm.c | |
| parent | using mon in function names for consistency reasons (diff) | |
| download | dwm-029655bb2271a18d3a191f22502cbd9b713a9189.tar.gz dwm-029655bb2271a18d3a191f22502cbd9b713a9189.zip | |
some cleanup handling for index based mon search
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 39 |
1 files changed, 19 insertions, 20 deletions
| @@ -177,6 +177,7 @@ static void focusstack(const Arg *arg); | |||
| 177 | static Client *getclient(Window w); | 177 | static Client *getclient(Window w); |
| 178 | static unsigned long getcolor(const char *colstr); | 178 | static unsigned long getcolor(const char *colstr); |
| 179 | static Monitor *getmon(Window w); | 179 | static Monitor *getmon(Window w); |
| 180 | static Monitor *getmonn(unsigned int n); | ||
| 180 | static Monitor *getmonxy(int x, int y); | 181 | static Monitor *getmonxy(int x, int y); |
| 181 | static Bool getrootpointer(int *x, int *y); | 182 | static Bool getrootpointer(int *x, int *y); |
| 182 | static long getstate(Window w); | 183 | static long getstate(Window w); |
| @@ -800,18 +801,13 @@ focusin(XEvent *e) { /* there are some broken focus acquiring clients */ | |||
| 800 | #ifdef XINERAMA | 801 | #ifdef XINERAMA |
| 801 | void | 802 | void |
| 802 | focusmon(const Arg *arg) { | 803 | focusmon(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 | ||
| 882 | Monitor * | 878 | Monitor * |
| 879 | getmonn(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 | |||
| 887 | Monitor * | ||
| 883 | getmonxy(int x, int y) { | 888 | getmonxy(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 |
| 1543 | void | 1548 | void |
| 1544 | tagmon(const Arg *arg) { | 1549 | tagmon(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 | ||
