Browse Source

s/unsigned int/uint/, s/unsigned long/ulong/

master
Anselm R Garbe 17 years ago
parent
commit
596033b781
  1. 52
      dmenu.c

52
dmenu.c

@ -20,10 +20,12 @@
enum { ColFG, ColBG, ColLast }; enum { ColFG, ColBG, ColLast };
/* typedefs */ /* typedefs */
typedef unsigned int uint;
typedef unsigned long ulong;
typedef struct { typedef struct {
int x, y, w, h; int x, y, w, h;
unsigned long norm[ColLast]; ulong norm[ColLast];
unsigned long sel[ColLast]; ulong sel[ColLast];
Drawable drawable; Drawable drawable;
GC gc; GC gc;
struct { struct {
@ -48,11 +50,11 @@ void calcoffsets(void);
char *cistrstr(const char *s, const char *sub); char *cistrstr(const char *s, const char *sub);
void cleanup(void); void cleanup(void);
void drawmenu(void); void drawmenu(void);
void drawtext(const char *text, unsigned long col[ColLast]); void drawtext(const char *text, ulong col[ColLast]);
void *emalloc(unsigned int size); void *emalloc(uint size);
void eprint(const char *errstr, ...); void eprint(const char *errstr, ...);
char *estrdup(const char *str); char *estrdup(const char *str);
unsigned long getcolor(const char *colstr); ulong getcolor(const char *colstr);
Bool grabkeyboard(void); Bool grabkeyboard(void);
void initfont(const char *fontstr); void initfont(const char *fontstr);
void kpress(XKeyEvent * e); void kpress(XKeyEvent * e);
@ -60,8 +62,8 @@ void match(char *pattern);
void readstdin(void); void readstdin(void);
void run(void); void run(void);
void setup(Bool topbar); void setup(Bool topbar);
unsigned int textnw(const char *text, unsigned int len); uint textnw(const char *text, uint len);
unsigned int textw(const char *text); uint textw(const char *text);
#include "config.h" #include "config.h"
@ -76,10 +78,10 @@ char *selfg = SELFGCOLOR;
char text[4096]; char text[4096];
int screen; int screen;
int ret = 0; int ret = 0;
unsigned int cmdw = 0; uint cmdw = 0;
unsigned int mw, mh; uint mw, mh;
unsigned int promptw = 0; uint promptw = 0;
unsigned int numlockmask = 0; uint numlockmask = 0;
Bool running = True; Bool running = True;
Display *dpy; Display *dpy;
DC dc = {0}; DC dc = {0};
@ -106,7 +108,7 @@ appenditem(Item *i, Item **list, Item **last) {
void void
calcoffsets(void) { calcoffsets(void) {
unsigned int tw, w; uint tw, w;
if(!curr) if(!curr)
return; return;
@ -133,7 +135,7 @@ calcoffsets(void) {
char * char *
cistrstr(const char *s, const char *sub) { cistrstr(const char *s, const char *sub) {
int c, csub; int c, csub;
unsigned int len; uint len;
if(!sub) if(!sub)
return (char *)s; return (char *)s;
@ -215,10 +217,10 @@ drawmenu(void) {
} }
void void
drawtext(const char *text, unsigned long col[ColLast]) { drawtext(const char *text, ulong col[ColLast]) {
int x, y, w, h; int x, y, w, h;
static char buf[256]; static char buf[256];
unsigned int len, olen; uint len, olen;
XRectangle r = { dc.x, dc.y, dc.w, dc.h }; XRectangle r = { dc.x, dc.y, dc.w, dc.h };
XSetForeground(dpy, dc.gc, col[ColBG]); XSetForeground(dpy, dc.gc, col[ColBG]);
@ -255,7 +257,7 @@ drawtext(const char *text, unsigned long col[ColLast]) {
} }
void * void *
emalloc(unsigned int size) { emalloc(uint size) {
void *res = malloc(size); void *res = malloc(size);
if(!res) if(!res)
@ -282,7 +284,7 @@ estrdup(const char *str) {
return res; return res;
} }
unsigned long ulong
getcolor(const char *colstr) { getcolor(const char *colstr) {
Colormap cmap = DefaultColormap(dpy, screen); Colormap cmap = DefaultColormap(dpy, screen);
XColor color; XColor color;
@ -294,7 +296,7 @@ getcolor(const char *colstr) {
Bool Bool
grabkeyboard(void) { grabkeyboard(void) {
unsigned int len; uint len;
for(len = 1000; len; len--) { for(len = 1000; len; len--) {
if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
@ -350,7 +352,7 @@ void
kpress(XKeyEvent * e) { kpress(XKeyEvent * e) {
char buf[32]; char buf[32];
int i, num; int i, num;
unsigned int len; uint len;
KeySym ksym; KeySym ksym;
len = strlen(text); len = strlen(text);
@ -517,7 +519,7 @@ kpress(XKeyEvent * e) {
void void
match(char *pattern) { match(char *pattern) {
unsigned int plen; uint plen;
Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend; Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend;
if(!pattern) if(!pattern)
@ -559,7 +561,7 @@ match(char *pattern) {
void void
readstdin(void) { readstdin(void) {
char *p, buf[1024]; char *p, buf[1024];
unsigned int len = 0, max = 0; uint len = 0, max = 0;
Item *i, *new; Item *i, *new;
i = 0; i = 0;
@ -675,8 +677,8 @@ setup(Bool topbar) {
XMapRaised(dpy, win); XMapRaised(dpy, win);
} }
unsigned int uint
textnw(const char *text, unsigned int len) { textnw(const char *text, uint len) {
XRectangle r; XRectangle r;
if(dc.font.set) { if(dc.font.set) {
@ -686,14 +688,14 @@ textnw(const char *text, unsigned int len) {
return XTextWidth(dc.font.xfont, text, len); return XTextWidth(dc.font.xfont, text, len);
} }
unsigned int uint
textw(const char *text) { textw(const char *text) {
return textnw(text, strlen(text)) + dc.font.height; return textnw(text, strlen(text)) + dc.font.height;
} }
int int
main(int argc, char *argv[]) { main(int argc, char *argv[]) {
unsigned int i; uint i;
Bool topbar = True; Bool topbar = True;
/* command line args */ /* command line args */

Loading…
Cancel
Save