diff options
author | Anselm R Garbe <garbeam@gmail.com> | 2008-07-16 18:18:38 +0100 |
---|---|---|
committer | Anselm R Garbe <garbeam@gmail.com> | 2008-07-16 18:18:38 +0100 |
commit | b89a9501c75744f1393ec943ca520c8b59501610 (patch) | |
tree | 1571b6c4cbe7cdd3382571f253fc29351615b1f2 | |
parent | 65d655b371cbe2472ee0dd905b427b30311d9355 (diff) |
reverted uint/ulong introduction
-rw-r--r-- | config.h | 4 | ||||
-rw-r--r-- | dmenu.c | 38 |
2 files changed, 20 insertions, 22 deletions
@@ -7,8 +7,8 @@ static const char *normfgcolor = "#000000"; | |||
7 | static const char *selbgcolor = "#0066ff"; | 7 | static const char *selbgcolor = "#0066ff"; |
8 | static const char *selfgcolor = "#ffffff"; | 8 | static const char *selfgcolor = "#ffffff"; |
9 | 9 | ||
10 | static uint spaceitem = 30; /* px between menu items */ | 10 | static unsigned int spaceitem = 30; /* px between menu items */ |
11 | 11 | ||
12 | #ifdef XINERAMA | 12 | #ifdef XINERAMA |
13 | static uint xidx = 0; /* Xinerama screen index to use */ | 13 | static unsigned int xidx = 0; /* Xinerama screen index to use */ |
14 | #endif | 14 | #endif |
@@ -22,12 +22,10 @@ | |||
22 | enum { ColFG, ColBG, ColLast }; | 22 | enum { ColFG, ColBG, ColLast }; |
23 | 23 | ||
24 | /* typedefs */ | 24 | /* typedefs */ |
25 | typedef unsigned int uint; | ||
26 | typedef unsigned long ulong; | ||
27 | typedef struct { | 25 | typedef struct { |
28 | int x, y, w, h; | 26 | int x, y, w, h; |
29 | ulong norm[ColLast]; | 27 | unsigned long norm[ColLast]; |
30 | ulong sel[ColLast]; | 28 | unsigned long sel[ColLast]; |
31 | Drawable drawable; | 29 | Drawable drawable; |
32 | GC gc; | 30 | GC gc; |
33 | struct { | 31 | struct { |
@@ -52,9 +50,9 @@ static void calcoffsets(void); | |||
52 | static char *cistrstr(const char *s, const char *sub); | 50 | static char *cistrstr(const char *s, const char *sub); |
53 | static void cleanup(void); | 51 | static void cleanup(void); |
54 | static void drawmenu(void); | 52 | static void drawmenu(void); |
55 | static void drawtext(const char *text, ulong col[ColLast]); | 53 | static void drawtext(const char *text, unsigned long col[ColLast]); |
56 | static void eprint(const char *errstr, ...); | 54 | static void eprint(const char *errstr, ...); |
57 | static ulong getcolor(const char *colstr); | 55 | static unsigned long getcolor(const char *colstr); |
58 | static Bool grabkeyboard(void); | 56 | static Bool grabkeyboard(void); |
59 | static void initfont(const char *fontstr); | 57 | static void initfont(const char *fontstr); |
60 | static void kpress(XKeyEvent * e); | 58 | static void kpress(XKeyEvent * e); |
@@ -62,7 +60,7 @@ static void match(char *pattern); | |||
62 | static void readstdin(void); | 60 | static void readstdin(void); |
63 | static void run(void); | 61 | static void run(void); |
64 | static void setup(Bool topbar); | 62 | static void setup(Bool topbar); |
65 | static int textnw(const char *text, uint len); | 63 | static int textnw(const char *text, unsigned int len); |
66 | static int textw(const char *text); | 64 | static int textw(const char *text); |
67 | 65 | ||
68 | #include "config.h" | 66 | #include "config.h" |
@@ -75,8 +73,8 @@ static int cmdw = 0; | |||
75 | static int promptw = 0; | 73 | static int promptw = 0; |
76 | static int ret = 0; | 74 | static int ret = 0; |
77 | static int screen; | 75 | static int screen; |
78 | static uint mw, mh; | 76 | static unsigned int mw, mh; |
79 | static uint numlockmask = 0; | 77 | static unsigned int numlockmask = 0; |
80 | static Bool running = True; | 78 | static Bool running = True; |
81 | static Display *dpy; | 79 | static Display *dpy; |
82 | static DC dc = {0}; | 80 | static DC dc = {0}; |
@@ -104,7 +102,7 @@ appenditem(Item *i, Item **list, Item **last) { | |||
104 | void | 102 | void |
105 | calcoffsets(void) { | 103 | calcoffsets(void) { |
106 | int tw; | 104 | int tw; |
107 | uint w; | 105 | unsigned int w; |
108 | 106 | ||
109 | if(!curr) | 107 | if(!curr) |
110 | return; | 108 | return; |
@@ -131,7 +129,7 @@ calcoffsets(void) { | |||
131 | char * | 129 | char * |
132 | cistrstr(const char *s, const char *sub) { | 130 | cistrstr(const char *s, const char *sub) { |
133 | int c, csub; | 131 | int c, csub; |
134 | uint len; | 132 | unsigned int len; |
135 | 133 | ||
136 | if(!sub) | 134 | if(!sub) |
137 | return (char *)s; | 135 | return (char *)s; |
@@ -213,10 +211,10 @@ drawmenu(void) { | |||
213 | } | 211 | } |
214 | 212 | ||
215 | void | 213 | void |
216 | drawtext(const char *text, ulong col[ColLast]) { | 214 | drawtext(const char *text, unsigned long col[ColLast]) { |
217 | int x, y, w, h; | 215 | int x, y, w, h; |
218 | static char buf[256]; | 216 | static char buf[256]; |
219 | uint len, olen; | 217 | unsigned int len, olen; |
220 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; | 218 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
221 | 219 | ||
222 | XSetForeground(dpy, dc.gc, col[ColBG]); | 220 | XSetForeground(dpy, dc.gc, col[ColBG]); |
@@ -262,7 +260,7 @@ eprint(const char *errstr, ...) { | |||
262 | exit(EXIT_FAILURE); | 260 | exit(EXIT_FAILURE); |
263 | } | 261 | } |
264 | 262 | ||
265 | ulong | 263 | unsigned long |
266 | getcolor(const char *colstr) { | 264 | getcolor(const char *colstr) { |
267 | Colormap cmap = DefaultColormap(dpy, screen); | 265 | Colormap cmap = DefaultColormap(dpy, screen); |
268 | XColor color; | 266 | XColor color; |
@@ -274,7 +272,7 @@ getcolor(const char *colstr) { | |||
274 | 272 | ||
275 | Bool | 273 | Bool |
276 | grabkeyboard(void) { | 274 | grabkeyboard(void) { |
277 | uint len; | 275 | unsigned int len; |
278 | 276 | ||
279 | for(len = 1000; len; len--) { | 277 | for(len = 1000; len; len--) { |
280 | if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) | 278 | if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) |
@@ -330,7 +328,7 @@ void | |||
330 | kpress(XKeyEvent * e) { | 328 | kpress(XKeyEvent * e) { |
331 | char buf[32]; | 329 | char buf[32]; |
332 | int i, num; | 330 | int i, num; |
333 | uint len; | 331 | unsigned int len; |
334 | KeySym ksym; | 332 | KeySym ksym; |
335 | 333 | ||
336 | len = strlen(text); | 334 | len = strlen(text); |
@@ -498,7 +496,7 @@ kpress(XKeyEvent * e) { | |||
498 | 496 | ||
499 | void | 497 | void |
500 | match(char *pattern) { | 498 | match(char *pattern) { |
501 | uint plen; | 499 | unsigned int plen; |
502 | Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; | 500 | Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; |
503 | 501 | ||
504 | if(!pattern) | 502 | if(!pattern) |
@@ -540,7 +538,7 @@ match(char *pattern) { | |||
540 | void | 538 | void |
541 | readstdin(void) { | 539 | readstdin(void) { |
542 | char *p, buf[1024]; | 540 | char *p, buf[1024]; |
543 | uint len = 0, max = 0; | 541 | unsigned int len = 0, max = 0; |
544 | Item *i, *new; | 542 | Item *i, *new; |
545 | 543 | ||
546 | i = 0; | 544 | i = 0; |
@@ -659,7 +657,7 @@ setup(Bool topbar) { | |||
659 | } | 657 | } |
660 | 658 | ||
661 | int | 659 | int |
662 | textnw(const char *text, uint len) { | 660 | textnw(const char *text, unsigned int len) { |
663 | XRectangle r; | 661 | XRectangle r; |
664 | 662 | ||
665 | if(dc.font.set) { | 663 | if(dc.font.set) { |
@@ -676,7 +674,7 @@ textw(const char *text) { | |||
676 | 674 | ||
677 | int | 675 | int |
678 | main(int argc, char *argv[]) { | 676 | main(int argc, char *argv[]) { |
679 | uint i; | 677 | unsigned int i; |
680 | Bool topbar = True; | 678 | Bool topbar = True; |
681 | 679 | ||
682 | /* command line args */ | 680 | /* command line args */ |