diff options
author | Anselm R Garbe <garbeam@gmail.com> | 2008-05-22 11:15:11 +0100 |
---|---|---|
committer | Anselm R Garbe <garbeam@gmail.com> | 2008-05-22 11:15:11 +0100 |
commit | 596033b7818f5ff126ec6c62c375afc4c1e32dda (patch) | |
tree | f051c8dae3802131de2fccedc559455ffa41221f | |
parent | 357558798c435f1737b13085b30e2e9e7be3616a (diff) |
s/unsigned int/uint/, s/unsigned long/ulong/
-rw-r--r-- | dmenu.c | 52 |
1 files changed, 27 insertions, 25 deletions
@@ -20,10 +20,12 @@ | |||
20 | enum { ColFG, ColBG, ColLast }; | 20 | enum { ColFG, ColBG, ColLast }; |
21 | 21 | ||
22 | /* typedefs */ | 22 | /* typedefs */ |
23 | typedef unsigned int uint; | ||
24 | typedef unsigned long ulong; | ||
23 | typedef struct { | 25 | typedef struct { |
24 | int x, y, w, h; | 26 | int x, y, w, h; |
25 | unsigned long norm[ColLast]; | 27 | ulong norm[ColLast]; |
26 | unsigned long sel[ColLast]; | 28 | ulong sel[ColLast]; |
27 | Drawable drawable; | 29 | Drawable drawable; |
28 | GC gc; | 30 | GC gc; |
29 | struct { | 31 | struct { |
@@ -48,11 +50,11 @@ void calcoffsets(void); | |||
48 | char *cistrstr(const char *s, const char *sub); | 50 | char *cistrstr(const char *s, const char *sub); |
49 | void cleanup(void); | 51 | void cleanup(void); |
50 | void drawmenu(void); | 52 | void drawmenu(void); |
51 | void drawtext(const char *text, unsigned long col[ColLast]); | 53 | void drawtext(const char *text, ulong col[ColLast]); |
52 | void *emalloc(unsigned int size); | 54 | void *emalloc(uint size); |
53 | void eprint(const char *errstr, ...); | 55 | void eprint(const char *errstr, ...); |
54 | char *estrdup(const char *str); | 56 | char *estrdup(const char *str); |
55 | unsigned long getcolor(const char *colstr); | 57 | ulong getcolor(const char *colstr); |
56 | Bool grabkeyboard(void); | 58 | Bool grabkeyboard(void); |
57 | void initfont(const char *fontstr); | 59 | void initfont(const char *fontstr); |
58 | void kpress(XKeyEvent * e); | 60 | void kpress(XKeyEvent * e); |
@@ -60,8 +62,8 @@ void match(char *pattern); | |||
60 | void readstdin(void); | 62 | void readstdin(void); |
61 | void run(void); | 63 | void run(void); |
62 | void setup(Bool topbar); | 64 | void setup(Bool topbar); |
63 | unsigned int textnw(const char *text, unsigned int len); | 65 | uint textnw(const char *text, uint len); |
64 | unsigned int textw(const char *text); | 66 | uint textw(const char *text); |
65 | 67 | ||
66 | #include "config.h" | 68 | #include "config.h" |
67 | 69 | ||
@@ -76,10 +78,10 @@ char *selfg = SELFGCOLOR; | |||
76 | char text[4096]; | 78 | char text[4096]; |
77 | int screen; | 79 | int screen; |
78 | int ret = 0; | 80 | int ret = 0; |
79 | unsigned int cmdw = 0; | 81 | uint cmdw = 0; |
80 | unsigned int mw, mh; | 82 | uint mw, mh; |
81 | unsigned int promptw = 0; | 83 | uint promptw = 0; |
82 | unsigned int numlockmask = 0; | 84 | uint numlockmask = 0; |
83 | Bool running = True; | 85 | Bool running = True; |
84 | Display *dpy; | 86 | Display *dpy; |
85 | DC dc = {0}; | 87 | DC dc = {0}; |
@@ -106,7 +108,7 @@ appenditem(Item *i, Item **list, Item **last) { | |||
106 | 108 | ||
107 | void | 109 | void |
108 | calcoffsets(void) { | 110 | calcoffsets(void) { |
109 | unsigned int tw, w; | 111 | uint tw, w; |
110 | 112 | ||
111 | if(!curr) | 113 | if(!curr) |
112 | return; | 114 | return; |
@@ -133,7 +135,7 @@ calcoffsets(void) { | |||
133 | char * | 135 | char * |
134 | cistrstr(const char *s, const char *sub) { | 136 | cistrstr(const char *s, const char *sub) { |
135 | int c, csub; | 137 | int c, csub; |
136 | unsigned int len; | 138 | uint len; |
137 | 139 | ||
138 | if(!sub) | 140 | if(!sub) |
139 | return (char *)s; | 141 | return (char *)s; |
@@ -215,10 +217,10 @@ drawmenu(void) { | |||
215 | } | 217 | } |
216 | 218 | ||
217 | void | 219 | void |
218 | drawtext(const char *text, unsigned long col[ColLast]) { | 220 | drawtext(const char *text, ulong col[ColLast]) { |
219 | int x, y, w, h; | 221 | int x, y, w, h; |
220 | static char buf[256]; | 222 | static char buf[256]; |
221 | unsigned int len, olen; | 223 | uint len, olen; |
222 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; | 224 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
223 | 225 | ||
224 | XSetForeground(dpy, dc.gc, col[ColBG]); | 226 | XSetForeground(dpy, dc.gc, col[ColBG]); |
@@ -255,7 +257,7 @@ drawtext(const char *text, unsigned long col[ColLast]) { | |||
255 | } | 257 | } |
256 | 258 | ||
257 | void * | 259 | void * |
258 | emalloc(unsigned int size) { | 260 | emalloc(uint size) { |
259 | void *res = malloc(size); | 261 | void *res = malloc(size); |
260 | 262 | ||
261 | if(!res) | 263 | if(!res) |
@@ -282,7 +284,7 @@ estrdup(const char *str) { | |||
282 | return res; | 284 | return res; |
283 | } | 285 | } |
284 | 286 | ||
285 | unsigned long | 287 | ulong |
286 | getcolor(const char *colstr) { | 288 | getcolor(const char *colstr) { |
287 | Colormap cmap = DefaultColormap(dpy, screen); | 289 | Colormap cmap = DefaultColormap(dpy, screen); |
288 | XColor color; | 290 | XColor color; |
@@ -294,7 +296,7 @@ getcolor(const char *colstr) { | |||
294 | 296 | ||
295 | Bool | 297 | Bool |
296 | grabkeyboard(void) { | 298 | grabkeyboard(void) { |
297 | unsigned int len; | 299 | uint len; |
298 | 300 | ||
299 | for(len = 1000; len; len--) { | 301 | for(len = 1000; len; len--) { |
300 | if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) | 302 | if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) |
@@ -350,7 +352,7 @@ void | |||
350 | kpress(XKeyEvent * e) { | 352 | kpress(XKeyEvent * e) { |
351 | char buf[32]; | 353 | char buf[32]; |
352 | int i, num; | 354 | int i, num; |
353 | unsigned int len; | 355 | uint len; |
354 | KeySym ksym; | 356 | KeySym ksym; |
355 | 357 | ||
356 | len = strlen(text); | 358 | len = strlen(text); |
@@ -517,7 +519,7 @@ kpress(XKeyEvent * e) { | |||
517 | 519 | ||
518 | void | 520 | void |
519 | match(char *pattern) { | 521 | match(char *pattern) { |
520 | unsigned int plen; | 522 | uint plen; |
521 | Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; | 523 | Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; |
522 | 524 | ||
523 | if(!pattern) | 525 | if(!pattern) |
@@ -559,7 +561,7 @@ match(char *pattern) { | |||
559 | void | 561 | void |
560 | readstdin(void) { | 562 | readstdin(void) { |
561 | char *p, buf[1024]; | 563 | char *p, buf[1024]; |
562 | unsigned int len = 0, max = 0; | 564 | uint len = 0, max = 0; |
563 | Item *i, *new; | 565 | Item *i, *new; |
564 | 566 | ||
565 | i = 0; | 567 | i = 0; |
@@ -675,8 +677,8 @@ setup(Bool topbar) { | |||
675 | XMapRaised(dpy, win); | 677 | XMapRaised(dpy, win); |
676 | } | 678 | } |
677 | 679 | ||
678 | unsigned int | 680 | uint |
679 | textnw(const char *text, unsigned int len) { | 681 | textnw(const char *text, uint len) { |
680 | XRectangle r; | 682 | XRectangle r; |
681 | 683 | ||
682 | if(dc.font.set) { | 684 | if(dc.font.set) { |
@@ -686,14 +688,14 @@ textnw(const char *text, unsigned int len) { | |||
686 | return XTextWidth(dc.font.xfont, text, len); | 688 | return XTextWidth(dc.font.xfont, text, len); |
687 | } | 689 | } |
688 | 690 | ||
689 | unsigned int | 691 | uint |
690 | textw(const char *text) { | 692 | textw(const char *text) { |
691 | return textnw(text, strlen(text)) + dc.font.height; | 693 | return textnw(text, strlen(text)) + dc.font.height; |
692 | } | 694 | } |
693 | 695 | ||
694 | int | 696 | int |
695 | main(int argc, char *argv[]) { | 697 | main(int argc, char *argv[]) { |
696 | unsigned int i; | 698 | uint i; |
697 | Bool topbar = True; | 699 | Bool topbar = True; |
698 | 700 | ||
699 | /* command line args */ | 701 | /* command line args */ |