summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-05-15 12:09:18 +0200
committerAnselm R. Garbe <arg@suckless.org>2007-05-15 12:09:18 +0200
commit2aef8b9b4ce0900d241c60cb3a07e111c825d13a (patch)
tree74724a123e98195e1556c77a13f38bb7fea64cb7 /main.c
parentd96307cbe4f8beee03811754f6304a810a7860e5 (diff)
made bar togglalble
Diffstat (limited to 'main.c')
-rw-r--r--main.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/main.c b/main.c
index 63f791f..555b076 100644
--- a/main.c
+++ b/main.c
@@ -18,7 +18,7 @@
char stext[256];
int screen, sx, sy, sw, sh, wax, way, waw, wah;
-unsigned int bh, ntags, numlockmask;
+unsigned int bh, bpos, ntags, numlockmask;
Atom wmatom[WMLast], netatom[NetLast];
Bool *seltag;
Bool selscreen = True;
@@ -190,17 +190,13 @@ setup(void) {
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask;
- barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0,
+ barwin = XCreateWindow(dpy, root, sx, sy - bh, sw, bh, 0,
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(dpy, barwin, cursor[CurNormal]);
+ updatebarpos();
XMapRaised(dpy, barwin);
strcpy(stext, "dwm-"VERSION);
- /* windowarea */
- wax = sx;
- way = sy + (TOPBAR ? bh : 0);
- wah = sh - bh;
- waw = sw;
/* pixmap for everything */
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
dc.gc = XCreateGC(dpy, root, 0, 0);
@@ -228,6 +224,28 @@ quit(const char *arg) {
readin = running = False;
}
+void
+updatebarpos(void) {
+ wax = sx;
+ way = sy;
+ wah = sh;
+ waw = sw;
+ switch(bpos) {
+ case BarTop:
+ wah -= bh;
+ way += bh;
+ XMoveWindow(dpy, barwin, sx, sy);
+ break;
+ case BarBot:
+ wah -= bh;
+ XMoveWindow(dpy, barwin, sx, sy + wah);
+ break;
+ case BarOff:
+ XMoveWindow(dpy, barwin, sx, sy - bh);
+ }
+ lt->arrange();
+}
+
/* There's no way to check accesses to destroyed windows, thus those cases are
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
* default error handler, which may call exit.