s/unsigned int/uint/
c3fa9e87
1 file(s) · +34 −33
| 60 | 60 | enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
|
| 61 | 61 | ||
| 62 | 62 | /* typedefs */ |
|
| 63 | + | typedef unsigned int uint; |
|
| 63 | 64 | typedef struct Client Client; |
|
| 64 | 65 | struct Client { |
|
| 65 | 66 | char name[256]; |
|
| 67 | 68 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
|
| 68 | 69 | int minax, maxax, minay, maxay; |
|
| 69 | 70 | long flags; |
|
| 70 | - | unsigned int bw, oldbw; |
|
| 71 | + | uint bw, oldbw; |
|
| 71 | 72 | Bool isbanned, isfixed, isfloating, isurgent; |
|
| 72 | - | unsigned int tags; |
|
| 73 | + | uint tags; |
|
| 73 | 74 | Client *next; |
|
| 74 | 75 | Client *prev; |
|
| 75 | 76 | Client *snext; |
|
| 108 | 109 | const char *class; |
|
| 109 | 110 | const char *instance; |
|
| 110 | 111 | const char *title; |
|
| 111 | - | unsigned int tags; |
|
| 112 | + | uint tags; |
|
| 112 | 113 | Bool isfloating; |
|
| 113 | 114 | } Rule; |
|
| 114 | 115 | ||
| 130 | 131 | void drawbar(void); |
|
| 131 | 132 | void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
|
| 132 | 133 | void drawtext(const char *text, unsigned long col[ColLast], Bool invert); |
|
| 133 | - | void *emallocz(unsigned int size); |
|
| 134 | + | void *emallocz(uint size); |
|
| 134 | 135 | void enternotify(XEvent *e); |
|
| 135 | 136 | void eprint(const char *errstr, ...); |
|
| 136 | 137 | void expose(XEvent *e); |
|
| 141 | 142 | Client *getclient(Window w); |
|
| 142 | 143 | unsigned long getcolor(const char *colstr); |
|
| 143 | 144 | long getstate(Window w); |
|
| 144 | - | Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); |
|
| 145 | + | Bool gettextprop(Window w, Atom atom, char *text, uint size); |
|
| 145 | 146 | void grabbuttons(Client *c, Bool focused); |
|
| 146 | 147 | void grabkeys(void); |
|
| 147 | 148 | void initfont(const char *fontstr); |
|
| 148 | - | Bool isoccupied(unsigned int t); |
|
| 149 | + | Bool isoccupied(uint t); |
|
| 149 | 150 | Bool isprotodel(Client *c); |
|
| 150 | - | Bool isurgent(unsigned int t); |
|
| 151 | + | Bool isurgent(uint t); |
|
| 151 | 152 | Bool isvisible(Client *c); |
|
| 152 | 153 | void keypress(XEvent *e); |
|
| 153 | 154 | void killclient(const void *arg); |
|
| 168 | 169 | void setup(void); |
|
| 169 | 170 | void spawn(const void *arg); |
|
| 170 | 171 | void tag(const void *arg); |
|
| 171 | - | unsigned int textnw(const char *text, unsigned int len); |
|
| 172 | - | unsigned int textw(const char *text); |
|
| 172 | + | uint textnw(const char *text, uint len); |
|
| 173 | + | uint textw(const char *text); |
|
| 173 | 174 | void tile(void); |
|
| 174 | 175 | void tileresize(Client *c, int x, int y, int w, int h); |
|
| 175 | 176 | void togglebar(const void *arg); |
|
| 198 | 199 | int screen, sx, sy, sw, sh; |
|
| 199 | 200 | int bx, by, bw, bh, blw, wx, wy, ww, wh; |
|
| 200 | 201 | int mx, my, mw, mh, tx, ty, tw, th; |
|
| 201 | - | unsigned int seltags = 0; |
|
| 202 | + | uint seltags = 0; |
|
| 202 | 203 | int (*xerrorxlib)(Display *, XErrorEvent *); |
|
| 203 | - | unsigned int numlockmask = 0; |
|
| 204 | + | uint numlockmask = 0; |
|
| 204 | 205 | void (*handler[LASTEvent]) (XEvent *) = { |
|
| 205 | 206 | [ButtonPress] = buttonpress, |
|
| 206 | 207 | [ConfigureRequest] = configurerequest, |
|
| 218 | 219 | Atom wmatom[WMLast], netatom[NetLast]; |
|
| 219 | 220 | Bool otherwm, readin; |
|
| 220 | 221 | Bool running = True; |
|
| 221 | - | unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */ |
|
| 222 | + | uint tagset[] = {1, 1}; /* after start, first tag is selected */ |
|
| 222 | 223 | Client *clients = NULL; |
|
| 223 | 224 | Client *sel = NULL; |
|
| 224 | 225 | Client *stack = NULL; |
|
| 232 | 233 | /* configuration, allows nested code to access above variables */ |
|
| 233 | 234 | #include "config.h" |
|
| 234 | 235 | ||
| 235 | - | /* check if all tags will fit into a unsigned int bitarray. */ |
|
| 236 | + | /* check if all tags will fit into a uint bitarray. */ |
|
| 236 | 237 | static char tags_is_a_sign_that_your_IQ[sizeof(int) * 8 < LENGTH(tags) ? -1 : 1]; |
|
| 237 | 238 | ||
| 238 | 239 | /* function implementations */ |
|
| 239 | 240 | ||
| 240 | 241 | void |
|
| 241 | 242 | applyrules(Client *c) { |
|
| 242 | - | unsigned int i; |
|
| 243 | + | uint i; |
|
| 243 | 244 | Rule *r; |
|
| 244 | 245 | XClassHint ch = { 0 }; |
|
| 245 | 246 | ||
| 305 | 306 | ||
| 306 | 307 | void |
|
| 307 | 308 | buttonpress(XEvent *e) { |
|
| 308 | - | unsigned int i, x, mask; |
|
| 309 | + | uint i, x, mask; |
|
| 309 | 310 | Client *c; |
|
| 310 | 311 | XButtonPressedEvent *ev = &e->xbutton; |
|
| 311 | 312 | ||
| 561 | 562 | void |
|
| 562 | 563 | drawtext(const char *text, unsigned long col[ColLast], Bool invert) { |
|
| 563 | 564 | int x, y, w, h; |
|
| 564 | - | unsigned int len, olen; |
|
| 565 | + | uint len, olen; |
|
| 565 | 566 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
|
| 566 | 567 | char buf[256]; |
|
| 567 | 568 | ||
| 596 | 597 | } |
|
| 597 | 598 | ||
| 598 | 599 | void * |
|
| 599 | - | emallocz(unsigned int size) { |
|
| 600 | + | emallocz(uint size) { |
|
| 600 | 601 | void *res = calloc(1, size); |
|
| 601 | 602 | ||
| 602 | 603 | if(!res) |
|
| 735 | 736 | } |
|
| 736 | 737 | ||
| 737 | 738 | Bool |
|
| 738 | - | gettextprop(Window w, Atom atom, char *text, unsigned int size) { |
|
| 739 | + | gettextprop(Window w, Atom atom, char *text, uint size) { |
|
| 739 | 740 | char **list = NULL; |
|
| 740 | 741 | int n; |
|
| 741 | 742 | XTextProperty name; |
|
| 763 | 764 | void |
|
| 764 | 765 | grabbuttons(Client *c, Bool focused) { |
|
| 765 | 766 | int i, j; |
|
| 766 | - | unsigned int buttons[] = { Button1, Button2, Button3 }; |
|
| 767 | - | unsigned int modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask, |
|
| 767 | + | uint buttons[] = { Button1, Button2, Button3 }; |
|
| 768 | + | uint modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask, |
|
| 768 | 769 | MODKEY|numlockmask|LockMask} ; |
|
| 769 | 770 | ||
| 770 | 771 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
|
| 780 | 781 | ||
| 781 | 782 | void |
|
| 782 | 783 | grabkeys(void) { |
|
| 783 | - | unsigned int i, j; |
|
| 784 | + | uint i, j; |
|
| 784 | 785 | KeyCode code; |
|
| 785 | 786 | XModifierKeymap *modmap; |
|
| 786 | 787 | ||
| 848 | 849 | } |
|
| 849 | 850 | ||
| 850 | 851 | Bool |
|
| 851 | - | isoccupied(unsigned int t) { |
|
| 852 | + | isoccupied(uint t) { |
|
| 852 | 853 | Client *c; |
|
| 853 | 854 | ||
| 854 | 855 | for(c = clients; c; c = c->next) |
|
| 873 | 874 | } |
|
| 874 | 875 | ||
| 875 | 876 | Bool |
|
| 876 | - | isurgent(unsigned int t) { |
|
| 877 | + | isurgent(uint t) { |
|
| 877 | 878 | Client *c; |
|
| 878 | 879 | ||
| 879 | 880 | for(c = clients; c; c = c->next) |
|
| 889 | 890 | ||
| 890 | 891 | void |
|
| 891 | 892 | keypress(XEvent *e) { |
|
| 892 | - | unsigned int i; |
|
| 893 | + | uint i; |
|
| 893 | 894 | KeySym keysym; |
|
| 894 | 895 | XKeyEvent *ev; |
|
| 895 | 896 | ||
| 1004 | 1005 | void |
|
| 1005 | 1006 | movemouse(Client *c) { |
|
| 1006 | 1007 | int x1, y1, ocx, ocy, di, nx, ny; |
|
| 1007 | - | unsigned int dui; |
|
| 1008 | + | uint dui; |
|
| 1008 | 1009 | Window dummy; |
|
| 1009 | 1010 | XEvent ev; |
|
| 1010 | 1011 | ||
| 1230 | 1231 | char sbuf[sizeof stext]; |
|
| 1231 | 1232 | fd_set rd; |
|
| 1232 | 1233 | int r, xfd; |
|
| 1233 | - | unsigned int len, offset; |
|
| 1234 | + | uint len, offset; |
|
| 1234 | 1235 | XEvent ev; |
|
| 1235 | 1236 | ||
| 1236 | 1237 | /* main event loop, also reads status text from stdin */ |
|
| 1286 | 1287 | ||
| 1287 | 1288 | void |
|
| 1288 | 1289 | scan(void) { |
|
| 1289 | - | unsigned int i, num; |
|
| 1290 | + | uint i, num; |
|
| 1290 | 1291 | Window *wins, d1, d2; |
|
| 1291 | 1292 | XWindowAttributes wa; |
|
| 1292 | 1293 | ||
| 1336 | 1337 | ||
| 1337 | 1338 | void |
|
| 1338 | 1339 | setup(void) { |
|
| 1339 | - | unsigned int i, w; |
|
| 1340 | + | uint i, w; |
|
| 1340 | 1341 | XSetWindowAttributes wa; |
|
| 1341 | 1342 | ||
| 1342 | 1343 | /* init screen */ |
|
| 1441 | 1442 | } |
|
| 1442 | 1443 | } |
|
| 1443 | 1444 | ||
| 1444 | - | unsigned int |
|
| 1445 | - | textnw(const char *text, unsigned int len) { |
|
| 1445 | + | uint |
|
| 1446 | + | textnw(const char *text, uint len) { |
|
| 1446 | 1447 | XRectangle r; |
|
| 1447 | 1448 | ||
| 1448 | 1449 | if(dc.font.set) { |
|
| 1452 | 1453 | return XTextWidth(dc.font.xfont, text, len); |
|
| 1453 | 1454 | } |
|
| 1454 | 1455 | ||
| 1455 | - | unsigned int |
|
| 1456 | + | uint |
|
| 1456 | 1457 | textw(const char *text) { |
|
| 1457 | 1458 | return textnw(text, strlen(text)) + dc.font.height; |
|
| 1458 | 1459 | } |
|
| 1460 | 1461 | void |
|
| 1461 | 1462 | tile(void) { |
|
| 1462 | 1463 | int x, y, h, w; |
|
| 1463 | - | unsigned int i, n; |
|
| 1464 | + | uint i, n; |
|
| 1464 | 1465 | Client *c; |
|
| 1465 | 1466 | ||
| 1466 | 1467 | for(n = 0, c = nextunfloating(clients); c; c = nextunfloating(c->next), n++); |
|
| 1524 | 1525 | ||
| 1525 | 1526 | void |
|
| 1526 | 1527 | togglelayout(const void *arg) { |
|
| 1527 | - | unsigned int i; |
|
| 1528 | + | uint i; |
|
| 1528 | 1529 | ||
| 1529 | 1530 | if(!arg) { |
|
| 1530 | 1531 | if(++lt == &layouts[LENGTH(layouts)]) |
|