16 |
16 |
17 /* extern */ |
17 /* extern */ |
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; |
25 Client *clients = NULL; |
25 Client *clients = NULL; |
26 Client *sel = NULL; |
26 Client *sel = NULL; |
188 /* bar */ |
188 /* bar */ |
189 dc.h = bh = dc.font.height + 2; |
189 dc.h = bh = dc.font.height + 2; |
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); |
207 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
203 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
208 if(!dc.font.set) |
204 if(!dc.font.set) |
224 /* extern */ |
220 /* extern */ |
225 |
221 |
226 void |
222 void |
227 quit(const char *arg) { |
223 quit(const char *arg) { |
228 readin = running = False; |
224 readin = running = False; |
|
225 } |
|
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(); |
229 } |
247 } |
230 |
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. |