16 #include <X11/Xproto.h> |
16 #include <X11/Xproto.h> |
17 |
17 |
18 /* extern */ |
18 /* extern */ |
19 |
19 |
20 char stext[256]; |
20 char stext[256]; |
21 int screen, sx, sy, sw, sh, wax, way, waw, wah; |
21 int screen, sw, sh, wax, way, waw, wah; |
22 unsigned int bh, ntags, numlockmask; |
22 unsigned int bh, ntags, numlockmask; |
23 Atom wmatom[WMLast], netatom[NetLast]; |
23 Atom wmatom[WMLast], netatom[NetLast]; |
24 Bool running = True; |
|
25 Bool *seltag; |
24 Bool *seltag; |
26 Bool selscreen = True; |
25 Bool selscreen = True; |
27 Client *clients = NULL; |
26 Client *clients = NULL; |
28 Client *sel = NULL; |
27 Client *sel = NULL; |
29 Client *stack = NULL; |
28 Client *stack = NULL; |
179 dc.sel[ColBorder] = initcolor(SELBORDERCOLOR); |
179 dc.sel[ColBorder] = initcolor(SELBORDERCOLOR); |
180 dc.sel[ColBG] = initcolor(SELBGCOLOR); |
180 dc.sel[ColBG] = initcolor(SELBGCOLOR); |
181 dc.sel[ColFG] = initcolor(SELFGCOLOR); |
181 dc.sel[ColFG] = initcolor(SELFGCOLOR); |
182 initfont(FONT); |
182 initfont(FONT); |
183 /* geometry */ |
183 /* geometry */ |
184 sx = sy = 0; |
|
185 sw = DisplayWidth(dpy, screen); |
184 sw = DisplayWidth(dpy, screen); |
186 sh = DisplayHeight(dpy, screen); |
185 sh = DisplayHeight(dpy, screen); |
187 initlayouts(); |
186 initlayouts(); |
188 /* bar */ |
187 /* bar */ |
189 dc.h = bh = dc.font.height + 2; |
188 dc.h = bh = dc.font.height + 2; |
190 wa.override_redirect = 1; |
189 wa.override_redirect = 1; |
191 wa.background_pixmap = ParentRelative; |
190 wa.background_pixmap = ParentRelative; |
192 wa.event_mask = ButtonPressMask | ExposureMask; |
191 wa.event_mask = ButtonPressMask | ExposureMask; |
193 barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0, |
192 barwin = XCreateWindow(dpy, root, 0, (TOPBAR ? 0 : sh - bh), sw, bh, 0, |
194 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), |
193 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), |
195 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
194 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
196 XDefineCursor(dpy, barwin, cursor[CurNormal]); |
195 XDefineCursor(dpy, barwin, cursor[CurNormal]); |
197 XMapRaised(dpy, barwin); |
196 XMapRaised(dpy, barwin); |
198 strcpy(stext, "dwm-"VERSION); |
197 strcpy(stext, "dwm-"VERSION); |
199 /* windowarea */ |
198 /* windowarea */ |
200 wax = sx; |
199 wax = 0; |
201 way = sy + (TOPBAR ? bh : 0); |
200 way = (TOPBAR ? bh : 0); |
202 wah = sh - bh; |
201 wah = sh - bh; |
203 waw = sw; |
202 waw = sw; |
204 /* pixmap for everything */ |
203 /* pixmap for everything */ |
205 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); |
204 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); |
206 dc.gc = XCreateGC(dpy, root, 0, 0); |
205 dc.gc = XCreateGC(dpy, root, 0, 0); |