X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=wm.c;h=c8bb0a4ab111d98614ddf058f98eb8bf27582c80;hp=de5324c0736a63f35fbd9caa7c18fb16ed103f78;hb=39677ec76616fe4165ef92afb14db2bef2488e30;hpb=1076f2b6b3d3751d5d5db6fcb9ac8c247e04e893 diff --git a/wm.c b/wm.c index de5324c..c8bb0a4 100644 --- a/wm.c +++ b/wm.c @@ -13,15 +13,20 @@ #include "wm.h" +/* X structs */ Display *dpy; Window root; XRectangle rect; -int screen, sel_screen; +Pixmap pmap; Atom wm_atom[WMLast]; Atom net_atom[NetLast]; Cursor cursor[CurLast]; + +int screen, sel_screen; unsigned int kmask, numlock_mask; -Pixmap pmap; + +/* draw structs */ +Brush brush = {0}; enum { WM_PROTOCOL_DELWIN = 1 }; @@ -36,15 +41,6 @@ usage() exit(1); } -void -error(char *errstr, ...) { - va_list ap; - va_start(ap, errstr); - vfprintf(stderr, errstr, ap); - va_end(ap); - exit(1); -} - static void scan_wins() { @@ -217,7 +213,7 @@ main(int argc, char *argv[]) XSetErrorHandler(startup_error_handler); /* this causes an error if some other WM is running */ XSelectInput(dpy, root, SubstructureRedirectMask); - XSync(dpy, False); + XFlush(dpy); if(other_wm_running) error("gridwm: another window manager is already running\n"); @@ -255,6 +251,10 @@ main(int argc, char *argv[]) wa.cursor = cursor[CurNormal]; XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); + /* style */ + loadcolors(dpy, screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR); + loadfont(dpy, &brush.font, FONT); + scan_wins(); cleanup();