dwm.c
changeset 1075 e3916ef44cf0
parent 1073 c3e31814aecc
child 1076 591632523d96
equal deleted inserted replaced
1074:239bb2d7c7da 1075:e3916ef44cf0
   295 	if(ch.res_class)
   295 	if(ch.res_class)
   296 		XFree(ch.res_class);
   296 		XFree(ch.res_class);
   297 	if(ch.res_name)
   297 	if(ch.res_name)
   298 		XFree(ch.res_name);
   298 		XFree(ch.res_name);
   299 	if(!matched_tag)
   299 	if(!matched_tag)
   300 		memcpy(c->tags, monitors[monitorat(-1, -1)].seltags, sizeof seltags);
   300 		memcpy(c->tags, monitors[monitorat(-1, -1)].seltags, sizeof initags);
   301 	if (!matched_monitor)
   301 	if (!matched_monitor)
   302 		c->monitor = monitorat(-1, -1);
   302 		c->monitor = monitorat(-1, -1);
   303 }
   303 }
   304 
   304 
   305 void
   305 void
  1054 	Window trans;
  1054 	Window trans;
  1055 	Status rettrans;
  1055 	Status rettrans;
  1056 	XWindowChanges wc;
  1056 	XWindowChanges wc;
  1057 
  1057 
  1058 	c = emallocz(sizeof(Client));
  1058 	c = emallocz(sizeof(Client));
  1059 	c->tags = emallocz(sizeof seltags);
  1059 	c->tags = emallocz(sizeof initags);
  1060 	c->win = w;
  1060 	c->win = w;
  1061 
  1061 
  1062 	applyrules(c);
  1062 	applyrules(c);
  1063 	Monitor *m = &monitors[c->monitor];
  1063 	Monitor *m = &monitors[c->monitor];
  1064 
  1064 
  1098 	grabbuttons(c, False);
  1098 	grabbuttons(c, False);
  1099 	updatetitle(c);
  1099 	updatetitle(c);
  1100 	if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
  1100 	if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
  1101 		for(t = clients; t && t->win != trans; t = t->next);
  1101 		for(t = clients; t && t->win != trans; t = t->next);
  1102 	if(t)
  1102 	if(t)
  1103 		memcpy(c->tags, t->tags, sizeof seltags);
  1103 		memcpy(c->tags, t->tags, sizeof initags);
  1104 	if(!c->isfloating)
  1104 	if(!c->isfloating)
  1105 		c->isfloating = (rettrans == Success) || c->isfixed;
  1105 		c->isfloating = (rettrans == Success) || c->isfixed;
  1106 	attach(c);
  1106 	attach(c);
  1107 	attachstack(c);
  1107 	attachstack(c);
  1108 	XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); /* some windows require this */
  1108 	XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); /* some windows require this */
  1179 			if(abs(m->way - ny) < SNAP)
  1179 			if(abs(m->way - ny) < SNAP)
  1180 				ny = m->way;
  1180 				ny = m->way;
  1181 			else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP)
  1181 			else if(abs((m->way + m->wah) - (ny + c->h + 2 * c->border)) < SNAP)
  1182 				ny = m->way + m->wah - c->h - 2 * c->border;
  1182 				ny = m->way + m->wah - c->h - 2 * c->border;
  1183 			resize(c, nx, ny, c->w, c->h, False);
  1183 			resize(c, nx, ny, c->w, c->h, False);
  1184 			memcpy(c->tags, monitors[monitorat(nx, ny)].seltags, sizeof seltags);
  1184 			memcpy(c->tags, monitors[monitorat(nx, ny)].seltags, sizeof initags);
  1185 			break;
  1185 			break;
  1186 		}
  1186 		}
  1187 	}
  1187 	}
  1188 }
  1188 }
  1189 
  1189 
  1589 			monitors[i].sw = DisplayWidth(dpy, screen);
  1589 			monitors[i].sw = DisplayWidth(dpy, screen);
  1590 			monitors[i].sh = DisplayHeight(dpy, screen);
  1590 			monitors[i].sh = DisplayHeight(dpy, screen);
  1591 		}
  1591 		}
  1592 
  1592 
  1593 		monitors[i].id = i;
  1593 		monitors[i].id = i;
  1594 		monitors[i].seltags = emallocz(LENGTH(tags)*sizeof(char*));
  1594 		monitors[i].seltags = emallocz(sizeof initags);
  1595 		monitors[i].prevtags = emallocz(LENGTH(tags)*sizeof(char*));
  1595 		monitors[i].prevtags = emallocz(sizeof initags);
  1596 
  1596 
  1597 		memcpy(monitors[i].seltags, seltags, sizeof seltags);
  1597 		memcpy(monitors[i].seltags, initags, sizeof initags);
  1598 		memcpy(monitors[i].prevtags, seltags, sizeof seltags);
  1598 		memcpy(monitors[i].prevtags, initags, sizeof initags);
  1599 
  1599 
  1600 		/* init appearance */
  1600 		/* init appearance */
  1601 		monitors[i].dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
  1601 		monitors[i].dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
  1602 		monitors[i].dc.norm[ColBG] = getcolor(NORMBGCOLOR);
  1602 		monitors[i].dc.norm[ColBG] = getcolor(NORMBGCOLOR);
  1603 		monitors[i].dc.norm[ColFG] = getcolor(NORMFGCOLOR);
  1603 		monitors[i].dc.norm[ColFG] = getcolor(NORMFGCOLOR);
  1948 view(const char *arg) {
  1948 view(const char *arg) {
  1949 	unsigned int i;
  1949 	unsigned int i;
  1950 
  1950 
  1951 	Monitor *m = &monitors[monitorat(-1, -1)];
  1951 	Monitor *m = &monitors[monitorat(-1, -1)];
  1952 
  1952 
  1953 	memcpy(m->prevtags, seltags, sizeof seltags);
  1953 	memcpy(m->prevtags, m->seltags, sizeof initags);
  1954 	for(i = 0; i < LENGTH(tags); i++)
  1954 	for(i = 0; i < LENGTH(tags); i++)
  1955 		m->seltags[i] = (NULL == arg);
  1955 		m->seltags[i] = (NULL == arg);
  1956 	m->seltags[idxoftag(arg)] = True;
  1956 	m->seltags[idxoftag(arg)] = True;
  1957 	arrange();
  1957 	arrange();
  1958 }
  1958 }
  1961 viewprevtag(const char *arg) {
  1961 viewprevtag(const char *arg) {
  1962 	static Bool tmp[LENGTH(tags)];
  1962 	static Bool tmp[LENGTH(tags)];
  1963 
  1963 
  1964 	Monitor *m = &monitors[monitorat(-1, -1)];
  1964 	Monitor *m = &monitors[monitorat(-1, -1)];
  1965 
  1965 
  1966 	memcpy(tmp, m->seltags, sizeof seltags);
  1966 	memcpy(tmp, m->seltags, sizeof initags);
  1967 	memcpy(m->seltags, m->prevtags, sizeof seltags);
  1967 	memcpy(m->seltags, m->prevtags, sizeof initags);
  1968 	memcpy(m->prevtags, tmp, sizeof seltags);
  1968 	memcpy(m->prevtags, tmp, sizeof initags);
  1969 	arrange();
  1969 	arrange();
  1970 }
  1970 }
  1971 
  1971 
  1972 void
  1972 void
  1973 zoom(const char *arg) {
  1973 zoom(const char *arg) {
  2009 void
  2009 void
  2010 movetomonitor(const char *arg) {
  2010 movetomonitor(const char *arg) {
  2011 	if (sel) {
  2011 	if (sel) {
  2012 		sel->monitor = arg ? atoi(arg) : (sel->monitor+1) % mcount;
  2012 		sel->monitor = arg ? atoi(arg) : (sel->monitor+1) % mcount;
  2013 
  2013 
  2014 		memcpy(sel->tags, monitors[sel->monitor].seltags, sizeof seltags);
  2014 		memcpy(sel->tags, monitors[sel->monitor].seltags, sizeof initags);
  2015 		resize(sel, monitors[sel->monitor].wax, monitors[sel->monitor].way, sel->w, sel->h, True);
  2015 		resize(sel, monitors[sel->monitor].wax, monitors[sel->monitor].way, sel->w, sel->h, True);
  2016 		arrange();
  2016 		arrange();
  2017 	}
  2017 	}
  2018 }
  2018 }
  2019 
  2019