dwm.c
changeset 1496 de4a2998e1f5
parent 1495 c4c94cff1c3b
child 1497 20de01c5ff82
equal deleted inserted replaced
1495:c4c94cff1c3b 1496:de4a2998e1f5
   119 	const char *symbol;
   119 	const char *symbol;
   120 	void (*arrange)(Monitor *);
   120 	void (*arrange)(Monitor *);
   121 } Layout;
   121 } Layout;
   122 
   122 
   123 struct Monitor {
   123 struct Monitor {
   124 	const char *ltsymbol;
   124 	char ltsymbol[16];
   125 	float mfact;
   125 	float mfact;
   126 	int num;
   126 	int num;
   127 	int by;               /* bar geometry */
   127 	int by;               /* bar geometry */
   128 	int mx, my, mw, mh;   /* screen size */
   128 	int mx, my, mw, mh;   /* screen size */
   129 	int wx, wy, ww, wh;   /* window area  */
   129 	int wx, wy, ww, wh;   /* window area  */
   384 
   384 
   385 	for(m = mons; m; m = m->next)
   385 	for(m = mons; m; m = m->next)
   386 		showhide(m->stack);
   386 		showhide(m->stack);
   387 	focus(NULL);
   387 	focus(NULL);
   388 	for(m = mons; m; m = m->next) {
   388 	for(m = mons; m; m = m->next) {
   389 		m->ltsymbol = m->lt[m->sellt]->symbol;
   389 		strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
   390 		if(m->lt[m->sellt]->arrange)
   390 		if(m->lt[m->sellt]->arrange)
   391 			m->lt[m->sellt]->arrange(m);
   391 			m->lt[m->sellt]->arrange(m);
   392 		restack(m);
   392 		restack(m);
   393 	}
   393 	}
   394 }
   394 }
   603 	m->mfact = mfact;
   603 	m->mfact = mfact;
   604 	m->showbar = showbar;
   604 	m->showbar = showbar;
   605 	m->topbar = topbar;
   605 	m->topbar = topbar;
   606 	m->lt[0] = &layouts[0];
   606 	m->lt[0] = &layouts[0];
   607 	m->lt[1] = &layouts[1 % LENGTH(layouts)];
   607 	m->lt[1] = &layouts[1 % LENGTH(layouts)];
   608 	m->ltsymbol = layouts[0].symbol;
   608 	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
   609 	return m;
   609 	return m;
   610 }
   610 }
   611 
   611 
   612 void
   612 void
   613 destroynotify(XEvent *e) {
   613 destroynotify(XEvent *e) {
  1161 		manage(ev->window, &wa);
  1161 		manage(ev->window, &wa);
  1162 }
  1162 }
  1163 
  1163 
  1164 void
  1164 void
  1165 monocle(Monitor *m) {
  1165 monocle(Monitor *m) {
  1166 	static char ntext[8];
       
  1167 	unsigned int n = 0;
  1166 	unsigned int n = 0;
  1168 	Client *c;
  1167 	Client *c;
  1169 
  1168 
  1170 	for(c = m->clients; c; c = c->next)
  1169 	for(c = m->clients; c; c = c->next)
  1171 		if(ISVISIBLE(c))
  1170 		if(ISVISIBLE(c))
  1172 			n++;
  1171 			n++;
  1173 	if(n > 0) { /* override layout symbol */
  1172 	if(n > 0) /* override layout symbol */
  1174 		snprintf(ntext, sizeof ntext, "[%d]", n);
  1173 		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
  1175 		m->ltsymbol = ntext;
       
  1176 	}
       
  1177 	for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
  1174 	for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
  1178 		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
  1175 		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
  1179 }
  1176 }
  1180 
  1177 
  1181 void
  1178 void