changeset 1179 | 6fad217390c6 |
parent 1178 | e0095dbfc0af |
child 1182 | 9940d125b703 |
1178:e0095dbfc0af | 1179:6fad217390c6 |
---|---|
212 /* variables */ |
212 /* variables */ |
213 char stext[256], buf[256]; |
213 char stext[256], buf[256]; |
214 int screen, sx, sy, sw, sh; |
214 int screen, sx, sy, sw, sh; |
215 int (*xerrorxlib)(Display *, XErrorEvent *); |
215 int (*xerrorxlib)(Display *, XErrorEvent *); |
216 int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; |
216 int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; |
217 int viewtags_set = 0; |
|
217 double mfact; |
218 double mfact; |
218 unsigned int numlockmask = 0; |
219 unsigned int numlockmask = 0; |
219 void (*handler[LASTEvent]) (XEvent *) = { |
220 void (*handler[LASTEvent]) (XEvent *) = { |
220 [ButtonPress] = buttonpress, |
221 [ButtonPress] = buttonpress, |
221 [ConfigureRequest] = configurerequest, |
222 [ConfigureRequest] = configurerequest, |
231 [UnmapNotify] = unmapnotify |
232 [UnmapNotify] = unmapnotify |
232 }; |
233 }; |
233 Atom wmatom[WMLast], netatom[NetLast]; |
234 Atom wmatom[WMLast], netatom[NetLast]; |
234 Bool otherwm, readin; |
235 Bool otherwm, readin; |
235 Bool running = True; |
236 Bool running = True; |
236 Bool *prevtags; |
|
237 Bool *seltags; |
237 Bool *seltags; |
238 Bool *viewtags[2]; |
|
238 Client *clients = NULL; |
239 Client *clients = NULL; |
239 Client *sel = NULL; |
240 Client *sel = NULL; |
240 Client *stack = NULL; |
241 Client *stack = NULL; |
241 Cursor cursor[CurLast]; |
242 Cursor cursor[CurLast]; |
242 Display *dpy; |
243 Display *dpy; |
244 Window root, barwin; |
245 Window root, barwin; |
245 |
246 |
246 /* configuration, allows nested code to access above variables */ |
247 /* configuration, allows nested code to access above variables */ |
247 #include "config.h" |
248 #include "config.h" |
248 #define TAGSZ (LENGTH(tags) * sizeof(Bool)) |
249 #define TAGSZ (LENGTH(tags) * sizeof(Bool)) |
249 Bool tmp[LENGTH(tags)]; |
|
250 Layout *lt = layouts; |
250 Layout *lt = layouts; |
251 Geom *geom = geoms; |
251 Geom *geom = geoms; |
252 |
252 |
253 /* function implementations */ |
253 /* function implementations */ |
254 |
254 |
1156 readin = running = False; |
1156 readin = running = False; |
1157 } |
1157 } |
1158 |
1158 |
1159 void |
1159 void |
1160 reapply(const char *arg) { |
1160 reapply(const char *arg) { |
1161 static Bool zerotags[LENGTH(tags)] = { 0 }; |
|
1162 Client *c; |
1161 Client *c; |
1163 |
1162 |
1164 for(c = clients; c; c = c->next) { |
1163 for(c = clients; c; c = c->next) { |
1165 memcpy(c->tags, zerotags, sizeof zerotags); |
1164 memset(c->tags, 0, TAGSZ); |
1166 applyrules(c); |
1165 applyrules(c); |
1167 } |
1166 } |
1168 arrange(); |
1167 arrange(); |
1169 } |
1168 } |
1170 |
1169 |
1504 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
1503 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
1505 if(!dc.font.set) |
1504 if(!dc.font.set) |
1506 XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
1505 XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
1507 |
1506 |
1508 /* init tags */ |
1507 /* init tags */ |
1509 seltags = emallocz(TAGSZ); |
1508 viewtags[0] = emallocz(TAGSZ); |
1510 prevtags = emallocz(TAGSZ); |
1509 viewtags[1] = emallocz(TAGSZ); |
1511 seltags[0] = prevtags[0] = True; |
1510 viewtags[0][0] = viewtags[1][0] = True; |
1511 seltags = viewtags[0]; |
|
1512 |
1512 |
1513 /* init bar */ |
1513 /* init bar */ |
1514 for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { |
1514 for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { |
1515 w = textw(layouts[i].symbol); |
1515 w = textw(layouts[i].symbol); |
1516 blw = MAX(blw, w); |
1516 blw = MAX(blw, w); |
1826 c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; |
1826 c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; |
1827 XFree(wmh); |
1827 XFree(wmh); |
1828 } |
1828 } |
1829 } |
1829 } |
1830 |
1830 |
1831 |
|
1832 void |
1831 void |
1833 view(const char *arg) { |
1832 view(const char *arg) { |
1833 Bool tmp[LENGTH(tags)]; |
|
1834 unsigned int i; |
1834 unsigned int i; |
1835 |
1835 |
1836 for(i = 0; i < LENGTH(tags); i++) |
1836 for(i = 0; i < LENGTH(tags); i++) |
1837 tmp[i] = (NULL == arg); |
1837 tmp[i] = (NULL == arg); |
1838 tmp[idxoftag(arg)] = True; |
1838 tmp[idxoftag(arg)] = True; |
1839 |
1839 |
1840 if(memcmp(seltags, tmp, TAGSZ) != 0) { |
1840 if(memcmp(seltags, tmp, TAGSZ) != 0) { |
1841 memcpy(prevtags, seltags, TAGSZ); |
1841 seltags = viewtags[viewtags_set ^= 1]; /* toggle tagset */ |
1842 memcpy(seltags, tmp, TAGSZ); |
1842 memcpy(seltags, tmp, TAGSZ); |
1843 arrange(); |
1843 arrange(); |
1844 } |
1844 } |
1845 } |
1845 } |
1846 |
1846 |
1847 void |
1847 void |
1848 viewprevtag(const char *arg) { |
1848 viewprevtag(const char *arg) { |
1849 |
1849 seltags = viewtags[viewtags_set ^= 1]; /* toggle tagset */ |
1850 memcpy(tmp, seltags, TAGSZ); |
|
1851 memcpy(seltags, prevtags, TAGSZ); |
|
1852 memcpy(prevtags, tmp, TAGSZ); |
|
1853 arrange(); |
1850 arrange(); |
1854 } |
1851 } |
1855 |
1852 |
1856 /* There's no way to check accesses to destroyed windows, thus those cases are |
1853 /* There's no way to check accesses to destroyed windows, thus those cases are |
1857 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
1854 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |