X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=main.c;h=6d84a77a4d4335f56ab5c438bf0a2d2b81c2e491;hb=a923298d3577dca0e69fd70edbef56c7822258e3;hp=5324ae0b0867e57a12881b4f8176b94cab5cd0a1;hpb=cf58091736de194fabfd25420bbd1999b4ad3360;p=dwm.git diff --git a/main.c b/main.c index 5324ae0..6d84a77 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,4 @@ -/* © 2006-2007 Anselm R. Garbe - * © 2006-2007 Sander van Dijk - * See LICENSE file for license details. */ +/* See LICENSE file for copyright and license details. */ #include "dwm.h" #include #include @@ -13,13 +11,16 @@ #include #include #include +#include /* extern */ char stext[256]; int screen, sx, sy, sw, sh, wax, way, waw, wah; -unsigned int bh, bpos, ntags, numlockmask; -Atom wmatom[WMLast], netatom[NetLast]; +unsigned int bh, ntags; +unsigned int bpos = BARPOS; +unsigned int numlockmask = 0; +Atom dwmconfig, wmatom[WMLast], netatom[NetLast]; Bool *seltag; Bool selscreen = True; Client *clients = NULL; @@ -40,9 +41,8 @@ static void cleanup(void) { close(STDIN_FILENO); while(stack) { - if(stack->isbanned) - XMoveWindow(dpy, stack->win, stack->x, stack->y); - unmanage(stack); + unban(stack); + unmanage(stack, NormalState); } if(dc.font.set) XFreeFontSet(dpy, dc.font.set); @@ -140,6 +140,7 @@ setup(void) { XSetWindowAttributes wa; /* init atoms */ + dwmconfig = XInternAtom(dpy, "_DWM_CONFIG", False); wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); @@ -152,7 +153,6 @@ setup(void) { cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); /* init modifier map */ - numlockmask = 0; modmap = XGetModifierMapping(dpy); for (i = 0; i < 8; i++) for (j = 0; j < modmap->max_keypermod; j++) { @@ -190,11 +190,10 @@ setup(void) { wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; - barwin = XCreateWindow(dpy, root, sx, sy - bh, sw, bh, 0, + barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); XDefineCursor(dpy, barwin, cursor[CurNormal]); - bpos = BARPOS; updatebarpos(); XMapRaised(dpy, barwin); strcpy(stext, "dwm-"VERSION); @@ -227,12 +226,14 @@ quit(const char *arg) { void updatebarpos(void) { + XEvent ev; + wax = sx; way = sy; wah = sh; waw = sw; switch(bpos) { - case BarTop: + default: wah -= bh; way += bh; XMoveWindow(dpy, barwin, sx, sy); @@ -243,8 +244,10 @@ updatebarpos(void) { break; case BarOff: XMoveWindow(dpy, barwin, sx, sy - bh); + break; } - lt->arrange(); + XSync(dpy, False); + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } /* There's no way to check accesses to destroyed windows, thus those cases are @@ -274,8 +277,8 @@ main(int argc, char *argv[]) { fd_set rd; XEvent ev; - if(argc == 2 && !strncmp("-v", argv[1], 3)) - eprint("dwm-"VERSION", © 2004-2007 Anselm R. Garbe, Sander van Dijk\n"); + if(argc == 2 && !strcmp("-v", argv[1])) + eprint("dwm-"VERSION", © 2006-2007 A. R. Garbe, S. van Dijk, J. Salmi, P. Hruby, S. Nagy\n"); else if(argc != 1) eprint("usage: dwm [-v]\n"); setlocale(LC_CTYPE, "");