diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 32 |
1 files changed, 25 insertions, 7 deletions
| @@ -18,7 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | char stext[256]; | 19 | char stext[256]; |
| 20 | int screen, sx, sy, sw, sh, wax, way, waw, wah; | 20 | int screen, sx, sy, sw, sh, wax, way, waw, wah; |
| 21 | unsigned int bh, ntags, numlockmask; | 21 | unsigned int bh, bpos, ntags, numlockmask; |
| 22 | Atom wmatom[WMLast], netatom[NetLast]; | 22 | Atom wmatom[WMLast], netatom[NetLast]; |
| 23 | Bool *seltag; | 23 | Bool *seltag; |
| 24 | Bool selscreen = True; | 24 | Bool 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 | ||
| 227 | void | ||
| 228 | updatebarpos(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. |
