summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 @@
18 18
19char stext[256]; 19char stext[256];
20int screen, sx, sy, sw, sh, wax, way, waw, wah; 20int screen, sx, sy, sw, sh, wax, way, waw, wah;
21unsigned int bh, ntags, numlockmask; 21unsigned int bh, bpos, ntags, numlockmask;
22Atom wmatom[WMLast], netatom[NetLast]; 22Atom wmatom[WMLast], netatom[NetLast];
23Bool *seltag; 23Bool *seltag;
24Bool selscreen = True; 24Bool selscreen = True;
@@ -190,17 +190,13 @@ setup(void) {
190 wa.override_redirect = 1; 190 wa.override_redirect = 1;
191 wa.background_pixmap = ParentRelative; 191 wa.background_pixmap = ParentRelative;
192 wa.event_mask = ButtonPressMask | ExposureMask; 192 wa.event_mask = ButtonPressMask | ExposureMask;
193 barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0, 193 barwin = XCreateWindow(dpy, root, sx, sy - bh, sw, bh, 0,
194 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), 194 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
195 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); 195 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
196 XDefineCursor(dpy, barwin, cursor[CurNormal]); 196 XDefineCursor(dpy, barwin, cursor[CurNormal]);
197 updatebarpos();
197 XMapRaised(dpy, barwin); 198 XMapRaised(dpy, barwin);
198 strcpy(stext, "dwm-"VERSION); 199 strcpy(stext, "dwm-"VERSION);
199 /* windowarea */
200 wax = sx;
201 way = sy + (TOPBAR ? bh : 0);
202 wah = sh - bh;
203 waw = sw;
204 /* pixmap for everything */ 200 /* pixmap for everything */
205 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); 201 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
206 dc.gc = XCreateGC(dpy, root, 0, 0); 202 dc.gc = XCreateGC(dpy, root, 0, 0);
@@ -228,6 +224,28 @@ quit(const char *arg) {
228 readin = running = False; 224 readin = running = False;
229} 225}
230 226
227void
228updatebarpos(void) {
229 wax = sx;
230 way = sy;
231 wah = sh;
232 waw = sw;
233 switch(bpos) {
234 case BarTop:
235 wah -= bh;
236 way += bh;
237 XMoveWindow(dpy, barwin, sx, sy);
238 break;
239 case BarBot:
240 wah -= bh;
241 XMoveWindow(dpy, barwin, sx, sy + wah);
242 break;
243 case BarOff:
244 XMoveWindow(dpy, barwin, sx, sy - bh);
245 }
246 lt->arrange();
247}
248
231/* There's no way to check accesses to destroyed windows, thus those cases are 249/* There's no way to check accesses to destroyed windows, thus those cases are
232 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs 250 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs
233 * default error handler, which may call exit. 251 * default error handler, which may call exit.