X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=main.c;h=5ed8981c4a13d1bb0788d145d2f8232210856317;hb=b61f91361c81b3c619ef6dac6e80e19a64d5fcf3;hp=da95d95f080716815c081ba150559b8928d1ebd9;hpb=28ffff801bb0137ec3fe4093afc4fb29784b17ec;p=dwm.git diff --git a/main.c b/main.c index da95d95..5ed8981 100644 --- a/main.c +++ b/main.c @@ -18,11 +18,11 @@ /* extern */ char stext[256]; -Bool *seltag; int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah; unsigned int master, nmaster, ntags, numlockmask; Atom wmatom[WMLast], netatom[NetLast]; Bool running = True; +Bool *seltag; Bool selscreen = True; Client *clients = NULL; Client *sel = NULL; @@ -41,7 +41,8 @@ static void cleanup(void) { close(STDIN_FILENO); while(stack) { - resize(stack, True); + if(stack->isbanned) + XMoveWindow(dpy, stack->win, stack->x, stack->y); unmanage(stack); } if(dc.font.set) @@ -69,9 +70,8 @@ scan(void) { wins = NULL; if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { for(i = 0; i < num; i++) { - if(!XGetWindowAttributes(dpy, wins[i], &wa)) - continue; - if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) + if(!XGetWindowAttributes(dpy, wins[i], &wa) + || wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) continue; if(wa.map_state == IsViewable) manage(wins[i], &wa); @@ -104,12 +104,12 @@ setup(void) { /* init modifier map */ numlockmask = 0; modmap = XGetModifierMapping(dpy); - for (i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) for (j = 0; j < modmap->max_keypermod; j++) { - if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) + if(modmap->modifiermap[i * modmap->max_keypermod + j] + == XKeysymToKeycode(dpy, XK_Num_Lock)) numlockmask = (1 << i); } - } XFreeModifiermap(modmap); /* select for events */ wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask @@ -141,15 +141,15 @@ setup(void) { wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; - barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, DefaultDepth(dpy, screen), - CopyFromParent, DefaultVisual(dpy, screen), + barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0, + DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); XDefineCursor(dpy, barwin, cursor[CurNormal]); XMapRaised(dpy, barwin); strcpy(stext, "dwm-"VERSION); /* windowarea */ wax = sx; - way = sy + bh; + way = sy + (TOPBAR ? bh : 0); wah = sh - bh; waw = sw; /* pixmap for everything */ @@ -273,7 +273,7 @@ main(int argc, char *argv[]) { break; default: for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; *p-- = '\0'); - for(p = stext + strlen(stext) - 1; p >= stext && *p != '\n'; --p); + for(; p >= stext && *p != '\n'; --p); if(p > stext) strncpy(stext, p + 1, sizeof stext); }