X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/4590d7877c1ec4ea4a3f0a832f8ea037612d7096..7a095d0ce241698d8b3ea896499031f1d72b622e:/main.c

diff --git a/main.c b/main.c
index 4f1c6aa..02475e0 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;
@@ -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);
 			}