diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 43 |
1 files changed, 16 insertions, 27 deletions
@@ -17,8 +17,8 @@ /* static */ -static Bool otherwm; static int (*xerrorxlib)(Display *, XErrorEvent *); +static Bool otherwm; static void cleanup() @@ -34,9 +34,8 @@ static void scan() { unsigned int i, num; - Window *wins; + Window *wins, d1, d2; XWindowAttributes wa; - Window d1, d2; if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { for(i = 0; i < num; i++) { @@ -55,10 +54,9 @@ scan() static int win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) { - Atom real; - int format; + int status, format; unsigned long res, extra; - int status; + Atom real; status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, &res, &extra, prop); @@ -101,10 +99,10 @@ Window root, barwin; int getproto(Window w) { - unsigned char *protocols; - long res; int protos = 0; int i; + long res; + unsigned char *protocols; res = win_property(w, wmatom[WMProtocols], XA_ATOM, 20L, &protocols); if(res <= 0) { @@ -148,21 +146,15 @@ int xerror(Display *dpy, XErrorEvent *ee) { if(ee->error_code == BadWindow - || (ee->request_code == X_SetInputFocus - && ee->error_code == BadMatch) - || (ee->request_code == X_PolyText8 - && ee->error_code == BadDrawable) - || (ee->request_code == X_PolyFillRectangle - && ee->error_code == BadDrawable) - || (ee->request_code == X_PolySegment - && ee->error_code == BadDrawable) - || (ee->request_code == X_ConfigureWindow - && ee->error_code == BadMatch) - || (ee->request_code == X_GrabKey - && ee->error_code == BadAccess)) + || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) + || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) + || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) + || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) + || (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) + || (ee->request_code == X_GrabKey && ee->error_code == BadAccess)) return 0; fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", - ee->request_code, ee->error_code); + ee->request_code, ee->error_code); return xerrorxlib(dpy, ee); /* may call exit() */ } @@ -170,12 +162,12 @@ int main(int argc, char *argv[]) { int i, n; - fd_set rd; - XSetWindowAttributes wa; unsigned int mask; + fd_set rd; Bool readstdin = True; Window w; XEvent ev; + XSetWindowAttributes wa; for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { switch (argv[i][1]) { @@ -254,14 +246,11 @@ main(int argc, char *argv[]) issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); - wa.event_mask = SubstructureRedirectMask | EnterWindowMask \ - | LeaveWindowMask; + wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask; wa.cursor = cursor[CurNormal]; - XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); strcpy(stext, "dwm-"VERSION); - scan(); /* main event loop, reads status text from stdin as well */ |