aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h4
-rw-r--r--dmenu.c38
2 files changed, 20 insertions, 22 deletions
diff --git a/config.h b/config.h
index 5af4304..a2c3fa4 100644
--- a/config.h
+++ b/config.h
@@ -7,8 +7,8 @@ static const char *normfgcolor = "#000000";
7static const char *selbgcolor = "#0066ff"; 7static const char *selbgcolor = "#0066ff";
8static const char *selfgcolor = "#ffffff"; 8static const char *selfgcolor = "#ffffff";
9 9
10static uint spaceitem = 30; /* px between menu items */ 10static unsigned int spaceitem = 30; /* px between menu items */
11 11
12#ifdef XINERAMA 12#ifdef XINERAMA
13static uint xidx = 0; /* Xinerama screen index to use */ 13static unsigned int xidx = 0; /* Xinerama screen index to use */
14#endif 14#endif
diff --git a/dmenu.c b/dmenu.c
index afb5303..33b1a89 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -22,12 +22,10 @@
22enum { ColFG, ColBG, ColLast }; 22enum { ColFG, ColBG, ColLast };
23 23
24/* typedefs */ 24/* typedefs */
25typedef unsigned int uint;
26typedef unsigned long ulong;
27typedef struct { 25typedef 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);
52static char *cistrstr(const char *s, const char *sub); 50static char *cistrstr(const char *s, const char *sub);
53static void cleanup(void); 51static void cleanup(void);
54static void drawmenu(void); 52static void drawmenu(void);
55static void drawtext(const char *text, ulong col[ColLast]); 53static void drawtext(const char *text, unsigned long col[ColLast]);
56static void eprint(const char *errstr, ...); 54static void eprint(const char *errstr, ...);
57static ulong getcolor(const char *colstr); 55static unsigned long getcolor(const char *colstr);
58static Bool grabkeyboard(void); 56static Bool grabkeyboard(void);
59static void initfont(const char *fontstr); 57static void initfont(const char *fontstr);
60static void kpress(XKeyEvent * e); 58static void kpress(XKeyEvent * e);
@@ -62,7 +60,7 @@ static void match(char *pattern);
62static void readstdin(void); 60static void readstdin(void);
63static void run(void); 61static void run(void);
64static void setup(Bool topbar); 62static void setup(Bool topbar);
65static int textnw(const char *text, uint len); 63static int textnw(const char *text, unsigned int len);
66static int textw(const char *text); 64static int textw(const char *text);
67 65
68#include "config.h" 66#include "config.h"
@@ -75,8 +73,8 @@ static int cmdw = 0;
75static int promptw = 0; 73static int promptw = 0;
76static int ret = 0; 74static int ret = 0;
77static int screen; 75static int screen;
78static uint mw, mh; 76static unsigned int mw, mh;
79static uint numlockmask = 0; 77static unsigned int numlockmask = 0;
80static Bool running = True; 78static Bool running = True;
81static Display *dpy; 79static Display *dpy;
82static DC dc = {0}; 80static DC dc = {0};
@@ -104,7 +102,7 @@ appenditem(Item *i, Item **list, Item **last) {
104void 102void
105calcoffsets(void) { 103calcoffsets(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) {
131char * 129char *
132cistrstr(const char *s, const char *sub) { 130cistrstr(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
215void 213void
216drawtext(const char *text, ulong col[ColLast]) { 214drawtext(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
265ulong 263unsigned long
266getcolor(const char *colstr) { 264getcolor(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
275Bool 273Bool
276grabkeyboard(void) { 274grabkeyboard(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
330kpress(XKeyEvent * e) { 328kpress(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
499void 497void
500match(char *pattern) { 498match(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) {
540void 538void
541readstdin(void) { 539readstdin(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
661int 659int
662textnw(const char *text, uint len) { 660textnw(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
677int 675int
678main(int argc, char *argv[]) { 676main(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 */