aewl

diff main.c @ 532:651f2c868b31

code polishing, removed unnecessary newlines
author Anselm R. Garbe <arg@10kloc.org>
date Fri, 06 Oct 2006 11:50:15 +0200
parents 451f19d48845
children fe766305eed1
line diff
     1.1 --- a/main.c	Fri Oct 06 11:37:12 2006 +0200
     1.2 +++ b/main.c	Fri Oct 06 11:50:15 2006 +0200
     1.3 @@ -1,5 +1,4 @@
     1.4 -/*
     1.5 - * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
     1.6 +/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
     1.7   * See LICENSE file for license details.
     1.8   */
     1.9  
    1.10 @@ -93,12 +92,11 @@
    1.11  	netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
    1.12  	XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
    1.13  			PropModeReplace, (unsigned char *) netatom, NetLast);
    1.14 -
    1.15  	/* init cursors */
    1.16  	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
    1.17  	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
    1.18  	cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
    1.19 -
    1.20 +	/* init modifier map */
    1.21  	modmap = XGetModifierMapping(dpy);
    1.22  	for (i = 0; i < 8; i++) {
    1.23  		for (j = 0; j < modmap->max_keypermod; j++) {
    1.24 @@ -107,19 +105,16 @@
    1.25  		}
    1.26  	}
    1.27  	XFree(modmap);
    1.28 -
    1.29 +	/* select for events */
    1.30  	wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
    1.31  		| EnterWindowMask | LeaveWindowMask;
    1.32  	wa.cursor = cursor[CurNormal];
    1.33  	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
    1.34 -
    1.35  	grabkeys();
    1.36  	initrregs();
    1.37 -
    1.38  	for(ntags = 0; tags[ntags]; ntags++);
    1.39  	seltag = emallocz(sizeof(Bool) * ntags);
    1.40  	seltag[0] = True;
    1.41 -
    1.42  	/* style */
    1.43  	dc.norm[ColBG] = getcolor(NORMBGCOLOR);
    1.44  	dc.norm[ColFG] = getcolor(NORMFGCOLOR);
    1.45 @@ -128,13 +123,13 @@
    1.46  	dc.status[ColBG] = getcolor(STATUSBGCOLOR);
    1.47  	dc.status[ColFG] = getcolor(STATUSFGCOLOR);
    1.48  	setfont(FONT);
    1.49 - 
    1.50 +	/* geometry */
    1.51  	bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ?  textw(TILESYMBOL) : textw(FLOATSYMBOL);
    1.52  	sx = sy = 0;
    1.53  	sw = DisplayWidth(dpy, screen);
    1.54  	sh = DisplayHeight(dpy, screen);
    1.55  	master = MASTER;
    1.56 -
    1.57 +	/* bar */
    1.58  	bx = by = 0;
    1.59  	bw = sw;
    1.60  	dc.h = bh = dc.font.height + 2;
    1.61 @@ -146,13 +141,13 @@
    1.62  			CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
    1.63  	XDefineCursor(dpy, barwin, cursor[CurNormal]);
    1.64  	XMapRaised(dpy, barwin);
    1.65 -
    1.66 +	strcpy(stext, "dwm-"VERSION);
    1.67 +	/* pixmap for everything */
    1.68  	dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
    1.69  	dc.gc = XCreateGC(dpy, root, 0, 0);
    1.70  	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
    1.71 -
    1.72 +	/* multihead support */
    1.73  	issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
    1.74 -	strcpy(stext, "dwm-"VERSION);
    1.75  }
    1.76  
    1.77  /*
    1.78 @@ -204,8 +199,7 @@
    1.79  	readin = running = False;
    1.80  }
    1.81  
    1.82 -/*
    1.83 - * There's no way to check accesses to destroyed windows, thus those cases are
    1.84 +/* There's no way to check accesses to destroyed windows, thus those cases are
    1.85   * ignored (especially on UnmapNotify's).  Other types of errors call Xlibs
    1.86   * default error handler, which may call exit.
    1.87   */
    1.88 @@ -236,21 +230,17 @@
    1.89  	}
    1.90  	else if(argc != 1)
    1.91  		eprint("usage: dwm [-v]\n");
    1.92 -
    1.93  	dpy = XOpenDisplay(0);
    1.94  	if(!dpy)
    1.95  		eprint("dwm: cannot open display\n");
    1.96 -
    1.97  	xfd = ConnectionNumber(dpy);
    1.98  	screen = DefaultScreen(dpy);
    1.99  	root = RootWindow(dpy, screen);
   1.100 -
   1.101  	otherwm = False;
   1.102  	XSetErrorHandler(xerrorstart);
   1.103  	/* this causes an error if some other window manager is running */
   1.104  	XSelectInput(dpy, root, SubstructureRedirectMask);
   1.105  	XSync(dpy, False);
   1.106 -
   1.107  	if(otherwm)
   1.108  		eprint("dwm: another window manager is already running\n");
   1.109  
   1.110 @@ -258,7 +248,6 @@
   1.111  	XSetErrorHandler(NULL);
   1.112  	xerrorxlib = XSetErrorHandler(xerror);
   1.113  	XSync(dpy, False);
   1.114 -
   1.115  	setup();
   1.116  	drawstatus();
   1.117  	scan();
   1.118 @@ -291,6 +280,5 @@
   1.119  	}
   1.120  	cleanup();
   1.121  	XCloseDisplay(dpy);
   1.122 -
   1.123  	return 0;
   1.124  }