dwm.c
changeset 1427 f8ea02f86861
parent 1426 f8ee1d055e66
child 1428 2245e2b88983
equal deleted inserted replaced
1426:f8ee1d055e66 1427:f8ea02f86861
   175 static void focusin(XEvent *e);
   175 static void focusin(XEvent *e);
   176 static void focusstack(const Arg *arg);
   176 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);
   183 static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
   184 static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
   184 static void grabbuttons(Client *c, Bool focused);
   185 static void grabbuttons(Client *c, Bool focused);
   798 }
   799 }
   799 
   800 
   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 
   818 void
   814 void
   819 focusstack(const Arg *arg) {
   815 focusstack(const Arg *arg) {
   875 		if(w == m->barwin)
   871 		if(w == m->barwin)
   876 			return m;
   872 			return m;
   877 	if((c = getclient(w)))
   873 	if((c = getclient(w)))
   878 		return c->mon;
   874 		return c->mon;
   879 	return NULL;
   875 	return NULL;
       
   876 }
       
   877 
       
   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;
   880 }
   885 }
   881 
   886 
   882 Monitor *
   887 Monitor *
   883 getmonxy(int x, int y) {
   888 getmonxy(int x, int y) {
   884 	Monitor *m;
   889 	Monitor *m;
  1540 }
  1545 }
  1541 
  1546 
  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 
  1559 int
  1558 int
  1560 textnw(const char *text, unsigned int len) {
  1559 textnw(const char *text, unsigned int len) {