commit 81868ff

uint  ·  2026-10-03 18:25:39 +0000 UTC
parent 578af39
Use long hand uletype names to avoid collisions
12 files changed,  +301, -308
+6, -7
 1@@ -1,4 +1,3 @@
 2-#define ULE_SHORT_TYPE_NAMES
 3 #include "uletypes.h"
 4 #include <stdlib.h>
 5 
 6@@ -25,7 +24,7 @@ void handle_ev(Maus* mw, MausEvent* ev)
 7 			exit(EXIT_SUCCESS);
 8 			break;
 9 		case MAUS_EV_KEY: {
10-			i8* keys = mw->key_syms;
11+			ule_i8* keys = mw->key_syms;
12 
13 			if (keys[MAUS_KEY_CONTROL_L] && keys[MAUS_KEY_Q]) {
14 				maus_close(mw);
15@@ -105,9 +104,9 @@ int main(void)
16 	MausFont* font;
17 	MausEvent ev;
18 	MausColor red = { 255, 255, 0, 0 };
19-	u32 red_unpacked;
20-	u32 x;
21-	u32 y;
22+	ule_u32 red_unpacked;
23+	ule_u32 x;
24+	ule_u32 y;
25 
26 	mw = maus_init("basic window", 0, 0, 800, 600);
27 	if (!mw)
28@@ -132,8 +131,8 @@ int main(void)
29 
30 		red_unpacked = MAUS_UNPACK_COL(red);
31 		if (mx >= 0 && my >= 0 &&
32-		    mx < (i32)mw->width &&
33-		    my < (i32)mw->height && mb1_pressed) {
34+		    mx < (ule_i32)mw->width &&
35+		    my < (ule_i32)mw->height && mb1_pressed) {
36 			MAUS_PIXEL_AT(mw, mx, my) = red_unpacked;
37 		}
38 
+35, -36
  1@@ -2,7 +2,6 @@
  2 #define MAUS_H
  3 
  4 #include <stdio.h>
  5-#define ULE_SHORT_TYPE_NAMES
  6 #include "uletypes.h"
  7 
  8 #include "maus_input.h"
  9@@ -49,10 +48,10 @@
 10 #define MAUS_COL_ARGB(a, r, g, b) (MausColor){a, r, g, b}
 11 #define MAUS_COL_RGBA(r, g, b, a) (MausColor){a, r, g, b}
 12 #define MAUS_UNPACK_COL(c) \
 13-	(((u32)(c).a << 24) | \
 14-	 ((u32)(c).r << 16) | \
 15-	 ((u32)(c).g <<  8) | \
 16-	 ((u32)(c).b))
 17+	(((ule_u32)(c).a << 24) | \
 18+	 ((ule_u32)(c).r << 16) | \
 19+	 ((ule_u32)(c).g <<  8) | \
 20+	 ((ule_u32)(c).b))
 21 
 22 #define MAUS_PIXEL_AT(mw, x, y) ((mw)->bfb[(y) * (mw)->stride + (x)])
 23 
 24@@ -68,62 +67,62 @@ typedef enum {
 25 } MausEventType;
 26 
 27 typedef struct {
 28-	u8 a;
 29-	u8 r;
 30-	u8 g;
 31-	u8 b;
 32+	ule_u8 a;
 33+	ule_u8 r;
 34+	ule_u8 g;
 35+	ule_u8 b;
 36 } MausColor;
 37 
 38 typedef struct {
 39 	MausEventType type;
 40 
 41 	struct {
 42-		u32 code; /* raw, backend keycode */
 43+		ule_u32 code; /* raw, backend keycode */
 44 		MausKey key;  /* logical, mapped key */
 45 		char    text; /* translated text from key */
 46-		i8      pressed;
 47+		ule_i8      pressed;
 48 	} key;
 49 
 50 	struct {
 51 		struct {
 52 			MausMouseButton button;
 53-			i8              pressed;
 54+			ule_i8              pressed;
 55 		} button;
 56 
 57 		struct {
 58-			i32 x;
 59-			i32 y;
 60-			i32 dx;
 61-			i32 dy;
 62+			ule_i32 x;
 63+			ule_i32 y;
 64+			ule_i32 dx;
 65+			ule_i32 dy;
 66 		} motion;
 67 	} mouse;
 68 
 69 	struct {
 70-		u32 width;
 71-		u32 height;
 72+		ule_u32 width;
 73+		ule_u32 height;
 74 	} resize;
 75 } MausEvent;
 76 
 77 typedef struct {
 78 	MausBackend backend;
 79-	u64    frame_time_last;
 80+	ule_u64    frame_time_last;
 81 	char*  clipboard;
 82 
 83-	u32* fb;  /* front frame buffer */
 84-	u32* bfb; /* back frame buffer */
 85-	u32  stride;
 86+	ule_u32* fb;  /* front frame buffer */
 87+	ule_u32* bfb; /* back frame buffer */
 88+	ule_u32  stride;
 89 
 90 	const char* title;
 91-	u32 width;
 92-	u32 height;
 93-	i32 x;
 94-	i32 y;
 95+	ule_u32 width;
 96+	ule_u32 height;
 97+	ule_i32 x;
 98+	ule_i32 y;
 99 
100-	i8 key_codes[MAUS_KEYCODE_LAST]; /* physical keys */
101-	i8 key_syms[MAUS_KEY_LAST];      /* logical keys */
102+	ule_i8 key_codes[MAUS_KEYCODE_LAST]; /* physical keys */
103+	ule_i8 key_syms[MAUS_KEY_LAST];      /* logical keys */
104 
105 	MausCursor cursor;
106-	i8         mouse_buttons[MAUS_MOUSE_BUTTON_LAST];
107+	ule_i8         mouse_buttons[MAUS_MOUSE_BUTTON_LAST];
108 } Maus;
109 
110 /* clear screen with color: `col` */
111@@ -140,16 +139,16 @@ char* maus_clipboard_get_text(Maus* mw);
112 void maus_close(Maus* mw);
113 
114 /* close a window without the whole Maus. returns 0 on fail */
115-i8 maus_close_window(Maus* mw);
116+ule_i8 maus_close_window(Maus* mw);
117 
118 /* create window from Maus. returns 0 on fail */
119-i8 maus_create_window(Maus* mw);
120+ule_i8 maus_create_window(Maus* mw);
121 
122 /* log message to output `fd` and die */
123 void maus_die(const char* fmt, ...);
124 
125 /* get time since arbitrary start point (ns) */
126-u64 maus_get_time_ns(void);
127+ule_u64 maus_get_time_ns(void);
128 
129 /* initialise and fills the Maus. returns NULL on fail */
130 Maus* maus_init(const char* title, int x, int y, int width, int height);
131@@ -160,7 +159,7 @@ void maus_log(FILE* fd, const char* fmt, ...);
132 /* poll for events then fill `ev` with retrieved events.
133    returns 1 if event polled, else 0.
134    note: can burn cpu cycles */
135-i8 maus_event_poll(Maus* mw, MausEvent* ev);
136+ule_i8 maus_event_poll(Maus* mw, MausEvent* ev);
137 
138 /* poll for events then fill `ev` with retrieved events. returns 1 if event
139    polled, else 0. note, thread goes to sleep until an event arrives */
140@@ -171,13 +170,13 @@ void maus_present(Maus* mw);
141 
142 /* resize window to specified width and height. returns 1 on resize success,
143    else 0 */
144-i8 maus_resize(Maus* mw, u32 width, u32 height);
145+ule_i8 maus_resize(Maus* mw, ule_u32 width, ule_u32 height);
146 
147 /* sleep for `ms` milliseconds */
148-void maus_sleep(u32 ms);
149+void maus_sleep(ule_u32 ms);
150 
151 /* cap framerate to targetted fps */
152-void maus_target_fps(Maus* mw, u32 fps);
153+void maus_target_fps(Maus* mw, ule_u32 fps);
154 
155 /* change behavior of mouse based on state passed */
156 void maus_cur_set_mode(Maus* mw, MausCursorState state);
+12, -13
 1@@ -1,7 +1,6 @@
 2 #ifndef MAUS_FONT_H
 3 #define MAUS_FONT_H
 4 
 5-#define ULE_SHORT_TYPE_NAMES
 6 #include "uletypes.h"
 7 
 8 #include "maus.h"
 9@@ -9,26 +8,26 @@
10 #define MAUS_BDF_GLYPHS_MAX 256
11 
12 typedef struct {
13-	u8* bmp;
14-	u16 w;
15-	u16 h;
16-	i16 xoff;
17-	i16 yoff;
18-	u16 adv;
19-	i8  valid;
20+	ule_u8* bmp;
21+	ule_u16 w;
22+	ule_u16 h;
23+	ule_i16 xoff;
24+	ule_i16 yoff;
25+	ule_u16 adv;
26+	ule_i8  valid;
27 } MausGlyph;
28 
29 typedef struct {
30 	MausGlyph glyphs[MAUS_BDF_GLYPHS_MAX];
31 
32-	i32 asc;
33-	i32 dsc;
34-	i32 cellh;
35-	i32 cellw;
36+	ule_i32 asc;
37+	ule_i32 dsc;
38+	ule_i32 cellh;
39+	ule_i32 cellw;
40 } MausFont;
41 
42 /* Loops through text passing parameters to glyph drawer */
43-void maus_draw_text(Maus* mw, MausFont* font, i32 x, i32 y,
44+void maus_draw_text(Maus* mw, MausFont* font, ule_i32 x, ule_i32 y,
45                     const char* text, MausColor col);
46 
47 /* load a bdf font into MausFont. returns NULL on fail */
+2, -3
 1@@ -1,7 +1,6 @@
 2 #ifndef MAUS_INPUT_H
 3 #define MAUS_INPUT_H
 4 
 5-#define ULE_SHORT_TYPE_NAMES
 6 #include "uletypes.h"
 7 
 8 typedef enum {
 9@@ -64,8 +63,8 @@ typedef enum {
10 } MausKey;
11 
12 typedef struct {
13-	i32 x;
14-	i32 y;
15+	ule_i32 x;
16+	ule_i32 y;
17 } MausCursor;
18 
19 typedef enum {
+30, -31
  1@@ -2,7 +2,6 @@
  2 #define MAUS_WAYLAND_H
  3 
  4 #include <stddef.h>
  5-#define ULE_SHORT_TYPE_NAMES
  6 #include "uletypes.h"
  7 
  8 #define MAUS_EVQ_MAX 64
  9@@ -36,30 +35,30 @@ struct xkb_keymap;
 10 struct xkb_state;
 11 
 12 typedef struct {
 13-	i8  pending;
 14-	i32 type;
 15+	ule_i8  pending;
 16+	ule_i32 type;
 17 
 18-	u32 width;
 19-	u32 height;
 20+	ule_u32 width;
 21+	ule_u32 height;
 22 
 23-	i32  mouse_x;
 24-	i32  mouse_y;
 25-	i32  mouse_dx;
 26-	i32  mouse_dy;
 27-	u32 mouse_button;
 28-	u8  mouse_pressed;
 29+	ule_i32  mouse_x;
 30+	ule_i32  mouse_y;
 31+	ule_i32  mouse_dx;
 32+	ule_i32  mouse_dy;
 33+	ule_u32 mouse_button;
 34+	ule_u8  mouse_pressed;
 35 
 36-	u32 key_code;
 37-	u32 key_sym;
 38+	ule_u32 key_code;
 39+	ule_u32 key_sym;
 40 	char     key_text;
 41-	u8  key_pressed;
 42+	ule_u8  key_pressed;
 43 } MausEventPending;
 44 
 45 typedef struct {
 46 	struct wl_buffer* buffer;
 47 	void*             data;
 48 	size_t            size;
 49-	i8            busy;
 50+	ule_i8            busy;
 51 } MausWLBuffer;
 52 
 53 typedef struct {
 54@@ -77,12 +76,12 @@ typedef struct {
 55 	struct wl_cursor_theme* cursor_theme;
 56 	struct wl_cursor*       cursor;
 57 	struct wl_surface*      cursor_surface;
 58-	u32                pointer_enter_serial;
 59-	i32                 mouse_x;
 60-	i32                 mouse_y;
 61-	i8                  mouse_pos_set;
 62-	i8                  cursor_visible;
 63-	i8                  cursor_confined;
 64+	ule_u32                pointer_enter_serial;
 65+	ule_i32                 mouse_x;
 66+	ule_i32                 mouse_y;
 67+	ule_i8                  mouse_pos_set;
 68+	ule_i8                  cursor_visible;
 69+	ule_i8                  cursor_confined;
 70 
 71 	struct zwp_pointer_constraints_v1*      pointer_constraints;
 72 	struct zwp_confined_pointer_v1*         confined_pointer;
 73@@ -97,21 +96,21 @@ typedef struct {
 74 
 75 	MausEventPending pending;
 76 	MausEventPending evq[MAUS_EVQ_MAX];
 77-	u32 evq_head;
 78-	u32 evq_tail;
 79-	u32 evq_count;
 80-
 81-	i32  repeat_rate;
 82-	i32  repeat_delay;
 83-	u32 repeat_key_code;
 84-	u32 repeat_key_sym;
 85+	ule_u32 evq_head;
 86+	ule_u32 evq_tail;
 87+	ule_u32 evq_count;
 88+
 89+	ule_i32  repeat_rate;
 90+	ule_i32  repeat_delay;
 91+	ule_u32 repeat_key_code;
 92+	ule_u32 repeat_key_sym;
 93 	char     repeat_key_text;
 94-	u64 repeat_next_ns;
 95+	ule_u64 repeat_next_ns;
 96 
 97 	struct xdg_wm_base*  wm_base;
 98 	struct xdg_surface*  xdg_surface;
 99 	struct xdg_toplevel* xdg_toplevel;
100-	i8               configured;
101+	ule_i8               configured;
102 
103 	struct wl_registry*          registry;
104 } MausBackend;
+3, -4
 1@@ -1,7 +1,6 @@
 2 #ifndef MAUS_WINDOWS_H
 3 #define MAUS_WINDOWS_H
 4 
 5-#define ULE_SHORT_TYPE_NAMES
 6 #include "uletypes.h"
 7 
 8 #include <windows.h>
 9@@ -12,9 +11,9 @@ typedef struct {
10 	HDC       hdc;
11 	HBITMAP   hbm;
12 	HDC       memdc;
13-	i8    resized;
14-	u32  rw;
15-	u32  rh;
16+	ule_i8    resized;
17+	ule_u32  rw;
18+	ule_u32  rh;
19 } MausBackend;
20 
21 #endif /* MAUS_WINDOWS_H */
+7, -8
 1@@ -1,7 +1,6 @@
 2 #ifndef MAUS_X11_H
 3 #define MAUS_X11_H
 4 
 5-#define ULE_SHORT_TYPE_NAMES
 6 #include "uletypes.h"
 7 
 8 #include <X11/Xlib.h>
 9@@ -19,16 +18,16 @@ typedef struct {
10 	Atom     atoms[MAUS_ATOM_LAST];
11 	GC       gc;
12 
13-	i8 cur_rel; /* relative cursor */
14-	i8 ignore_warp;
15-	i8 xi2;
16+	ule_i8 cur_rel; /* relative cursor */
17+	ule_i8 ignore_warp;
18+	ule_i8 xi2;
19 	int    xi2_opcode;
20-	i32 mouse_x;
21-	i32 mouse_y;
22-	i8  mouse_pos_set;
23+	ule_i32 mouse_x;
24+	ule_i32 mouse_y;
25+	ule_i8  mouse_pos_set;
26 
27 	XShmSegmentInfo shm;
28-	i8          shmat;
29+	ule_i8          shmat;
30 	XImage*         image; /* TODO: XImage path */
31 } MausBackend;
32 
+10, -10
 1@@ -30,7 +30,7 @@ void maus_die(const char* fmt, ...)
 2 	exit(EXIT_FAILURE);
 3 }
 4 
 5-u64 maus_get_time_ns(void)
 6+ule_u64 maus_get_time_ns(void)
 7 {
 8 #if !defined(_WIN32)
 9 	struct timespec ts;
10@@ -39,8 +39,8 @@ u64 maus_get_time_ns(void)
11 #else
12 	static LARGE_INTEGER frequency = {0};
13 	LARGE_INTEGER counter;
14-	u64 sec;
15-	u64 rem;
16+	ule_u64 sec;
17+	ule_u64 rem;
18 
19 	if (frequency.QuadPart == 0)
20 		QueryPerformanceFrequency(&frequency);
21@@ -64,7 +64,7 @@ void maus_log(FILE* fd, const char* fmt, ...)
22 	va_end(ap);
23 }
24 
25-void maus_sleep(u32 ms)
26+void maus_sleep(ule_u32 ms)
27 {
28 #if !defined(_WIN32)
29 	struct timespec ts;
30@@ -77,12 +77,12 @@ void maus_sleep(u32 ms)
31 #endif
32 }
33 
34-void maus_target_fps(Maus* mw, u32 fps)
35+void maus_target_fps(Maus* mw, ule_u32 fps)
36 {
37-	u64 ns_frame;
38-	u64 cur_time;
39-	u64 elapsed;
40-	u64 sleep;
41+	ule_u64 ns_frame;
42+	ule_u64 cur_time;
43+	ule_u64 elapsed;
44+	ule_u64 sleep;
45 
46 	if (fps == 0)
47 		return;
48@@ -94,7 +94,7 @@ void maus_target_fps(Maus* mw, u32 fps)
49 	/* if early finish, sleep for the remaining time balance */
50 	if (elapsed < ns_frame) {
51 		sleep = ns_frame - elapsed;
52-		maus_sleep((u32)((sleep + 999999) / 1000000));
53+		maus_sleep((ule_u32)((sleep + 999999) / 1000000));
54 	}
55 
56 	mw->frame_time_last = maus_get_time_ns();
+47, -47
  1@@ -5,25 +5,25 @@
  2 #include "maus.h"
  3 #include "maus_font.h"
  4 
  5-static void glyph_to_buf(i32 sgx, i32 egx, i32 sgy, i32 egy,
  6-                         i32 gox, i32 goy, MausGlyph* g, u32 col_up,
  7-                         u32* buf, u32 stride);
  8-static i8 parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size,
  9-                           i32* encoding, i32* advance, i32* bw, i32* bh,
 10-                           i32* xoff, i32* yoff, i8* seen);
 11-static u64 strtou64(const char* str);
 12+static void glyph_to_buf(ule_i32 sgx, ule_i32 egx, ule_i32 sgy, ule_i32 egy,
 13+                         ule_i32 gox, ule_i32 goy, MausGlyph* g, ule_u32 col_up,
 14+                         ule_u32* buf, ule_u32 stride);
 15+static ule_i8 parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size,
 16+                           ule_i32* encoding, ule_i32* advance, ule_i32* bw, ule_i32* bh,
 17+                           ule_i32* xoff, ule_i32* yoff, ule_i8* seen);
 18+static ule_u64 strtou64(const char* str);
 19 
 20 /* "blit" a glpyh to some buffer */
 21-static void glyph_to_buf(i32 sgx, i32 egx, i32 sgy, i32 egy,
 22-                         i32 gox, i32 goy, MausGlyph* g, u32 col_up,
 23-                         u32* buf, u32 stride)
 24+static void glyph_to_buf(ule_i32 sgx, ule_i32 egx, ule_i32 sgy, ule_i32 egy,
 25+                         ule_i32 gox, ule_i32 goy, MausGlyph* g, ule_u32 col_up,
 26+                         ule_u32* buf, ule_u32 stride)
 27 {
 28 	int gy;
 29 	int gx;
 30-	i32 dstx;
 31+	ule_i32 dstx;
 32 
 33-	u32* row;
 34-	i32 offset;
 35+	ule_u32* row;
 36+	ule_i32 offset;
 37 
 38 	for (gy = sgy; gy < egy; gy++) {
 39 		int dsty = goy + gy;
 40@@ -41,15 +41,15 @@ static void glyph_to_buf(i32 sgx, i32 egx, i32 sgy, i32 egy,
 41 	}
 42 }
 43 
 44-static i8 parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size,
 45-                           i32* encoding, i32* advance, i32* bw, i32* bh,
 46-                           i32* xoff, i32* yoff, i8* seen)
 47+static ule_i8 parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size,
 48+                           ule_i32* encoding, ule_i32* advance, ule_i32* bw, ule_i32* bh,
 49+                           ule_i32* xoff, ule_i32* yoff, ule_i8* seen)
 50 {
 51-	i32 rowbits;
 52+	ule_i32 rowbits;
 53 
 54-	i32 x;
 55-	i32 y;
 56-	u64 bits;
 57+	ule_i32 x;
 58+	ule_i32 y;
 59+	ule_u64 bits;
 60 
 61 	MausGlyph* g;
 62 
 63@@ -125,20 +125,20 @@ static i8 parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size,
 64 	return 1;
 65 }
 66 
 67-static u64 strtou64(const char* str)
 68+static ule_u64 strtou64(const char* str)
 69 {
 70-	u64 n = 0;
 71-	u8 c;
 72+	ule_u64 n = 0;
 73+	ule_u8 c;
 74 
 75 	while (*str) {
 76-		c = (u8)*str++;
 77+		c = (ule_u8)*str++;
 78 
 79 		if (c >= '0' && c <= '9')
 80-			c = (u8)(c - '0');
 81+			c = (ule_u8)(c - '0');
 82 		else if (c >= 'A' && c <= 'F')
 83-			c = (u8)(c - 'A' + 10);
 84+			c = (ule_u8)(c - 'A' + 10);
 85 		else if (c >= 'a' && c <= 'f')
 86-			c = (u8)(c - 'a' + 10);
 87+			c = (ule_u8)(c - 'a' + 10);
 88 		else
 89 			break;
 90 
 91@@ -148,28 +148,28 @@ static u64 strtou64(const char* str)
 92 	return n;
 93 }
 94 
 95-void maus_draw_text(Maus* mw, MausFont* font, i32 x, i32 y,
 96+void maus_draw_text(Maus* mw, MausFont* font, ule_i32 x, ule_i32 y,
 97                     const char* text, MausColor col)
 98 {
 99-	u32 col_up = MAUS_UNPACK_COL(col);
100+	ule_u32 col_up = MAUS_UNPACK_COL(col);
101 
102 	size_t i;
103 
104 	/* current coordinates */
105-	i32 cx = x;
106-	i32 cy = y;
107+	ule_i32 cx = x;
108+	ule_i32 cy = y;
109 
110 	/* origins to start drawing glyph from */
111-	i32 gox;
112-	i32 goy;
113+	ule_i32 gox;
114+	ule_i32 goy;
115 
116 	/* starting glyph coordinates */
117-	i32 sgx;
118-	i32 sgy;
119+	ule_i32 sgx;
120+	ule_i32 sgy;
121 
122 	/* ending glyph coordinates */
123-	i32 egx;
124-	i32 egy;
125+	ule_i32 egx;
126+	ule_i32 egy;
127 
128 	/* current glyph pointer */
129 	MausGlyph* g;
130@@ -186,7 +186,7 @@ void maus_draw_text(Maus* mw, MausFont* font, i32 x, i32 y,
131 			continue;
132 		}
133 
134-		g = &font->glyphs[(u8)c];
135+		g = &font->glyphs[(ule_u8)c];
136 		if (!g->valid) {
137 			/* still advance cx if character invalid */
138 			cx += (font->cellw > 0 ? font->cellw : 8);
139@@ -221,15 +221,15 @@ MausFont* maus_font_load(const char* path)
140 	MausFont* font = calloc(1, sizeof(MausFont));
141 	char line[1024];
142 
143-	i32 asc = -1;
144-	i32 dsc = -1;
145-	i32 encoding = -1;
146-	i32 advance = 0;
147-	i32 bw = 0; /* bmp width */
148-	i32 bh = 0; /* bmp height */
149-	i32 xoff = 0;
150-	i32 yoff = 0;
151-	i8 seen = 0;
152+	ule_i32 asc = -1;
153+	ule_i32 dsc = -1;
154+	ule_i32 encoding = -1;
155+	ule_i32 advance = 0;
156+	ule_i32 bw = 0; /* bmp width */
157+	ule_i32 bh = 0; /* bmp height */
158+	ule_i32 xoff = 0;
159+	ule_i32 yoff = 0;
160+	ule_i8 seen = 0;
161 
162 	int i;
163 
+105, -105
  1@@ -17,36 +17,36 @@
  2 #include "maus.h"
  3 #include "maus_wayland.h"
  4 
  5-static void registry_global_remove(void *data, struct wl_registry *wl_registry, u32 name);
  6-static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, u32 serial);
  7-static void xdg_toplevel_configure(void* data, struct xdg_toplevel* xdg_toplevel, i32 width, i32 height, struct wl_array* states);
  8+static void registry_global_remove(void *data, struct wl_registry *wl_registry, ule_u32 name);
  9+static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, ule_u32 serial);
 10+static void xdg_toplevel_configure(void* data, struct xdg_toplevel* xdg_toplevel, ule_i32 width, ule_i32 height, struct wl_array* states);
 11 static void xdg_toplevel_close(void* data, struct xdg_toplevel* xdg_toplevel);
 12-static void xdg_toplevel_configure_bounds(void* data, struct xdg_toplevel* xdg_toplevel, i32 width, i32 height);
 13+static void xdg_toplevel_configure_bounds(void* data, struct xdg_toplevel* xdg_toplevel, ule_i32 width, ule_i32 height);
 14 static void xdg_toplevel_wm_capabilities(void* data, struct xdg_toplevel* xdg_toplevel, struct wl_array* capabilities);
 15-static void wm_base_ping(void* data, struct xdg_wm_base* wm_base, u32 serial);
 16-static void seat_capabilities(void* data, struct wl_seat* seat, u32 capabilities);
 17+static void wm_base_ping(void* data, struct xdg_wm_base* wm_base, ule_u32 serial);
 18+static void seat_capabilities(void* data, struct wl_seat* seat, ule_u32 capabilities);
 19 static void seat_name(void* data, struct wl_seat* seat, const char* name);
 20-static void pointer_enter(void* data, struct wl_pointer* pointer, u32 serial, struct wl_surface* surface, wl_fixed_t sx, wl_fixed_t sy);
 21-static void pointer_leave(void* data, struct wl_pointer* pointer, u32 serial, struct wl_surface* surface);
 22-static void pointer_motion(void* data, struct wl_pointer* pointer, u32 time, wl_fixed_t sx, wl_fixed_t sy);
 23-static void pointer_button(void* data, struct wl_pointer* pointer, u32 serial, u32 time, u32 button, u32 state);
 24-static void pointer_axis(void* data, struct wl_pointer* pointer, u32 time, u32 axis, wl_fixed_t value);
 25+static void pointer_enter(void* data, struct wl_pointer* pointer, ule_u32 serial, struct wl_surface* surface, wl_fixed_t sx, wl_fixed_t sy);
 26+static void pointer_leave(void* data, struct wl_pointer* pointer, ule_u32 serial, struct wl_surface* surface);
 27+static void pointer_motion(void* data, struct wl_pointer* pointer, ule_u32 time, wl_fixed_t sx, wl_fixed_t sy);
 28+static void pointer_button(void* data, struct wl_pointer* pointer, ule_u32 serial, ule_u32 time, ule_u32 button, ule_u32 state);
 29+static void pointer_axis(void* data, struct wl_pointer* pointer, ule_u32 time, ule_u32 axis, wl_fixed_t value);
 30 static void pointer_frame(void* data, struct wl_pointer* pointer);
 31-static void pointer_axis_source(void* data, struct wl_pointer* pointer, u32 axis_source);
 32-static void pointer_axis_stop(void* data, struct wl_pointer* pointer, u32 time, u32 axis);
 33-static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, u32 axis, i32 discrete);
 34-static void pointer_axis_value120(void* data, struct wl_pointer* pointer, u32 axis, i32 value120);
 35-static void pointer_axis_relative_direction(void* data, struct wl_pointer* pointer, u32 axis, u32 direction);
 36-static void relative_pointer_motion(void* data, struct zwp_relative_pointer_v1* relative_pointer, u32 utime_hi, u32 utime_lo, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel);
 37-static void keyboard_keymap(void* data, struct wl_keyboard* keyboard, u32 format, i32 fd, u32 size);
 38-static void keyboard_enter(void* data, struct wl_keyboard* keyboard, u32 serial, struct wl_surface* surface, struct wl_array* keys);
 39-static void keyboard_leave(void* data, struct wl_keyboard* keyboard, u32 serial, struct wl_surface* surface);
 40-static void keyboard_key(void* data, struct wl_keyboard* keyboard, u32 serial, u32 time, u32 key, u32 state);
 41-static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, u32 serial, u32 mods_depressed, u32 mods_latched, u32 mods_locked, u32 group);
 42-static void keyboard_repeat_info(void* data, struct wl_keyboard* keyboard, i32 rate, i32 delay);
 43-static void registry_global(void* data, struct wl_registry* registry, u32 name, const char* interface, u32 version);
 44-
 45-static i8 cursor_init(Maus* mw);
 46+static void pointer_axis_source(void* data, struct wl_pointer* pointer, ule_u32 axis_source);
 47+static void pointer_axis_stop(void* data, struct wl_pointer* pointer, ule_u32 time, ule_u32 axis);
 48+static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, ule_u32 axis, ule_i32 discrete);
 49+static void pointer_axis_value120(void* data, struct wl_pointer* pointer, ule_u32 axis, ule_i32 value120);
 50+static void pointer_axis_relative_direction(void* data, struct wl_pointer* pointer, ule_u32 axis, ule_u32 direction);
 51+static void relative_pointer_motion(void* data, struct zwp_relative_pointer_v1* relative_pointer, ule_u32 utime_hi, ule_u32 utime_lo, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel);
 52+static void keyboard_keymap(void* data, struct wl_keyboard* keyboard, ule_u32 format, ule_i32 fd, ule_u32 size);
 53+static void keyboard_enter(void* data, struct wl_keyboard* keyboard, ule_u32 serial, struct wl_surface* surface, struct wl_array* keys);
 54+static void keyboard_leave(void* data, struct wl_keyboard* keyboard, ule_u32 serial, struct wl_surface* surface);
 55+static void keyboard_key(void* data, struct wl_keyboard* keyboard, ule_u32 serial, ule_u32 time, ule_u32 key, ule_u32 state);
 56+static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, ule_u32 serial, ule_u32 mods_depressed, ule_u32 mods_latched, ule_u32 mods_locked, ule_u32 group);
 57+static void keyboard_repeat_info(void* data, struct wl_keyboard* keyboard, ule_i32 rate, ule_i32 delay);
 58+static void registry_global(void* data, struct wl_registry* registry, ule_u32 name, const char* interface, ule_u32 version);
 59+
 60+static ule_i8 cursor_init(Maus* mw);
 61 static void cursor_destroy(Maus* mw);
 62 static void cursor_confine(Maus* mw);
 63 static void cursor_unconfine(Maus* mw);
 64@@ -55,13 +55,13 @@ static void cursor_hide(Maus* mw);
 65 static void cursor_relative(Maus* mw);
 66 static void cursor_absolute(Maus* mw);
 67 static void event_push_pending(Maus* mw);
 68-static i8 event_pop(Maus* mw, MausEventPending* ev);
 69-static void event_push_key(Maus* mw, u32 code, u32 sym, char text, u8 pressed);
 70-static i8 repeat_push_due(Maus* mw);
 71-static i32 repeat_timeout_ms(Maus* mw);
 72-static i8 display_read(Maus* mw, int timeout_ms);
 73+static ule_i8 event_pop(Maus* mw, MausEventPending* ev);
 74+static void event_push_key(Maus* mw, ule_u32 code, ule_u32 sym, char text, ule_u8 pressed);
 75+static ule_i8 repeat_push_due(Maus* mw);
 76+static ule_i32 repeat_timeout_ms(Maus* mw);
 77+static ule_i8 display_read(Maus* mw, int timeout_ms);
 78 static MausKey keysym_to_mauskey(xkb_keysym_t sym);
 79-static MausMouseButton wl_button_to_maus(u32 button);
 80+static MausMouseButton wl_button_to_maus(ule_u32 button);
 81 static void wl_buffer_release(void* data, struct wl_buffer* buffer);
 82 
 83 static struct wl_registry_listener registry_listener = { registry_global, registry_global_remove };
 84@@ -113,7 +113,7 @@ static void event_push_pending(Maus* mw)
 85 	be->pending.pending = 0;
 86 }
 87 
 88-static i8 event_pop(Maus* mw, MausEventPending* ev)
 89+static ule_i8 event_pop(Maus* mw, MausEventPending* ev)
 90 {
 91 	MausBackend* be = &mw->backend;
 92 
 93@@ -126,7 +126,7 @@ static i8 event_pop(Maus* mw, MausEventPending* ev)
 94 	return 1;
 95 }
 96 
 97-static void event_push_key(Maus* mw, u32 code, u32 sym, char text, u8 pressed)
 98+static void event_push_key(Maus* mw, ule_u32 code, ule_u32 sym, char text, ule_u8 pressed)
 99 {
100 	MausBackend* be = &mw->backend;
101 
102@@ -139,14 +139,14 @@ static void event_push_key(Maus* mw, u32 code, u32 sym, char text, u8 pressed)
103 	event_push_pending(mw);
104 }
105 
106-static void registry_global_remove(void *data, struct wl_registry *wl_registry, u32 name)
107+static void registry_global_remove(void *data, struct wl_registry *wl_registry, ule_u32 name)
108 {
109 	(void)data;
110 	(void)wl_registry;
111 	(void)name;
112 }
113 
114-static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, u32 serial)
115+static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, ule_u32 serial)
116 {
117 	Maus* mw = data;
118 	xdg_surface_ack_configure(xdg_surface, serial);
119@@ -159,7 +159,7 @@ static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, u
120 }
121 
122 static void xdg_toplevel_configure(void* data, struct xdg_toplevel* xdg_toplevel,
123-                                   i32 width, i32 height, struct wl_array* states)
124+                                   ule_i32 width, ule_i32 height, struct wl_array* states)
125 {
126 	Maus* mw = data;
127 
128@@ -188,7 +188,7 @@ static void xdg_toplevel_close(void* data, struct xdg_toplevel* xdg_toplevel)
129 }
130 
131 static void xdg_toplevel_configure_bounds(void* data, struct xdg_toplevel* xdg_toplevel,
132-                                          i32 width, i32 height)
133+                                          ule_i32 width, ule_i32 height)
134 {
135 	(void)data;
136 	(void)xdg_toplevel;
137@@ -204,15 +204,15 @@ static void xdg_toplevel_wm_capabilities(void* data, struct xdg_toplevel* xdg_to
138 	(void)capabilities;
139 }
140 
141-static void wm_base_ping(void* data, struct xdg_wm_base* wm_base, u32 serial)
142+static void wm_base_ping(void* data, struct xdg_wm_base* wm_base, ule_u32 serial)
143 {
144 	(void)data;
145 	xdg_wm_base_pong(wm_base, serial);
146 }
147 
148 static void registry_global(void* data, struct wl_registry* registry,
149-                            u32 name, const char* interface,
150-                            u32 version)
151+                            ule_u32 name, const char* interface,
152+                            ule_u32 version)
153 {
154 	Maus* mw = data;
155 	MausBackend* be = &mw->backend;
156@@ -237,7 +237,7 @@ static void registry_global(void* data, struct wl_registry* registry,
157 		be->relative_pointer_manager = wl_registry_bind(registry, name, &zwp_relative_pointer_manager_v1_interface, 1);
158 }
159 
160-static void seat_capabilities(void* data, struct wl_seat* seat, u32 capabilities)
161+static void seat_capabilities(void* data, struct wl_seat* seat, ule_u32 capabilities)
162 {
163 	Maus* mw = data;
164 	MausBackend* be = &mw->backend;
165@@ -269,7 +269,7 @@ static void seat_name(void* data, struct wl_seat* seat, const char* name)
166 	(void)name;
167 }
168 
169-static void pointer_enter(void* data, struct wl_pointer* pointer, u32 serial,
170+static void pointer_enter(void* data, struct wl_pointer* pointer, ule_u32 serial,
171                           struct wl_surface* surface, wl_fixed_t sx, wl_fixed_t sy)
172 {
173 	Maus* mw = data;
174@@ -286,7 +286,7 @@ static void pointer_enter(void* data, struct wl_pointer* pointer, u32 serial,
175 		cursor_hide(mw);
176 }
177 
178-static void pointer_leave(void* data, struct wl_pointer* pointer, u32 serial,
179+static void pointer_leave(void* data, struct wl_pointer* pointer, ule_u32 serial,
180                           struct wl_surface* surface)
181 {
182 	(void)data;
183@@ -295,13 +295,13 @@ static void pointer_leave(void* data, struct wl_pointer* pointer, u32 serial,
184 	(void)surface;
185 }
186 
187-static void pointer_motion(void* data, struct wl_pointer* pointer, u32 time,
188+static void pointer_motion(void* data, struct wl_pointer* pointer, ule_u32 time,
189                            wl_fixed_t sx, wl_fixed_t sy)
190 {
191 	Maus* mw = data;
192 	MausBackend* be = &mw->backend;
193-	i32 x;
194-	i32 y;
195+	ule_i32 x;
196+	ule_i32 y;
197 
198 	(void)pointer;
199 	(void)time;
200@@ -324,8 +324,8 @@ static void pointer_motion(void* data, struct wl_pointer* pointer, u32 time,
201 	event_push_pending(mw);
202 }
203 
204-static void pointer_button(void* data, struct wl_pointer* pointer, u32 serial,
205-                           u32 time, u32 button, u32 state)
206+static void pointer_button(void* data, struct wl_pointer* pointer, ule_u32 serial,
207+                           ule_u32 time, ule_u32 button, ule_u32 state)
208 {
209 	Maus* mw = data;
210 	MausMouseButton mb;
211@@ -345,8 +345,8 @@ static void pointer_button(void* data, struct wl_pointer* pointer, u32 serial,
212 	event_push_pending(mw);
213 }
214 
215-static void pointer_axis(void* data, struct wl_pointer* pointer, u32 time,
216-                         u32 axis, wl_fixed_t value)
217+static void pointer_axis(void* data, struct wl_pointer* pointer, ule_u32 time,
218+                         ule_u32 axis, wl_fixed_t value)
219 {
220 	Maus* mw = data;
221 
222@@ -371,22 +371,22 @@ static void pointer_frame(void* data, struct wl_pointer* pointer)
223 	(void)pointer;
224 }
225 
226-static void pointer_axis_source(void* data, struct wl_pointer* pointer, u32 axis_source)
227+static void pointer_axis_source(void* data, struct wl_pointer* pointer, ule_u32 axis_source)
228 {
229 	(void)data;
230 	(void)pointer;
231 	(void)axis_source;
232 }
233 
234-static void pointer_axis_stop(void* data, struct wl_pointer* pointer, u32 time, u32 axis) {
235+static void pointer_axis_stop(void* data, struct wl_pointer* pointer, ule_u32 time, ule_u32 axis) {
236 	(void)data;
237 	(void)pointer;
238 	(void)time;
239 	(void)axis;
240 }
241 
242-static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, u32 axis,
243-                                  i32 discrete)
244+static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, ule_u32 axis,
245+                                  ule_i32 discrete)
246 {
247 	(void)data;
248 	(void)pointer;
249@@ -394,8 +394,8 @@ static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, u32 ax
250 	(void)discrete;
251 }
252 
253-static void pointer_axis_value120(void* data, struct wl_pointer* pointer, u32 axis,
254-                                  i32 value120)
255+static void pointer_axis_value120(void* data, struct wl_pointer* pointer, ule_u32 axis,
256+                                  ule_i32 value120)
257 {
258 	(void)data;
259 	(void)pointer;
260@@ -404,7 +404,7 @@ static void pointer_axis_value120(void* data, struct wl_pointer* pointer, u32 ax
261 }
262 
263 static void pointer_axis_relative_direction(void* data, struct wl_pointer* pointer,
264-                                            u32 axis, u32 direction)
265+                                            ule_u32 axis, ule_u32 direction)
266 {
267 	(void)data;
268 	(void)pointer;
269@@ -413,7 +413,7 @@ static void pointer_axis_relative_direction(void* data, struct wl_pointer* point
270 }
271 
272 static void relative_pointer_motion(void* data, struct zwp_relative_pointer_v1* relative_pointer,
273-                                    u32 utime_hi, u32 utime_lo,
274+                                    ule_u32 utime_hi, ule_u32 utime_lo,
275                                     wl_fixed_t dx, wl_fixed_t dy,
276                                     wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel)
277 {
278@@ -434,8 +434,8 @@ static void relative_pointer_motion(void* data, struct zwp_relative_pointer_v1*
279 	event_push_pending(mw);
280 }
281 
282-static void keyboard_keymap(void* data, struct wl_keyboard* keyboard, u32 format,
283-                            i32 fd, u32 size)
284+static void keyboard_keymap(void* data, struct wl_keyboard* keyboard, ule_u32 format,
285+                            ule_i32 fd, ule_u32 size)
286 {
287 	Maus* mw = data;
288 	MausBackend* be = &mw->backend;
289@@ -474,7 +474,7 @@ static void keyboard_keymap(void* data, struct wl_keyboard* keyboard, u32 format
290 	be->xkb_state = xkb_state_new(be->xkb_keymap);
291 }
292 
293-static void keyboard_enter(void* data, struct wl_keyboard* keyboard, u32 serial,
294+static void keyboard_enter(void* data, struct wl_keyboard* keyboard, ule_u32 serial,
295                            struct wl_surface* surface, struct wl_array* keys)
296 {
297 	(void)data;
298@@ -484,7 +484,7 @@ static void keyboard_enter(void* data, struct wl_keyboard* keyboard, u32 serial,
299 	(void)keys;
300 }
301 
302-static void keyboard_leave(void* data, struct wl_keyboard* keyboard, u32 serial,
303+static void keyboard_leave(void* data, struct wl_keyboard* keyboard, ule_u32 serial,
304                            struct wl_surface* surface)
305 {
306 	Maus* mw = data;
307@@ -496,17 +496,17 @@ static void keyboard_leave(void* data, struct wl_keyboard* keyboard, u32 serial,
308 	mw->backend.repeat_key_code = 0;
309 }
310 
311-static void keyboard_key(void* data, struct wl_keyboard* keyboard, u32 serial,
312-                         u32 time, u32 key, u32 state)
313+static void keyboard_key(void* data, struct wl_keyboard* keyboard, ule_u32 serial,
314+                         ule_u32 time, ule_u32 key, ule_u32 state)
315 {
316 	Maus* mw = data;
317 	MausBackend* be = &mw->backend;
318-	u32 code;
319+	ule_u32 code;
320 	xkb_keysym_t sym;
321 	MausKey maus_key;
322 	char text[8];
323 	int len;
324-	u8 pressed;
325+	ule_u8 pressed;
326 
327 	(void)keyboard;
328 	(void)serial;
329@@ -553,9 +553,9 @@ static void keyboard_key(void* data, struct wl_keyboard* keyboard, u32 serial,
330 		be->repeat_key_code = 0;
331 }
332 
333-static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, u32 serial,
334-                               u32 mods_depressed, u32 mods_latched,
335-                               u32 mods_locked, u32 group)
336+static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, ule_u32 serial,
337+                               ule_u32 mods_depressed, ule_u32 mods_latched,
338+                               ule_u32 mods_locked, ule_u32 group)
339 {
340 	Maus* mw = data;
341 
342@@ -573,7 +573,7 @@ static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, u32 ser
343 }
344 
345 static void keyboard_repeat_info(void* data, struct wl_keyboard* keyboard,
346-                                 i32 rate, i32 delay)
347+                                 ule_i32 rate, ule_i32 delay)
348 {
349 	Maus* mw = data;
350 
351@@ -585,11 +585,11 @@ static void keyboard_repeat_info(void* data, struct wl_keyboard* keyboard,
352 		mw->backend.repeat_key_code = 0;
353 }
354 
355-static i8 repeat_push_due(Maus* mw)
356+static ule_i8 repeat_push_due(Maus* mw)
357 {
358 	MausBackend* be = &mw->backend;
359-	u64 now;
360-	u64 interval;
361+	ule_u64 now;
362+	ule_u64 interval;
363 
364 	if (be->repeat_key_code == 0 || be->repeat_rate <= 0)
365 		return 0;
366@@ -607,11 +607,11 @@ static i8 repeat_push_due(Maus* mw)
367 	return 1;
368 }
369 
370-static i32 repeat_timeout_ms(Maus* mw)
371+static ule_i32 repeat_timeout_ms(Maus* mw)
372 {
373 	MausBackend* be = &mw->backend;
374-	u64 now;
375-	u64 diff;
376+	ule_u64 now;
377+	ule_u64 diff;
378 
379 	if (be->repeat_key_code == 0 || be->repeat_rate <= 0)
380 		return -1;
381@@ -622,10 +622,10 @@ static i32 repeat_timeout_ms(Maus* mw)
382 
383 	diff = be->repeat_next_ns - now;
384 	/* round xto nearest ms */
385-	return (i32)((diff + 999999) / 1000000);
386+	return (ule_i32)((diff + 999999) / 1000000);
387 }
388 
389-static i8 display_read(Maus* mw, int timeout_ms)
390+static ule_i8 display_read(Maus* mw, int timeout_ms)
391 {
392 	MausBackend* be = &mw->backend;
393 	struct pollfd pfd;
394@@ -657,7 +657,7 @@ static i8 display_read(Maus* mw, int timeout_ms)
395 }
396 
397 
398-static i8 cursor_init(Maus* mw)
399+static ule_i8 cursor_init(Maus* mw)
400 {
401 	MausBackend* be = &mw->backend;
402 
403@@ -794,13 +794,13 @@ static void cursor_absolute(Maus* mw)
404 		cursor_confine(mw);
405 }
406 
407-static i8 fb_create(Maus* mw);
408-static i8 fb_create_buffer(Maus* mw, MausWLBuffer* wb);
409-static i8 fb_create_shm(size_t size);
410+static ule_i8 fb_create(Maus* mw);
411+static ule_i8 fb_create_buffer(Maus* mw, MausWLBuffer* wb);
412+static ule_i8 fb_create_shm(size_t size);
413 static void fb_destroy(Maus* mw);
414-static i8 handle_event(Maus* mw, MausEvent* ev);
415+static ule_i8 handle_event(Maus* mw, MausEvent* ev);
416 
417-static i8 fb_create(Maus* mw)
418+static ule_i8 fb_create(Maus* mw)
419 {
420 	MausBackend* be = &mw->backend;
421 
422@@ -818,7 +818,7 @@ static i8 fb_create(Maus* mw)
423 	return 1;
424 }
425 
426-static i8 fb_create_buffer(Maus* mw, MausWLBuffer* wb)
427+static ule_i8 fb_create_buffer(Maus* mw, MausWLBuffer* wb)
428 {
429 	MausBackend* be = &mw->backend;
430 	struct wl_shm_pool* pool;
431@@ -863,7 +863,7 @@ static i8 fb_create_buffer(Maus* mw, MausWLBuffer* wb)
432 	return 1;
433 }
434 
435-static i8 fb_create_shm(size_t size)
436+static ule_i8 fb_create_shm(size_t size)
437 {
438 	char name[64];
439 	int fd;
440@@ -893,7 +893,7 @@ static void fb_destroy(Maus* mw)
441 {
442 	MausBackend* be = &mw->backend;
443 
444-	u32 i;
445+	ule_u32 i;
446 
447 	for (i = 0; i < 2; i++) {
448 		if (be->buffers[i].buffer)
449@@ -910,7 +910,7 @@ static void fb_destroy(Maus* mw)
450 	mw->fb = NULL;
451 }
452 
453-static i8 handle_event(Maus* mw, MausEvent* ev)
454+static ule_i8 handle_event(Maus* mw, MausEvent* ev)
455 {
456 	MausEventPending pending;
457 
458@@ -952,7 +952,7 @@ static i8 handle_event(Maus* mw, MausEvent* ev)
459 	}
460 }
461 
462-static MausMouseButton wl_button_to_maus(u32 button)
463+static MausMouseButton wl_button_to_maus(ule_u32 button)
464 {
465 	switch (button) {
466 		case 0x110: return MAUS_MOUSE_BUTTON_LEFT;
467@@ -1014,10 +1014,10 @@ static MausKey keysym_to_mauskey(xkb_keysym_t sym)
468 
469 void maus_clear(Maus* mw, MausColor col)
470 {
471-	u32 up = MAUS_UNPACK_COL(col);
472-	u32 pxs = mw->height * mw->width;
473+	ule_u32 up = MAUS_UNPACK_COL(col);
474+	ule_u32 pxs = mw->height * mw->width;
475 
476-	u32 i;
477+	ule_u32 i;
478 
479 	for (i = 0; i < pxs; i++)
480 		mw->bfb[i] = up;
481@@ -1106,7 +1106,7 @@ void maus_close(Maus* mw)
482 	free(mw);
483 }
484 
485-i8 maus_close_window(Maus* mw)
486+ule_i8 maus_close_window(Maus* mw)
487 {
488 	MausBackend* be = &mw->backend;
489 
490@@ -1129,7 +1129,7 @@ i8 maus_close_window(Maus* mw)
491 	return 1;
492 }
493 
494-i8 maus_create_window(Maus* mw)
495+ule_i8 maus_create_window(Maus* mw)
496 {
497 	MausBackend* be = &mw->backend;
498 
499@@ -1204,7 +1204,7 @@ Maus* maus_init(const char* title, int x, int y, int width, int height)
500 	be->cursor_visible = 1;
501 	be->cursor_confined = 0;
502 
503-	mw->bfb = calloc(mw->stride * mw->height, sizeof(u32));
504+	mw->bfb = calloc(mw->stride * mw->height, sizeof(ule_u32));
505 	if (!mw->bfb)
506 		goto close;
507 
508@@ -1215,10 +1215,10 @@ close:
509 	return NULL;
510 }
511 
512-i8 maus_event_poll(Maus* mw, MausEvent* ev)
513+ule_i8 maus_event_poll(Maus* mw, MausEvent* ev)
514 {
515 	MausBackend* be = &mw->backend;
516-	i8 read;
517+	ule_i8 read;
518 
519 	ev->type = MAUS_EV_NONE;
520 
521@@ -1248,8 +1248,8 @@ i8 maus_event_poll(Maus* mw, MausEvent* ev)
522 void maus_event_wait(Maus* mw, MausEvent* ev)
523 {
524 	MausBackend* be = &mw->backend;
525-	i32 timeout;
526-	i8 read;
527+	ule_i32 timeout;
528+	ule_i8 read;
529 
530 	ev->type = MAUS_EV_NONE;
531 
532@@ -1283,7 +1283,7 @@ void maus_present(Maus* mw)
533 	MausWLBuffer* wb = NULL;
534 	size_t bytes;
535 
536-	u32 i;
537+	ule_u32 i;
538 
539 	for (i = 0; i < 2; i++) {
540 		if (be->buffers[i].buffer && !be->buffers[i].busy) {
541@@ -1295,7 +1295,7 @@ void maus_present(Maus* mw)
542 	if (!wb)
543 		return;
544 
545-	bytes = mw->stride * mw->height * sizeof(u32);
546+	bytes = mw->stride * mw->height * sizeof(ule_u32);
547 	memcpy(wb->data, mw->bfb, bytes);
548 	mw->fb = wb->data;
549 	wb->busy = 1;
550@@ -1306,14 +1306,14 @@ void maus_present(Maus* mw)
551 	wl_display_flush(be->display);
552 }
553 
554-i8 maus_resize(Maus* mw, u32 width, u32 height)
555+ule_i8 maus_resize(Maus* mw, ule_u32 width, ule_u32 height)
556 {
557-	u32* bfb;
558+	ule_u32* bfb;
559 
560 	if (width == 0 || height == 0)
561 		return 0;
562 
563-	bfb = calloc(width * height, sizeof(u32));
564+	bfb = calloc(width * height, sizeof(ule_u32));
565 	if (!bfb)
566 		return 0;
567 
+17, -17
  1@@ -10,9 +10,9 @@ typedef struct {
  2 	MausKey maus;
  3 } KeyMapEntry;
  4 
  5-static i8 fb_create(Maus* mw);
  6+static ule_i8 fb_create(Maus* mw);
  7 static void fb_destroy(Maus* mw);
  8-static i8 handle_event(const MSG* msg, MausEvent* ev, Maus* mw);
  9+static ule_i8 handle_event(const MSG* msg, MausEvent* ev, Maus* mw);
 10 static MausKey vk_to_mauskey(UINT vk);
 11 static UINT resolve_lr(UINT vk, LPARAM lparam);
 12 static char translate_text(UINT vk, UINT scan);
 13@@ -38,7 +38,7 @@ static const KeyMapEntry keymap[] = {
 14 	{ VK_DIVIDE,   MAUS_KEY_KP_DIVIDE }, { VK_DECIMAL,  MAUS_KEY_KP_DECIMAL },
 15 };
 16 
 17-static i8 fb_create(Maus* mw)
 18+static ule_i8 fb_create(Maus* mw)
 19 {
 20 	MausBackend* be = &mw->backend;
 21 	BITMAPINFO bmi = {0};
 22@@ -89,7 +89,7 @@ static void fb_destroy(Maus* mw)
 23 	mw->stride = 0;
 24 }
 25 
 26-static i8 handle_event(const MSG* msg, MausEvent* ev, Maus* mw)
 27+static ule_i8 handle_event(const MSG* msg, MausEvent* ev, Maus* mw)
 28 {
 29 	UINT scan;
 30 	UINT vk;
 31@@ -161,7 +161,7 @@ static i8 handle_event(const MSG* msg, MausEvent* ev, Maus* mw)
 32 			vk = resolve_lr((UINT)msg->wParam, msg->lParam);
 33 
 34 			ev->type = MAUS_EV_KEY;
 35-			ev->key.code = (u32)msg->wParam;
 36+			ev->key.code = (ule_u32)msg->wParam;
 37 			ev->key.pressed = 1;
 38 			ev->key.key = vk_to_mauskey(vk);
 39 			ev->key.text = translate_text((UINT)msg->wParam, scan);
 40@@ -177,7 +177,7 @@ static i8 handle_event(const MSG* msg, MausEvent* ev, Maus* mw)
 41 			vk = resolve_lr((UINT)msg->wParam, msg->lParam);
 42 
 43 			ev->type = MAUS_EV_KEY;
 44-			ev->key.code = (u32)msg->wParam;
 45+			ev->key.code = (ule_u32)msg->wParam;
 46 			ev->key.pressed = 0;
 47 			ev->key.key = vk_to_mauskey(vk);
 48 			ev->key.text = 0;
 49@@ -270,9 +270,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 50 
 51 void maus_clear(Maus* mw, MausColor col)
 52 {
 53-	u32 col_up = MAUS_UNPACK_COL(col);
 54-	u32 pxs = mw->height * mw->width;
 55-	u32 i;
 56+	ule_u32 col_up = MAUS_UNPACK_COL(col);
 57+	ule_u32 pxs = mw->height * mw->width;
 58+	ule_u32 i;
 59 
 60 	for (i = 0; i < pxs; i++)
 61 		mw->bfb[i] = col_up;
 62@@ -361,7 +361,7 @@ void maus_close(Maus* mw)
 63 		(void) maus_close_window(mw);
 64 }
 65 
 66-i8 maus_close_window(Maus* mw)
 67+ule_i8 maus_close_window(Maus* mw)
 68 {
 69 	MausBackend* be = &mw->backend;
 70 
 71@@ -375,7 +375,7 @@ i8 maus_close_window(Maus* mw)
 72 }
 73 
 74 
 75-i8 maus_create_window(Maus* mw)
 76+ule_i8 maus_create_window(Maus* mw)
 77 {
 78 	MausBackend* be = &mw->backend;
 79 	be->hInst = GetModuleHandle(NULL);
 80@@ -429,7 +429,7 @@ Maus* maus_init(const char* title, int x, int y, int width, int height)
 81 		return NULL;
 82 	}
 83 
 84-	mw->bfb = calloc(mw->stride * mw->height, sizeof(u32));
 85+	mw->bfb = calloc(mw->stride * mw->height, sizeof(ule_u32));
 86 	if (!mw->bfb) {
 87 		maus_log(stderr, "failed to allocate back buffer");
 88 		maus_close(mw);
 89@@ -440,7 +440,7 @@ Maus* maus_init(const char* title, int x, int y, int width, int height)
 90 	return mw;
 91 }
 92 
 93-i8 maus_event_poll(Maus* mw, MausEvent* ev)
 94+ule_i8 maus_event_poll(Maus* mw, MausEvent* ev)
 95 {
 96 	MausBackend* be = &mw->backend;
 97 	MSG msg;
 98@@ -503,21 +503,21 @@ void maus_present(Maus* mw)
 99 	MausBackend* be = &mw->backend;
100 	HDC wdc;
101 
102-	u32 bytes;
103+	ule_u32 bytes;
104 
105 	if (!be->hwnd || !be->memdc)
106 		return;
107 
108 	wdc = GetDC(be->hwnd);
109 
110-	bytes = mw->stride * mw->height * sizeof(u32);
111+	bytes = mw->stride * mw->height * sizeof(ule_u32);
112 	memcpy(mw->fb, mw->bfb, bytes);
113 
114 	BitBlt(wdc, 0, 0, mw->width, mw->height, be->memdc, 0, 0, SRCCOPY);
115 	ReleaseDC(be->hwnd, wdc);
116 }
117 
118-i8 maus_resize(Maus* mw, u32 width, u32 height)
119+ule_i8 maus_resize(Maus* mw, ule_u32 width, ule_u32 height)
120 {
121 	if (width == 0 || height == 0 ||
122 	   (mw->width == width && mw->height == height))
123@@ -535,7 +535,7 @@ i8 maus_resize(Maus* mw, u32 width, u32 height)
124 	if (!fb_create(mw))
125 		return 0;
126 
127-	mw->bfb = calloc(mw->stride * mw->height, sizeof(u32));
128+	mw->bfb = calloc(mw->stride * mw->height, sizeof(ule_u32));
129 	if (!mw->bfb)
130 		return 0;
131 
+27, -27
  1@@ -21,15 +21,15 @@ typedef struct {
  2 	MausKey maus;
  3 } KeyMapEntry;
  4 
  5-static i8 fb_create(Maus* mw);
  6-static i8 fb_create_shm(Maus* mw);
  7-/* TODO static i8 fb_create_ximage(Maus* mw); */
  8+static ule_i8 fb_create(Maus* mw);
  9+static ule_i8 fb_create_shm(Maus* mw);
 10+/* TODO static ule_i8 fb_create_ximage(Maus* mw); */
 11 static void fb_destroy(Maus* mw);
 12-static i8 handle_event(XEvent* xev, MausEvent* ev, Maus* mw);
 13+static ule_i8 handle_event(XEvent* xev, MausEvent* ev, Maus* mw);
 14 static MausKey keysym_to_mauskey(KeySym sym);
 15 static MausMouseButton mouse_button_to_maus(int btn);
 16 static int xerr(Display* dpy, XErrorEvent* ev);
 17-static i8 xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent* ev);
 18+static ule_i8 xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent* ev);
 19 static void xi2_init(Maus* mw);
 20 
 21 static const KeyMapEntry keymap[] = {
 22@@ -61,7 +61,7 @@ static const KeyMapEntry keymap[] = {
 23 
 24 static int xerrored;
 25 
 26-static i8 fb_create(Maus* mw)
 27+static ule_i8 fb_create(Maus* mw)
 28 {
 29 	MausBackend* be = &mw->backend;
 30 
 31@@ -76,7 +76,7 @@ static i8 fb_create(Maus* mw)
 32 }
 33 
 34 /* allocate and store a new shm for the framebuffer */
 35-static i8 fb_create_shm(Maus* mw)
 36+static ule_i8 fb_create_shm(Maus* mw)
 37 {
 38 	MausBackend* be = &mw->backend;
 39 	int scr = DefaultScreen(be->display);
 40@@ -156,8 +156,8 @@ static i8 fb_create_shm(Maus* mw)
 41 	shmctl(be->shm.shmid, IPC_RMID, NULL);
 42 
 43 	be->shmat = 1;
 44-	mw->fb = (u32*) be->image->data;
 45-	mw->stride = be->image->bytes_per_line / sizeof(u32);
 46+	mw->fb = (ule_u32*) be->image->data;
 47+	mw->stride = be->image->bytes_per_line / sizeof(ule_u32);
 48 
 49 	return 1;
 50 }
 51@@ -194,10 +194,10 @@ static void fb_destroy(Maus* mw)
 52 	mw->stride = 0;
 53 }
 54 
 55-static i8 handle_event(XEvent* xev, MausEvent* ev, Maus* mw)
 56+static ule_i8 handle_event(XEvent* xev, MausEvent* ev, Maus* mw)
 57 {
 58 	MausBackend* be = &mw->backend;
 59-	u32 code = 0;
 60+	ule_u32 code = 0;
 61 	unsigned int mb;
 62 	MausMouseButton mbtype;
 63 
 64@@ -213,7 +213,7 @@ static i8 handle_event(XEvent* xev, MausEvent* ev, Maus* mw)
 65 
 66 	int cx;
 67 	int cy;
 68-	i8 handled;
 69+	ule_i8 handled;
 70 
 71 	if (xev->type == GenericEvent && XGetEventData(be->display, &xev->xcookie)) {
 72 		handled = xi2_handle_event(mw, &xev->xcookie, ev);
 73@@ -425,7 +425,7 @@ static int xerr(Display* dpy, XErrorEvent* ev)
 74 	return 0;
 75 }
 76 
 77-static i8 xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent* ev)
 78+static ule_i8 xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent* ev)
 79 {
 80 	MausBackend* be = &mw->backend;
 81 	XIRawEvent* raw;
 82@@ -457,8 +457,8 @@ static i8 xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent* ev)
 83 	}
 84 
 85 	ev->type = MAUS_EV_MOUSE_MOTION;
 86-	ev->mouse.motion.x = (i32)dx;
 87-	ev->mouse.motion.y = (i32)dy;
 88+	ev->mouse.motion.x = (ule_i32)dx;
 89+	ev->mouse.motion.y = (ule_i32)dy;
 90 	ev->mouse.motion.dx = ev->mouse.motion.x;
 91 	ev->mouse.motion.dy = ev->mouse.motion.y;
 92 	return ev->mouse.motion.dx != 0 || ev->mouse.motion.dy != 0;
 93@@ -527,7 +527,7 @@ char* maus_clipboard_get_text(Maus* mw)
 94 	Atom maus_clipboard_prop = XInternAtom(be->display, "MAUS_CLIPBOARD_PROP", False);
 95 
 96 	XEvent xev;
 97-	i8 ok = 0;
 98+	ule_i8 ok = 0;
 99 
100 	int timeout;
101 
102@@ -593,7 +593,7 @@ void maus_close(Maus* mw)
103 		XCloseDisplay(be->display);
104 }
105 
106-i8 maus_close_window(Maus* mw)
107+ule_i8 maus_close_window(Maus* mw)
108 {
109 	MausBackend* be = &mw->backend;
110 
111@@ -610,7 +610,7 @@ i8 maus_close_window(Maus* mw)
112 	return 1;
113 }
114 
115-i8 maus_create_window(Maus* mw)
116+ule_i8 maus_create_window(Maus* mw)
117 {
118 	MausBackend* be = &mw->backend;
119 	Display* dpy = be->display;
120@@ -655,9 +655,9 @@ i8 maus_create_window(Maus* mw)
121 
122 void maus_clear(Maus* mw, MausColor col)
123 {
124-	u32 col_up = MAUS_UNPACK_COL(col);
125-	u32 pxs = mw->height * mw->width;
126-	u32 i;
127+	ule_u32 col_up = MAUS_UNPACK_COL(col);
128+	ule_u32 pxs = mw->height * mw->width;
129+	ule_u32 i;
130 	for (i = 0; i < pxs; i++)
131 		mw->bfb[i] = col_up;
132 }
133@@ -705,7 +705,7 @@ Maus* maus_init(const char* title, int x, int y, int width, int height)
134 		free(mw);
135 		return NULL;
136 	}
137-	mw->bfb = calloc(mw->stride * mw->height, sizeof(u32));
138+	mw->bfb = calloc(mw->stride * mw->height, sizeof(ule_u32));
139 	if (!mw->bfb) {
140 		maus_log(stderr, "failed to allocate back buffer");
141 		maus_close(mw);
142@@ -716,7 +716,7 @@ Maus* maus_init(const char* title, int x, int y, int width, int height)
143 	return mw;
144 }
145 
146-i8 maus_event_poll(Maus* mw, MausEvent* ev)
147+ule_i8 maus_event_poll(Maus* mw, MausEvent* ev)
148 {
149 	MausBackend* be = &mw->backend;
150 	XEvent xev;
151@@ -748,12 +748,12 @@ void maus_event_wait(Maus* mw, MausEvent* ev)
152 void maus_present(Maus* mw)
153 {
154 	MausBackend* be = &mw->backend;
155-	u32 bytes;
156+	ule_u32 bytes;
157 
158 	if (!be->image || be->win == None)
159 		return;
160 
161-	bytes = mw->stride * mw->height * sizeof(u32);
162+	bytes = mw->stride * mw->height * sizeof(ule_u32);
163 	memcpy(mw->fb, mw->bfb, bytes);
164 
165 	XShmPutImage(
166@@ -764,7 +764,7 @@ void maus_present(Maus* mw)
167 	XFlush(be->display);
168 }
169 
170-i8 maus_resize(Maus* mw, u32 width, u32 height)
171+ule_i8 maus_resize(Maus* mw, ule_u32 width, ule_u32 height)
172 {
173 	MausBackend* be = &mw->backend;
174 
175@@ -787,7 +787,7 @@ i8 maus_resize(Maus* mw, u32 width, u32 height)
176 	if (!fb_create(mw))
177 		return 0;
178 
179-	mw->bfb = calloc(mw->stride * mw->height, sizeof(u32));
180+	mw->bfb = calloc(mw->stride * mw->height, sizeof(ule_u32));
181 	if (!mw->bfb)
182 		return 0;
183