aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-05-22 11:15:11 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-05-22 11:15:11 +0100
commit596033b7818f5ff126ec6c62c375afc4c1e32dda (patch)
treef051c8dae3802131de2fccedc559455ffa41221f
parent357558798c435f1737b13085b30e2e9e7be3616a (diff)
s/unsigned int/uint/, s/unsigned long/ulong/
-rw-r--r--dmenu.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/dmenu.c b/dmenu.c
index 4d23d9d..849746c 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -20,10 +20,12 @@
20enum { ColFG, ColBG, ColLast }; 20enum { ColFG, ColBG, ColLast };
21 21
22/* typedefs */ 22/* typedefs */
23typedef unsigned int uint;
24typedef unsigned long ulong;
23typedef struct { 25typedef 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);
48char *cistrstr(const char *s, const char *sub); 50char *cistrstr(const char *s, const char *sub);
49void cleanup(void); 51void cleanup(void);
50void drawmenu(void); 52void drawmenu(void);
51void drawtext(const char *text, unsigned long col[ColLast]); 53void drawtext(const char *text, ulong col[ColLast]);
52void *emalloc(unsigned int size); 54void *emalloc(uint size);
53void eprint(const char *errstr, ...); 55void eprint(const char *errstr, ...);
54char *estrdup(const char *str); 56char *estrdup(const char *str);
55unsigned long getcolor(const char *colstr); 57ulong getcolor(const char *colstr);
56Bool grabkeyboard(void); 58Bool grabkeyboard(void);
57void initfont(const char *fontstr); 59void initfont(const char *fontstr);
58void kpress(XKeyEvent * e); 60void kpress(XKeyEvent * e);
@@ -60,8 +62,8 @@ void match(char *pattern);
60void readstdin(void); 62void readstdin(void);
61void run(void); 63void run(void);
62void setup(Bool topbar); 64void setup(Bool topbar);
63unsigned int textnw(const char *text, unsigned int len); 65uint textnw(const char *text, uint len);
64unsigned int textw(const char *text); 66uint textw(const char *text);
65 67
66#include "config.h" 68#include "config.h"
67 69
@@ -76,10 +78,10 @@ char *selfg = SELFGCOLOR;
76char text[4096]; 78char text[4096];
77int screen; 79int screen;
78int ret = 0; 80int ret = 0;
79unsigned int cmdw = 0; 81uint cmdw = 0;
80unsigned int mw, mh; 82uint mw, mh;
81unsigned int promptw = 0; 83uint promptw = 0;
82unsigned int numlockmask = 0; 84uint numlockmask = 0;
83Bool running = True; 85Bool running = True;
84Display *dpy; 86Display *dpy;
85DC dc = {0}; 87DC dc = {0};
@@ -106,7 +108,7 @@ appenditem(Item *i, Item **list, Item **last) {
106 108
107void 109void
108calcoffsets(void) { 110calcoffsets(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) {
133char * 135char *
134cistrstr(const char *s, const char *sub) { 136cistrstr(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
217void 219void
218drawtext(const char *text, unsigned long col[ColLast]) { 220drawtext(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
257void * 259void *
258emalloc(unsigned int size) { 260emalloc(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
285unsigned long 287ulong
286getcolor(const char *colstr) { 288getcolor(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
295Bool 297Bool
296grabkeyboard(void) { 298grabkeyboard(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
350kpress(XKeyEvent * e) { 352kpress(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
518void 520void
519match(char *pattern) { 521match(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) {
559void 561void
560readstdin(void) { 562readstdin(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
678unsigned int 680uint
679textnw(const char *text, unsigned int len) { 681textnw(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
689unsigned int 691uint
690textw(const char *text) { 692textw(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
694int 696int
695main(int argc, char *argv[]) { 697main(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 */