JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
pneubeck pointed out an obvious thing, that a second p = stext + strlen(stext) -...
[dwm.git] / main.c
diff --git a/main.c b/main.c
index 4f1c6aa..02475e0 100644 (file)
--- a/main.c
+++ b/main.c
 /* 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;
@@ -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 + sh - bh, 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;
+       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);
                        }