dwm.c
changeset 1046 74aca4c70765
parent 1045 8a79aa547b6e
child 1047 ef0b927bf16c
equal deleted inserted replaced
1045:8a79aa547b6e 1046:74aca4c70765
   664 
   664 
   665 void
   665 void
   666 expose(XEvent *e) {
   666 expose(XEvent *e) {
   667 	XExposeEvent *ev = &e->xexpose;
   667 	XExposeEvent *ev = &e->xexpose;
   668 
   668 
   669 	if(ev->count == 0) {
   669 	if(0 == ev->count) {
   670 		if(barwin == ev->window)
   670 		if(barwin == ev->window)
   671 			drawbar();
   671 			drawbar();
   672 	}
   672 	}
   673 }
   673 }
   674 
   674 
   778 gettextprop(Window w, Atom atom, char *text, unsigned int size) {
   778 gettextprop(Window w, Atom atom, char *text, unsigned int size) {
   779 	char **list = NULL;
   779 	char **list = NULL;
   780 	int n;
   780 	int n;
   781 	XTextProperty name;
   781 	XTextProperty name;
   782 
   782 
   783 	if(!text || size == 0)
   783 	if(!text || 0 == size)
   784 		return False;
   784 		return False;
   785 	text[0] = '\0';
   785 	text[0] = '\0';
   786 	XGetTextProperty(dpy, w, &name, atom);
   786 	XGetTextProperty(dpy, w, &name, atom);
   787 	if(!name.nitems)
   787 	if(!name.nitems)
   788 		return False;
   788 		return False;
  1396 	double delta;
  1396 	double delta;
  1397 
  1397 
  1398 	if(!(ISTILE))
  1398 	if(!(ISTILE))
  1399 		return;
  1399 		return;
  1400 	/* arg handling, manipulate mwfact */
  1400 	/* arg handling, manipulate mwfact */
  1401 	if(arg == NULL)
  1401 	if(NULL == arg)
  1402 		mwfact = MWFACT;
  1402 		mwfact = MWFACT;
  1403 	else if(1 == sscanf(arg, "%lf", &delta)) {
  1403 	else if(1 == sscanf(arg, "%lf", &delta)) {
  1404 		if(arg[0] == '+' || arg[0] == '-')
  1404 		if(arg[0] == '+' || arg[0] == '-')
  1405 			mwfact += delta;
  1405 			mwfact += delta;
  1406 		else
  1406 		else
  1513 		shell = "/bin/sh";
  1513 		shell = "/bin/sh";
  1514 	if(!arg)
  1514 	if(!arg)
  1515 		return;
  1515 		return;
  1516 	/* The double-fork construct avoids zombie processes and keeps the code
  1516 	/* The double-fork construct avoids zombie processes and keeps the code
  1517 	 * clean from stupid signal handlers. */
  1517 	 * clean from stupid signal handlers. */
  1518 	if(fork() == 0) {
  1518 	if(0 == fork()) {
  1519 		if(fork() == 0) {
  1519 		if(0 == fork()) {
  1520 			if(dpy)
  1520 			if(dpy)
  1521 				close(ConnectionNumber(dpy));
  1521 				close(ConnectionNumber(dpy));
  1522 			setsid();
  1522 			setsid();
  1523 			execl(shell, shell, "-c", arg, (char *)NULL);
  1523 			execl(shell, shell, "-c", arg, (char *)NULL);
  1524 			fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg);
  1524 			fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg);
  1574 	nx = wax;
  1574 	nx = wax;
  1575 	ny = way;
  1575 	ny = way;
  1576 	nw = 0; /* gcc stupidity requires this */
  1576 	nw = 0; /* gcc stupidity requires this */
  1577 	for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) {
  1577 	for(i = 0, c = mc = nexttiled(clients); c; c = nexttiled(c->next), i++) {
  1578 		c->ismax = False;
  1578 		c->ismax = False;
  1579 		if(i == 0) { /* master */
  1579 		if(0 == i) { /* master */
  1580 			nw = mw - 2 * c->border;
  1580 			nw = mw - 2 * c->border;
  1581 			nh = wah - 2 * c->border;
  1581 			nh = wah - 2 * c->border;
  1582 		}
  1582 		}
  1583 		else {  /* tile window */
  1583 		else {  /* tile window */
  1584 			if(i == 1) {
  1584 			if(i == 1) {
  1834 view(const char *arg) {
  1834 view(const char *arg) {
  1835 	unsigned int i;
  1835 	unsigned int i;
  1836 
  1836 
  1837 	memcpy(prevtags, seltags, sizeof seltags);
  1837 	memcpy(prevtags, seltags, sizeof seltags);
  1838 	for(i = 0; i < NTAGS; i++)
  1838 	for(i = 0; i < NTAGS; i++)
  1839 		seltags[i] = arg == NULL;
  1839 		seltags[i] = (NULL == arg);
  1840 	seltags[idxoftag(arg)] = True;
  1840 	seltags[idxoftag(arg)] = True;
  1841 	arrange();
  1841 	arrange();
  1842 }
  1842 }
  1843 
  1843 
  1844 void
  1844 void