dwm.c
changeset 994 201550f99b8e
parent 993 eab3406cff0c
child 995 693bda958a30
equal deleted inserted replaced
993:eab3406cff0c 994:201550f99b8e
   192 static int xerror(Display *dpy, XErrorEvent *ee);
   192 static int xerror(Display *dpy, XErrorEvent *ee);
   193 static int xerrordummy(Display *dsply, XErrorEvent *ee);
   193 static int xerrordummy(Display *dsply, XErrorEvent *ee);
   194 static int xerrorstart(Display *dsply, XErrorEvent *ee);
   194 static int xerrorstart(Display *dsply, XErrorEvent *ee);
   195 static void zoom(const char *arg);
   195 static void zoom(const char *arg);
   196 
   196 
   197 #include "config.h"
       
   198 
       
   199 /* variables */
   197 /* variables */
   200 static char stext[256];
   198 static char stext[256];
   201 static double mwfact = MWFACT;
   199 static double mwfact;
   202 static int screen, sx, sy, sw, sh, wax, way, waw, wah;
   200 static int screen, sx, sy, sw, sh, wax, way, waw, wah;
   203 static int (*xerrorxlib)(Display *, XErrorEvent *);
   201 static int (*xerrorxlib)(Display *, XErrorEvent *);
   204 static unsigned int bh;
   202 static unsigned int bh, bpos, ntags;
   205 static unsigned int blw = 0;
   203 static unsigned int blw = 0;
   206 static unsigned int bpos = BARPOS;
       
   207 static unsigned int ltidx = 0; /* default */
   204 static unsigned int ltidx = 0; /* default */
   208 static unsigned int nlayouts = 0;
   205 static unsigned int nlayouts = 0;
   209 static unsigned int nrules = 0;
   206 static unsigned int nrules = 0;
   210 static unsigned int ntags;
       
   211 static unsigned int numlockmask = 0;
   207 static unsigned int numlockmask = 0;
   212 static void (*handler[LASTEvent]) (XEvent *) = {
   208 static void (*handler[LASTEvent]) (XEvent *) = {
   213 	[ButtonPress] = buttonpress,
   209 	[ButtonPress] = buttonpress,
   214 	[ConfigureRequest] = configurerequest,
   210 	[ConfigureRequest] = configurerequest,
   215 	[ConfigureNotify] = configurenotify,
   211 	[ConfigureNotify] = configurenotify,
   235 static Display *dpy;
   231 static Display *dpy;
   236 static DC dc = {0};
   232 static DC dc = {0};
   237 static Window barwin, root;
   233 static Window barwin, root;
   238 static Regs *regs = NULL;
   234 static Regs *regs = NULL;
   239 
   235 
       
   236 /* configuration, allows nested code to work on above variables */
       
   237 #include "config.h"
       
   238 
   240 static void
   239 static void
   241 eprint(const char *errstr, ...) {
   240 eprint(const char *errstr, ...) {
   242 	va_list ap;
   241 	va_list ap;
   243 
   242 
   244 	va_start(ap, errstr);
   243 	va_start(ap, errstr);
  1804 
  1803 
  1805 	if(argc == 2 && !strcmp("-v", argv[1]))
  1804 	if(argc == 2 && !strcmp("-v", argv[1]))
  1806 		eprint("dwm-"VERSION", © 2006-2007 A. R. Garbe, S. van Dijk, J. Salmi, P. Hruby, S. Nagy\n");
  1805 		eprint("dwm-"VERSION", © 2006-2007 A. R. Garbe, S. van Dijk, J. Salmi, P. Hruby, S. Nagy\n");
  1807 	else if(argc != 1)
  1806 	else if(argc != 1)
  1808 		eprint("usage: dwm [-v]\n");
  1807 		eprint("usage: dwm [-v]\n");
       
  1808 
       
  1809 	/* macros from config.h can be used beginning within main() */
       
  1810 	mwfact = MWFACT;
       
  1811 	bpos = BARPOS;
       
  1812 
  1809 	setlocale(LC_CTYPE, "");
  1813 	setlocale(LC_CTYPE, "");
  1810 	if(!(dpy = XOpenDisplay(0)))
  1814 	if(!(dpy = XOpenDisplay(0)))
  1811 		eprint("dwm: cannot open display\n");
  1815 		eprint("dwm: cannot open display\n");
  1812 	xfd = ConnectionNumber(dpy);
  1816 	xfd = ConnectionNumber(dpy);
  1813 	screen = DefaultScreen(dpy);
  1817 	screen = DefaultScreen(dpy);