reverted uint redefinition 9086f980
Anselm R Garbe · 2008-07-16 18:17 1 file(s) · +42 −46
dwm.c +42 −46
63 63
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
64 64
       ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
65 65
66 -
/* typedefs */
67 -
typedef unsigned int uint;
68 -
typedef unsigned long ulong;
69 -
70 66
typedef union {
71 67
	int i;
72 -
	uint ui;
68 +
	unsigned int ui;
73 69
	float f;
74 70
	void *v;
75 71
} Arg;
76 72
77 73
typedef struct {
78 -
	uint click;
79 -
	uint mask;
80 -
	uint button;
74 +
	unsigned int click;
75 +
	unsigned int mask;
76 +
	unsigned int button;
81 77
	void (*func)(const Arg *arg);
82 78
	const Arg arg;
83 79
} Button;
89 85
	int x, y, w, h;
90 86
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
91 87
	int bw, oldbw;
92 -
	uint tags;
88 +
	unsigned int tags;
93 89
	Bool isfixed, isfloating, isurgent;
94 90
	Client *next;
95 91
	Client *snext;
98 94
99 95
typedef struct {
100 96
	int x, y, w, h;
101 -
	ulong norm[ColLast];
102 -
	ulong sel[ColLast];
97 +
	unsigned long norm[ColLast];
98 +
	unsigned long sel[ColLast];
103 99
	Drawable drawable;
104 100
	GC gc;
105 101
	struct {
112 108
} DC; /* draw context */
113 109
114 110
typedef struct {
115 -
	uint mod;
111 +
	unsigned int mod;
116 112
	KeySym keysym;
117 113
	void (*func)(const Arg *);
118 114
	const Arg arg;
127 123
	const char *class;
128 124
	const char *instance;
129 125
	const char *title;
130 -
	uint tags;
126 +
	unsigned int tags;
131 127
	Bool isfloating;
132 128
} Rule;
133 129
148 144
static void detachstack(Client *c);
149 145
static void die(const char *errstr, ...);
150 146
static void drawbar(void);
151 -
static void drawsquare(Bool filled, Bool empty, Bool invert, ulong col[ColLast]);
152 -
static void drawtext(const char *text, ulong col[ColLast], Bool invert);
147 +
static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
148 +
static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
153 149
static void enternotify(XEvent *e);
154 150
static void expose(XEvent *e);
155 151
static void focus(Client *c);
156 152
static void focusin(XEvent *e);
157 153
static void focusstack(const Arg *arg);
158 154
static Client *getclient(Window w);
159 -
static ulong getcolor(const char *colstr);
155 +
static unsigned long getcolor(const char *colstr);
160 156
static long getstate(Window w);
161 -
static Bool gettextprop(Window w, Atom atom, char *text, uint size);
157 +
static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
162 158
static void grabbuttons(Client *c, Bool focused);
163 159
static void grabkeys(void);
164 160
static void initfont(const char *fontstr);
165 -
static Bool isoccupied(uint t);
161 +
static Bool isoccupied(unsigned int t);
166 162
static Bool isprotodel(Client *c);
167 -
static Bool isurgent(uint t);
163 +
static Bool isurgent(unsigned int t);
168 164
static void keypress(XEvent *e);
169 165
static void killclient(const Arg *arg);
170 166
static void manage(Window w, XWindowAttributes *wa);
186 182
static void setup(void);
187 183
static void spawn(const Arg *arg);
188 184
static void tag(const Arg *arg);
189 -
static int textnw(const char *text, uint len);
185 +
static int textnw(const char *text, unsigned int len);
190 186
static void tile(void);
191 187
static void togglebar(const Arg *arg);
192 188
static void togglefloating(const Arg *arg);
209 205
static char stext[256];
210 206
static int screen, sx, sy, sw, sh;
211 207
static int by, bh, blw, wx, wy, ww, wh;
212 -
static uint seltags = 0, sellt = 0;
208 +
static unsigned int seltags = 0, sellt = 0;
213 209
static int (*xerrorxlib)(Display *, XErrorEvent *);
214 -
static uint numlockmask = 0;
210 +
static unsigned int numlockmask = 0;
215 211
static void (*handler[LASTEvent]) (XEvent *) = {
216 212
	[ButtonPress] = buttonpress,
217 213
	[ConfigureRequest] = configurerequest,
229 225
static Atom wmatom[WMLast], netatom[NetLast];
230 226
static Bool otherwm, readin;
231 227
static Bool running = True;
232 -
static uint tagset[] = {1, 1}; /* after start, first tag is selected */
228 +
static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */
233 229
static Client *clients = NULL;
234 230
static Client *sel = NULL;
235 231
static Client *stack = NULL;
241 237
/* configuration, allows nested code to access above variables */
242 238
#include "config.h"
243 239
244 -
/* compile-time check if all tags fit into an uint bit array. */
245 -
struct NumTags { char limitexceeded[sizeof(uint) * 8 < LENGTH(tags) ? -1 : 1]; };
240 +
/* compile-time check if all tags fit into an unsigned int bit array. */
241 +
struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 : 1]; };
246 242
247 243
/* function implementations */
248 244
void
249 245
applyrules(Client *c) {
250 -
	uint i;
246 +
	unsigned int i;
251 247
	Rule *r;
252 248
	XClassHint ch = { 0 };
253 249
304 300
305 301
void
306 302
buttonpress(XEvent *e) {
307 -
	uint i, x, click;
303 +
	unsigned int i, x, click;
308 304
	Arg arg = {0};
309 305
	Client *c;
310 306
	XButtonPressedEvent *ev = &e->xbutton;
546 542
}
547 543
548 544
void
549 -
drawsquare(Bool filled, Bool empty, Bool invert, ulong col[ColLast]) {
545 +
drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
550 546
	int x;
551 547
	XGCValues gcv;
552 548
	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
567 563
}
568 564
569 565
void
570 -
drawtext(const char *text, ulong col[ColLast], Bool invert) {
566 +
drawtext(const char *text, unsigned long col[ColLast], Bool invert) {
571 567
	int i, x, y, h, len, olen;
572 568
	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
573 569
	char buf[256];
679 675
	return c;
680 676
}
681 677
682 -
ulong
678 +
unsigned long
683 679
getcolor(const char *colstr) {
684 680
	Colormap cmap = DefaultColormap(dpy, screen);
685 681
	XColor color;
694 690
	int format, status;
695 691
	long result = -1;
696 692
	unsigned char *p = NULL;
697 -
	ulong n, extra;
693 +
	unsigned long n, extra;
698 694
	Atom real;
699 695
700 696
	status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState],
708 704
}
709 705
710 706
Bool
711 -
gettextprop(Window w, Atom atom, char *text, uint size) {
707 +
gettextprop(Window w, Atom atom, char *text, unsigned int size) {
712 708
	char **list = NULL;
713 709
	int n;
714 710
	XTextProperty name;
735 731
736 732
void
737 733
grabbuttons(Client *c, Bool focused) {
738 -
	uint i, j;
739 -
	uint modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
734 +
	unsigned int i, j;
735 +
	unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
740 736
741 737
	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
742 738
	if(focused) {
751 747
752 748
void
753 749
grabkeys(void) {
754 -
	uint i, j;
750 +
	unsigned int i, j;
755 751
	KeyCode code;
756 752
	XModifierKeymap *modmap;
757 753
819 815
}
820 816
821 817
Bool
822 -
isoccupied(uint t) {
818 +
isoccupied(unsigned int t) {
823 819
	Client *c;
824 820
825 821
	for(c = clients; c; c = c->next)
844 840
}
845 841
846 842
Bool
847 -
isurgent(uint t) {
843 +
isurgent(unsigned int t) {
848 844
	Client *c;
849 845
850 846
	for(c = clients; c; c = c->next)
855 851
856 852
void
857 853
keypress(XEvent *e) {
858 -
	uint i;
854 +
	unsigned int i;
859 855
	KeySym keysym;
860 856
	XKeyEvent *ev;
861 857
979 975
void
980 976
movemouse(const Arg *arg) {
981 977
	int x1, y1, ocx, ocy, di, nx, ny;
982 -
	uint dui;
978 +
	unsigned int dui;
983 979
	Client *c;
984 980
	Window dummy;
985 981
	XEvent ev;
1216 1212
	char sbuf[sizeof stext];
1217 1213
	fd_set rd;
1218 1214
	int r, xfd;
1219 -
	uint len, offset;
1215 +
	unsigned int len, offset;
1220 1216
	XEvent ev;
1221 1217
1222 1218
	/* main event loop, also reads status text from stdin */
1272 1268
1273 1269
void
1274 1270
scan(void) {
1275 -
	uint i, num;
1271 +
	unsigned int i, num;
1276 1272
	Window *wins, d1, d2;
1277 1273
	XWindowAttributes wa;
1278 1274
1333 1329
1334 1330
void
1335 1331
setup(void) {
1336 -
	uint i;
1332 +
	unsigned int i;
1337 1333
	int w;
1338 1334
	XSetWindowAttributes wa;
1339 1335
1436 1432
}
1437 1433
1438 1434
int
1439 -
textnw(const char *text, uint len) {
1435 +
textnw(const char *text, unsigned int len) {
1440 1436
	XRectangle r;
1441 1437
1442 1438
	if(dc.font.set) {
1449 1445
void
1450 1446
tile(void) {
1451 1447
	int x, y, h, w, mw;
1452 -
	uint i, n;
1448 +
	unsigned int i, n;
1453 1449
	Client *c;
1454 1450
1455 1451
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
1500 1496
1501 1497
void
1502 1498
toggletag(const Arg *arg) {
1503 -
	uint mask = sel->tags ^ (arg->ui & TAGMASK);
1499 +
	unsigned int mask = sel->tags ^ (arg->ui & TAGMASK);
1504 1500
1505 1501
	if(sel && mask) {
1506 1502
		sel->tags = mask;
1510 1506
1511 1507
void
1512 1508
toggleview(const Arg *arg) {
1513 -
	uint mask = tagset[seltags] ^ (arg->ui & TAGMASK);
1509 +
	unsigned int mask = tagset[seltags] ^ (arg->ui & TAGMASK);
1514 1510
1515 1511
	if(mask) {
1516 1512
		tagset[seltags] = mask;