dwm.c
changeset 1177 22d8c2fb999f
parent 1176 44df4a068f31
child 1178 e0095dbfc0af
equal deleted inserted replaced
1176:44df4a068f31 1177:22d8c2fb999f
   237 Client *sel = NULL;
   237 Client *sel = NULL;
   238 Client *stack = NULL;
   238 Client *stack = NULL;
   239 Cursor cursor[CurLast];
   239 Cursor cursor[CurLast];
   240 Display *dpy;
   240 Display *dpy;
   241 DC dc = {0};
   241 DC dc = {0};
   242 Geom *geom = NULL;
       
   243 Layout *lt = NULL;
       
   244 Window root, barwin;
   242 Window root, barwin;
   245 
   243 
   246 /* configuration, allows nested code to access above variables */
   244 /* configuration, allows nested code to access above variables */
   247 #include "config.h"
   245 #include "config.h"
   248 #define TAGSZ (LENGTH(tags) * sizeof(Bool))
   246 #define TAGSZ (LENGTH(tags) * sizeof(Bool))
   249 static Bool tmp[LENGTH(tags)];
   247 Bool tmp[LENGTH(tags)];
       
   248 Layout *lt = layouts;
       
   249 Geom *geom = geoms;
   250 
   250 
   251 /* function implementations */
   251 /* function implementations */
   252 
   252 
   253 void
   253 void
   254 applyrules(Client *c) {
   254 applyrules(Client *c) {
   262 	for(i = 0; i < LENGTH(rules); i++) {
   262 	for(i = 0; i < LENGTH(rules); i++) {
   263 		r = &rules[i];
   263 		r = &rules[i];
   264 		if((!r->title || strstr(c->name, r->title))
   264 		if((!r->title || strstr(c->name, r->title))
   265 		&& (!r->class || (ch.res_class && strstr(ch.res_class, r->class)))
   265 		&& (!r->class || (ch.res_class && strstr(ch.res_class, r->class)))
   266 		&& (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) {
   266 		&& (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) {
   267 		{
       
   268 			c->isfloating = r->isfloating;
   267 			c->isfloating = r->isfloating;
   269 			if(r->tag) {
   268 			if(r->tag) {
   270 				c->tags[idxoftag(r->tag)] = True;
   269 				c->tags[idxoftag(r->tag)] = True;
   271 				matched = True;
   270 				matched = True;
   272 			}
   271 			}
  1481 	sy = 0;
  1480 	sy = 0;
  1482 	sw = DisplayWidth(dpy, screen);
  1481 	sw = DisplayWidth(dpy, screen);
  1483 	sh = DisplayHeight(dpy, screen);
  1482 	sh = DisplayHeight(dpy, screen);
  1484 	bh = dc.font.height + 2;
  1483 	bh = dc.font.height + 2;
  1485 	mfact = MFACT;
  1484 	mfact = MFACT;
  1486 	geom = &geoms[0];
       
  1487 	geom->apply();
  1485 	geom->apply();
  1488 
  1486 
  1489 	/* init atoms */
  1487 	/* init atoms */
  1490 	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
  1488 	wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
  1491 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
  1489 	wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
  1516 
  1514 
  1517 	/* init tags */
  1515 	/* init tags */
  1518 	seltags = emallocz(TAGSZ);
  1516 	seltags = emallocz(TAGSZ);
  1519 	prevtags = emallocz(TAGSZ);
  1517 	prevtags = emallocz(TAGSZ);
  1520 	seltags[0] = prevtags[0] = True;
  1518 	seltags[0] = prevtags[0] = True;
  1521 
       
  1522 	/* init layouts */
       
  1523 	lt = &layouts[0];
       
  1524 
  1519 
  1525 	/* init bar */
  1520 	/* init bar */
  1526 	for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {
  1521 	for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {
  1527 		w = textw(layouts[i].symbol);
  1522 		w = textw(layouts[i].symbol);
  1528 		if(w > blw)
  1523 		if(w > blw)
  1932 	cleanup();
  1927 	cleanup();
  1933 
  1928 
  1934 	XCloseDisplay(dpy);
  1929 	XCloseDisplay(dpy);
  1935 	return 0;
  1930 	return 0;
  1936 }
  1931 }
       
  1932