commit 67b5ea9
uint
·
2026-10-03 15:12:08 +0000 UTC
parent e2f8cb4
Replace stdint with libule types header
13 files changed,
+468,
-300
+8,
-7
1@@ -1,4 +1,5 @@
2-#include <stdint.h>
3+#define ULE_SHORT_TYPE_NAMES
4+#include "uletypes.h"
5 #include <stdlib.h>
6
7 #include "maus.h"
8@@ -24,7 +25,7 @@ void handle_ev(Maus* mw, MausEvent* ev)
9 exit(EXIT_SUCCESS);
10 break;
11 case MAUS_EV_KEY: {
12- int8_t* keys = mw->key_syms;
13+ i8* keys = mw->key_syms;
14
15 if (keys[MAUS_KEY_CONTROL_L] && keys[MAUS_KEY_Q]) {
16 maus_close(mw);
17@@ -104,9 +105,9 @@ int main(void)
18 MausFont* font;
19 MausEvent ev;
20 MausColor red = { 255, 255, 0, 0 };
21- uint32_t red_unpacked;
22- uint32_t x;
23- uint32_t y;
24+ u32 red_unpacked;
25+ u32 x;
26+ u32 y;
27
28 mw = maus_init("basic window", 0, 0, 800, 600);
29 if (!mw)
30@@ -131,8 +132,8 @@ int main(void)
31
32 red_unpacked = MAUS_UNPACK_COL(red);
33 if (mx >= 0 && my >= 0 &&
34- mx < (int32_t)mw->width &&
35- my < (int32_t)mw->height && mb1_pressed) {
36+ mx < (i32)mw->width &&
37+ my < (i32)mw->height && mb1_pressed) {
38 MAUS_PIXEL_AT(mw, mx, my) = red_unpacked;
39 }
40
+40,
-39
1@@ -2,7 +2,8 @@
2 #define MAUS_H
3
4 #include <stdio.h>
5-#include <stdint.h>
6+#define ULE_SHORT_TYPE_NAMES
7+#include "uletypes.h"
8
9 #include "maus_input.h"
10
11@@ -48,10 +49,10 @@
12 #define MAUS_COL_ARGB(a, r, g, b) (MausColor){a, r, g, b}
13 #define MAUS_COL_RGBA(r, g, b, a) (MausColor){a, r, g, b}
14 #define MAUS_UNPACK_COL(c) \
15- (((uint32_t)(c).a << 24) | \
16- ((uint32_t)(c).r << 16) | \
17- ((uint32_t)(c).g << 8) | \
18- ((uint32_t)(c).b))
19+ (((u32)(c).a << 24) | \
20+ ((u32)(c).r << 16) | \
21+ ((u32)(c).g << 8) | \
22+ ((u32)(c).b))
23
24 #define MAUS_PIXEL_AT(mw, x, y) ((mw)->bfb[(y) * (mw)->stride + (x)])
25
26@@ -67,62 +68,62 @@ typedef enum {
27 } MausEventType;
28
29 typedef struct {
30- uint8_t a;
31- uint8_t r;
32- uint8_t g;
33- uint8_t b;
34+ u8 a;
35+ u8 r;
36+ u8 g;
37+ u8 b;
38 } MausColor;
39
40 typedef struct {
41 MausEventType type;
42
43 struct {
44- uint32_t code; /* raw, backend keycode */
45- MausKey key; /* logical, mapped key */
46- char text; /* translated text from key */
47- int8_t pressed;
48+ u32 code; /* raw, backend keycode */
49+ MausKey key; /* logical, mapped key */
50+ char text; /* translated text from key */
51+ i8 pressed;
52 } key;
53
54 struct {
55 struct {
56 MausMouseButton button;
57- int8_t pressed;
58+ i8 pressed;
59 } button;
60
61 struct {
62- int32_t x;
63- int32_t y;
64- int32_t dx;
65- int32_t dy;
66+ i32 x;
67+ i32 y;
68+ i32 dx;
69+ i32 dy;
70 } motion;
71 } mouse;
72
73 struct {
74- uint32_t width;
75- uint32_t height;
76+ u32 width;
77+ u32 height;
78 } resize;
79 } MausEvent;
80
81 typedef struct {
82 MausBackend backend;
83- uint64_t frame_time_last;
84- char* clipboard;
85+ u64 frame_time_last;
86+ char* clipboard;
87
88- uint32_t* fb; /* front frame buffer */
89- uint32_t* bfb; /* back frame buffer */
90- uint32_t stride;
91+ u32* fb; /* front frame buffer */
92+ u32* bfb; /* back frame buffer */
93+ u32 stride;
94
95 const char* title;
96- uint32_t width;
97- uint32_t height;
98- int32_t x;
99- int32_t y;
100+ u32 width;
101+ u32 height;
102+ i32 x;
103+ i32 y;
104
105- int8_t key_codes[MAUS_KEYCODE_LAST]; /* physical keys */
106- int8_t key_syms[MAUS_KEY_LAST]; /* logical keys */
107+ i8 key_codes[MAUS_KEYCODE_LAST]; /* physical keys */
108+ i8 key_syms[MAUS_KEY_LAST]; /* logical keys */
109
110 MausCursor cursor;
111- int8_t mouse_buttons[MAUS_MOUSE_BUTTON_LAST];
112+ i8 mouse_buttons[MAUS_MOUSE_BUTTON_LAST];
113 } Maus;
114
115 /* clear screen with color: `col` */
116@@ -139,16 +140,16 @@ char* maus_clipboard_get_text(Maus* mw);
117 void maus_close(Maus* mw);
118
119 /* close a window without the whole Maus. returns 0 on fail */
120-int8_t maus_close_window(Maus* mw);
121+i8 maus_close_window(Maus* mw);
122
123 /* create window from Maus. returns 0 on fail */
124-int8_t maus_create_window(Maus* mw);
125+i8 maus_create_window(Maus* mw);
126
127 /* log message to output `fd` and die */
128 void maus_die(const char* fmt, ...);
129
130 /* get time since arbitrary start point (ns) */
131-uint64_t maus_get_time_ns(void);
132+u64 maus_get_time_ns(void);
133
134 /* initialise and fills the Maus. returns NULL on fail */
135 Maus* maus_init(const char* title, int x, int y, int width, int height);
136@@ -159,7 +160,7 @@ void maus_log(FILE* fd, const char* fmt, ...);
137 /* poll for events then fill `ev` with retrieved events.
138 returns 1 if event polled, else 0.
139 note: can burn cpu cycles */
140-int8_t maus_event_poll(Maus* mw, MausEvent* ev);
141+i8 maus_event_poll(Maus* mw, MausEvent* ev);
142
143 /* poll for events then fill `ev` with retrieved events. returns 1 if event
144 polled, else 0. note, thread goes to sleep until an event arrives */
145@@ -170,13 +171,13 @@ void maus_present(Maus* mw);
146
147 /* resize window to specified width and height. returns 1 on resize success,
148 else 0 */
149-int8_t maus_resize(Maus* mw, uint32_t width, uint32_t height);
150+i8 maus_resize(Maus* mw, u32 width, u32 height);
151
152 /* sleep for `ms` milliseconds */
153-void maus_sleep(uint32_t ms);
154+void maus_sleep(u32 ms);
155
156 /* cap framerate to targetted fps */
157-void maus_target_fps(Maus* mw, uint32_t fps);
158+void maus_target_fps(Maus* mw, u32 fps);
159
160 /* change behavior of mouse based on state passed */
161 void maus_cur_set_mode(Maus* mw, MausCursorState state);
+14,
-13
1@@ -1,33 +1,34 @@
2 #ifndef MAUS_FONT_H
3 #define MAUS_FONT_H
4
5-#include <stdint.h>
6+#define ULE_SHORT_TYPE_NAMES
7+#include "uletypes.h"
8
9 #include "maus.h"
10
11 #define MAUS_BDF_GLYPHS_MAX 256
12
13 typedef struct {
14- uint8_t* bmp;
15- uint16_t w;
16- uint16_t h;
17- int16_t xoff;
18- int16_t yoff;
19- uint16_t adv;
20- int8_t valid;
21+ u8* bmp;
22+ u16 w;
23+ u16 h;
24+ i16 xoff;
25+ i16 yoff;
26+ u16 adv;
27+ i8 valid;
28 } MausGlyph;
29
30 typedef struct {
31 MausGlyph glyphs[MAUS_BDF_GLYPHS_MAX];
32
33- int32_t asc;
34- int32_t dsc;
35- int32_t cellh;
36- int32_t cellw;
37+ i32 asc;
38+ i32 dsc;
39+ i32 cellh;
40+ i32 cellw;
41 } MausFont;
42
43 /* Loops through text passing parameters to glyph drawer */
44-void maus_draw_text(Maus* mw, MausFont* font, int32_t x, int32_t y,
45+void maus_draw_text(Maus* mw, MausFont* font, i32 x, i32 y,
46 const char* text, MausColor col);
47
48 /* load a bdf font into MausFont. returns NULL on fail */
+4,
-3
1@@ -1,7 +1,8 @@
2 #ifndef MAUS_INPUT_H
3 #define MAUS_INPUT_H
4
5-#include <stdint.h>
6+#define ULE_SHORT_TYPE_NAMES
7+#include "uletypes.h"
8
9 typedef enum {
10 MAUS_KEY_NONE = 0,
11@@ -63,8 +64,8 @@ typedef enum {
12 } MausKey;
13
14 typedef struct {
15- int32_t x;
16- int32_t y;
17+ i32 x;
18+ i32 y;
19 } MausCursor;
20
21 typedef enum {
+32,
-31
1@@ -2,7 +2,8 @@
2 #define MAUS_WAYLAND_H
3
4 #include <stddef.h>
5-#include <stdint.h>
6+#define ULE_SHORT_TYPE_NAMES
7+#include "uletypes.h"
8
9 #define MAUS_EVQ_MAX 64
10
11@@ -35,30 +36,30 @@ struct xkb_keymap;
12 struct xkb_state;
13
14 typedef struct {
15- int8_t pending;
16- int32_t type;
17+ i8 pending;
18+ i32 type;
19
20- uint32_t width;
21- uint32_t height;
22+ u32 width;
23+ u32 height;
24
25- int32_t mouse_x;
26- int32_t mouse_y;
27- int32_t mouse_dx;
28- int32_t mouse_dy;
29- uint32_t mouse_button;
30- uint8_t mouse_pressed;
31+ i32 mouse_x;
32+ i32 mouse_y;
33+ i32 mouse_dx;
34+ i32 mouse_dy;
35+ u32 mouse_button;
36+ u8 mouse_pressed;
37
38- uint32_t key_code;
39- uint32_t key_sym;
40+ u32 key_code;
41+ u32 key_sym;
42 char key_text;
43- uint8_t key_pressed;
44+ u8 key_pressed;
45 } MausEventPending;
46
47 typedef struct {
48 struct wl_buffer* buffer;
49 void* data;
50 size_t size;
51- int8_t busy;
52+ i8 busy;
53 } MausWLBuffer;
54
55 typedef struct {
56@@ -76,12 +77,12 @@ typedef struct {
57 struct wl_cursor_theme* cursor_theme;
58 struct wl_cursor* cursor;
59 struct wl_surface* cursor_surface;
60- uint32_t pointer_enter_serial;
61- int32_t mouse_x;
62- int32_t mouse_y;
63- int8_t mouse_pos_set;
64- int8_t cursor_visible;
65- int8_t cursor_confined;
66+ u32 pointer_enter_serial;
67+ i32 mouse_x;
68+ i32 mouse_y;
69+ i8 mouse_pos_set;
70+ i8 cursor_visible;
71+ i8 cursor_confined;
72
73 struct zwp_pointer_constraints_v1* pointer_constraints;
74 struct zwp_confined_pointer_v1* confined_pointer;
75@@ -96,21 +97,21 @@ typedef struct {
76
77 MausEventPending pending;
78 MausEventPending evq[MAUS_EVQ_MAX];
79- uint32_t evq_head;
80- uint32_t evq_tail;
81- uint32_t evq_count;
82-
83- int32_t repeat_rate;
84- int32_t repeat_delay;
85- uint32_t repeat_key_code;
86- uint32_t repeat_key_sym;
87+ u32 evq_head;
88+ u32 evq_tail;
89+ u32 evq_count;
90+
91+ i32 repeat_rate;
92+ i32 repeat_delay;
93+ u32 repeat_key_code;
94+ u32 repeat_key_sym;
95 char repeat_key_text;
96- uint64_t repeat_next_ns;
97+ u64 repeat_next_ns;
98
99 struct xdg_wm_base* wm_base;
100 struct xdg_surface* xdg_surface;
101 struct xdg_toplevel* xdg_toplevel;
102- int8_t configured;
103+ i8 configured;
104
105 struct wl_registry* registry;
106 } MausBackend;
+5,
-4
1@@ -1,7 +1,8 @@
2 #ifndef MAUS_WINDOWS_H
3 #define MAUS_WINDOWS_H
4
5-#include <stdint.h>
6+#define ULE_SHORT_TYPE_NAMES
7+#include "uletypes.h"
8
9 #include <windows.h>
10
11@@ -11,9 +12,9 @@ typedef struct {
12 HDC hdc;
13 HBITMAP hbm;
14 HDC memdc;
15- int8_t resized;
16- uint32_t rw;
17- uint32_t rh;
18+ i8 resized;
19+ u32 rw;
20+ u32 rh;
21 } MausBackend;
22
23 #endif /* MAUS_WINDOWS_H */
+9,
-8
1@@ -1,7 +1,8 @@
2 #ifndef MAUS_X11_H
3 #define MAUS_X11_H
4
5-#include <stdint.h>
6+#define ULE_SHORT_TYPE_NAMES
7+#include "uletypes.h"
8
9 #include <X11/Xlib.h>
10 #include <X11/extensions/XShm.h>
11@@ -18,16 +19,16 @@ typedef struct {
12 Atom atoms[MAUS_ATOM_LAST];
13 GC gc;
14
15- int8_t cur_rel; /* relative cursor */
16- int8_t ignore_warp;
17- int8_t xi2;
18+ i8 cur_rel; /* relative cursor */
19+ i8 ignore_warp;
20+ i8 xi2;
21 int xi2_opcode;
22- int32_t mouse_x;
23- int32_t mouse_y;
24- int8_t mouse_pos_set;
25+ i32 mouse_x;
26+ i32 mouse_y;
27+ i8 mouse_pos_set;
28
29 XShmSegmentInfo shm;
30- int8_t shmat;
31+ i8 shmat;
32 XImage* image; /* TODO: XImage path */
33 } MausBackend;
34
+161,
-0
1@@ -0,0 +1,161 @@
2+/* Copyright 2026 uint (and contributors)
3+
4+Permission to use, copy, modify, and distribute this software for any
5+purpose with or without fee is hereby granted, provided that the above
6+copyright notice and this permission notice appear in all copies.
7+
8+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
15+
16+/* Guidance:
17+ If you want to use the shorthand type names (eg u8 instead of ule_u8), you
18+ must define ULE_SHORT_TYPE_NAMES before including this header.
19+
20+ If you want to define your own pointer types, you must define ULE_UPTR_TYPE
21+ and ULE_IPTR_TYPE before including this header. */
22+
23+#ifndef ULETYPES_H
24+#define ULETYPES_H
25+
26+#include <limits.h>
27+#include <stddef.h>
28+
29+#if CHAR_BIT != 8
30+ #error "libule: 8-bit bytes are required"
31+#endif
32+
33+/* 8-bit */
34+typedef unsigned char ule_u8;
35+typedef signed char ule_i8;
36+
37+/* 16-bit */
38+#if USHRT_MAX == 0xFFFFU
39+ typedef unsigned short ule_u16;
40+ typedef signed short ule_i16;
41+ #define ULE_I16_MAX ((ule_i16)SHRT_MAX)
42+ #define ULE_I16_MIN ((ule_i16)SHRT_MIN)
43+#elif UINT_MAX == 0xFFFFU
44+ typedef unsigned int ule_u16;
45+ typedef signed int ule_i16;
46+ #define ULE_I16_MAX ((ule_i16)INT_MAX)
47+ #define ULE_I16_MIN ((ule_i16)INT_MIN)
48+#else
49+ #error "libule: no 16-bit integer type"
50+#endif
51+
52+/* 32-bit */
53+#if UINT_MAX == 0xFFFFFFFFUL
54+ typedef unsigned int ule_u32;
55+ typedef signed int ule_i32;
56+ #define ULE_I32_MAX ((ule_i32)INT_MAX)
57+ #define ULE_I32_MIN ((ule_i32)INT_MIN)
58+#elif ULONG_MAX == 0xFFFFFFFFUL
59+ typedef unsigned long ule_u32;
60+ typedef signed long ule_i32;
61+ #define ULE_I32_MAX ((ule_i32)LONG_MAX)
62+ #define ULE_I32_MIN ((ule_i32)LONG_MIN)
63+#elif USHRT_MAX == 0xFFFFFFFFUL
64+ typedef unsigned short ule_u32;
65+ typedef signed short ule_i32;
66+ #define ULE_I32_MAX ((ule_i32)SHRT_MAX)
67+ #define ULE_I32_MIN ((ule_i32)SHRT_MIN)
68+#else
69+ #error "libule: no 32-bit integer type"
70+#endif
71+
72+/* 64-bit */
73+#if ULONG_MAX > 0xFFFFFFFFUL
74+ typedef unsigned long ule_u64;
75+ typedef signed long ule_i64;
76+ #define ULE_I64_MAX ((ule_i64)LONG_MAX)
77+ #define ULE_I64_MIN ((ule_i64)LONG_MIN)
78+ #define ULE_HAS_64 1
79+#elif defined(_WIN64)
80+ typedef size_t ule_u64;
81+ typedef ptrdiff_t ule_i64;
82+ #define ULE_HAS_64 1
83+ #define ULE_I64_TWOS_COMPLEMENT 1
84+#endif
85+
86+typedef char ule_check_u8[(sizeof(ule_u8) * CHAR_BIT == 8) ? 1 : -1];
87+typedef char ule_check_i8[(sizeof(ule_i8) * CHAR_BIT == 8) ? 1 : -1];
88+typedef char ule_check_u16[(sizeof(ule_u16) * CHAR_BIT == 16) ? 1 : -1];
89+typedef char ule_check_i16[(sizeof(ule_i16) * CHAR_BIT == 16) ? 1 : -1];
90+typedef char ule_check_u32[(sizeof(ule_u32) * CHAR_BIT == 32) ? 1 : -1];
91+typedef char ule_check_i32[(sizeof(ule_i32) * CHAR_BIT == 32) ? 1 : -1];
92+
93+#ifdef ULE_HAS_64
94+ typedef char ule_check_u64[(sizeof(ule_u64) * CHAR_BIT == 64) ? 1 : -1];
95+ typedef char ule_check_i64[(sizeof(ule_i64) * CHAR_BIT == 64) ? 1 : -1];
96+#endif /* ULE_HAS_64 */
97+
98+/* Pointer Length Sizes */
99+#if defined(ULE_UPTR_TYPE) != defined(ULE_IPTR_TYPE)
100+ #error "libule: define both ULE_UPTR_TYPE and ULE_IPTR_TYPE"
101+#endif
102+
103+#if defined(ULE_UPTR_TYPE)
104+ typedef ULE_UPTR_TYPE ule_uptr;
105+ typedef ULE_IPTR_TYPE ule_iptr;
106+
107+#elif defined(_WIN64) || defined(_WIN32) || \
108+ defined(__LP64__) || defined(_LP64) || \
109+ defined(__ILP32__) || defined(_ILP32)
110+ typedef size_t ule_uptr;
111+ typedef ptrdiff_t ule_iptr;
112+
113+#else
114+ #error "libule: define ULE_UPTR_TYPE and ULE_IPTR_TYPE for this target"
115+#endif
116+
117+typedef char ule_check_uptr[(sizeof(ule_uptr) == sizeof(void*)) ? 1 : -1];
118+typedef char ule_check_iptr[(sizeof(ule_iptr) == sizeof(void*)) ? 1 : -1];
119+
120+/* Limits */
121+#define ULE_U8_MAX ((ule_u8)0xFFU)
122+#define ULE_I8_MAX ((ule_i8)SCHAR_MAX)
123+#define ULE_I8_MIN ((ule_i8)SCHAR_MIN)
124+
125+#define ULE_U16_MAX ((ule_u16)0xFFFFU)
126+#define ULE_U32_MAX ((ule_u32)0xFFFFFFFFUL)
127+
128+#ifdef ULE_HAS_64
129+ #define ULE_U64_MAX ((ule_u64)-1)
130+
131+ #ifdef ULE_I64_TWOS_COMPLEMENT
132+ #define ULE_I64_MAX ((ule_i64)(ULE_U64_MAX >> 1))
133+ #define ULE_I64_MIN ((ule_i64)(-ULE_I64_MAX - 1))
134+ #endif /* ULE_I64_TWOS_COMPLEMENT */
135+#endif /* ULE_HAS_64 */
136+
137+/* Size types */
138+typedef size_t ule_usize;
139+typedef ptrdiff_t ule_isize;
140+
141+/* (Optional) Short names */
142+#ifdef ULE_SHORT_TYPE_NAMES
143+ typedef ule_u8 u8;
144+ typedef ule_i8 i8;
145+ typedef ule_u16 u16;
146+ typedef ule_i16 i16;
147+ typedef ule_u32 u32;
148+ typedef ule_i32 i32;
149+
150+ #ifdef ULE_HAS_64
151+ typedef ule_u64 u64;
152+ typedef ule_i64 i64;
153+ #endif /* ULE_HAS_64 */
154+
155+ typedef ule_uptr uptr;
156+ typedef ule_iptr iptr;
157+ typedef ule_usize usize;
158+ typedef ule_isize isize;
159+#endif /* ULE_SHORT_TYPE_NAMES */
160+
161+#endif /* ULETYPES_H */
162+
+10,
-10
1@@ -30,7 +30,7 @@ void maus_die(const char* fmt, ...)
2 exit(EXIT_FAILURE);
3 }
4
5-uint64_t maus_get_time_ns(void)
6+u64 maus_get_time_ns(void)
7 {
8 #if !defined(_WIN32)
9 struct timespec ts;
10@@ -39,8 +39,8 @@ uint64_t maus_get_time_ns(void)
11 #else
12 static LARGE_INTEGER frequency = {0};
13 LARGE_INTEGER counter;
14- uint64_t sec;
15- uint64_t rem;
16+ u64 sec;
17+ 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(uint32_t ms)
26+void maus_sleep(u32 ms)
27 {
28 #if !defined(_WIN32)
29 struct timespec ts;
30@@ -77,12 +77,12 @@ void maus_sleep(uint32_t ms)
31 #endif
32 }
33
34-void maus_target_fps(Maus* mw, uint32_t fps)
35+void maus_target_fps(Maus* mw, u32 fps)
36 {
37- uint64_t ns_frame;
38- uint64_t cur_time;
39- uint64_t elapsed;
40- uint64_t sleep;
41+ u64 ns_frame;
42+ u64 cur_time;
43+ u64 elapsed;
44+ u64 sleep;
45
46 if (fps == 0)
47 return;
48@@ -94,7 +94,7 @@ void maus_target_fps(Maus* mw, uint32_t fps)
49 /* if early finish, sleep for the remaining time balance */
50 if (elapsed < ns_frame) {
51 sleep = ns_frame - elapsed;
52- maus_sleep((uint32_t)((sleep + 999999) / 1000000));
53+ maus_sleep((u32)((sleep + 999999) / 1000000));
54 }
55
56 mw->frame_time_last = maus_get_time_ns();
+36,
-36
1@@ -5,21 +5,21 @@
2 #include "maus.h"
3 #include "maus_font.h"
4
5-static void glyph_to_buf(int32_t sgx, int32_t egx, int32_t sgy, int32_t egy,
6- int32_t gox, int32_t goy, MausGlyph* g, uint32_t col_up,
7- uint32_t* buf, uint32_t stride);
8+static void glyph_to_buf(i32 sgx, i32 egx, i32 sgy, i32 egy,
9+ i32 gox, i32 goy, MausGlyph* g, u32 col_up,
10+ u32* buf, u32 stride);
11
12 /* "blit" a glpyh to some buffer */
13-static void glyph_to_buf(int32_t sgx, int32_t egx, int32_t sgy, int32_t egy,
14- int32_t gox, int32_t goy, MausGlyph* g, uint32_t col_up,
15- uint32_t* buf, uint32_t stride)
16+static void glyph_to_buf(i32 sgx, i32 egx, i32 sgy, i32 egy,
17+ i32 gox, i32 goy, MausGlyph* g, u32 col_up,
18+ u32* buf, u32 stride)
19 {
20 int gy;
21 int gx;
22- int32_t dstx;
23+ i32 dstx;
24
25- uint32_t* row;
26- int32_t offset;
27+ u32* row;
28+ i32 offset;
29
30 for (gy = sgy; gy < egy; gy++) {
31 int dsty = goy + gy;
32@@ -37,15 +37,15 @@ static void glyph_to_buf(int32_t sgx, int32_t egx, int32_t sgy, int32_t egy,
33 }
34 }
35
36-static int8_t parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size,
37- int32_t* encoding, int32_t* advance, int32_t* bw, int32_t* bh,
38- int32_t* xoff, int32_t* yoff, int8_t* seen)
39+static i8 parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size,
40+ i32* encoding, i32* advance, i32* bw, i32* bh,
41+ i32* xoff, i32* yoff, i8* seen)
42 {
43- int32_t rowbits;
44+ i32 rowbits;
45
46- int32_t x;
47- int32_t y;
48- uint64_t bits;
49+ i32 x;
50+ i32 y;
51+ u64 bits;
52
53 MausGlyph* g;
54
55@@ -121,28 +121,28 @@ static int8_t parse_glyphs(FILE* f, MausFont* font, char* line, size_t line_size
56 return 1;
57 }
58
59-void maus_draw_text(Maus* mw, MausFont* font, int32_t x, int32_t y,
60+void maus_draw_text(Maus* mw, MausFont* font, i32 x, i32 y,
61 const char* text, MausColor col)
62 {
63- uint32_t col_up = MAUS_UNPACK_COL(col);
64+ u32 col_up = MAUS_UNPACK_COL(col);
65
66 size_t i;
67
68 /* current coordinates */
69- int32_t cx = x;
70- int32_t cy = y;
71+ i32 cx = x;
72+ i32 cy = y;
73
74 /* origins to start drawing glyph from */
75- int32_t gox;
76- int32_t goy;
77+ i32 gox;
78+ i32 goy;
79
80 /* starting glyph coordinates */
81- int32_t sgx;
82- int32_t sgy;
83+ i32 sgx;
84+ i32 sgy;
85
86 /* ending glyph coordinates */
87- int32_t egx;
88- int32_t egy;
89+ i32 egx;
90+ i32 egy;
91
92 /* current glyph pointer */
93 MausGlyph* g;
94@@ -159,7 +159,7 @@ void maus_draw_text(Maus* mw, MausFont* font, int32_t x, int32_t y,
95 continue;
96 }
97
98- g = &font->glyphs[(uint8_t)c];
99+ g = &font->glyphs[(u8)c];
100 if (!g->valid) {
101 /* still advance cx if character invalid */
102 cx += (font->cellw > 0 ? font->cellw : 8);
103@@ -194,15 +194,15 @@ MausFont* maus_font_load(const char* path)
104 MausFont* font = calloc(1, sizeof(MausFont));
105 char line[1024];
106
107- int32_t asc = -1;
108- int32_t dsc = -1;
109- int32_t encoding = -1;
110- int32_t advance = 0;
111- int32_t bw = 0; /* bmp width */
112- int32_t bh = 0; /* bmp height */
113- int32_t xoff = 0;
114- int32_t yoff = 0;
115- int8_t seen = 0;
116+ i32 asc = -1;
117+ i32 dsc = -1;
118+ i32 encoding = -1;
119+ i32 advance = 0;
120+ i32 bw = 0; /* bmp width */
121+ i32 bh = 0; /* bmp height */
122+ i32 xoff = 0;
123+ i32 yoff = 0;
124+ i8 seen = 0;
125
126 int i;
127
+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, uint32_t name);
6-static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, uint32_t serial);
7-static void xdg_toplevel_configure(void* data, struct xdg_toplevel* xdg_toplevel, int32_t width, int32_t height, struct wl_array* states);
8+static void registry_global_remove(void *data, struct wl_registry *wl_registry, u32 name);
9+static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, u32 serial);
10+static void xdg_toplevel_configure(void* data, struct xdg_toplevel* xdg_toplevel, i32 width, 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, int32_t width, int32_t height);
13+static void xdg_toplevel_configure_bounds(void* data, struct xdg_toplevel* xdg_toplevel, i32 width, 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, uint32_t serial);
16-static void seat_capabilities(void* data, struct wl_seat* seat, uint32_t capabilities);
17+static void wm_base_ping(void* data, struct xdg_wm_base* wm_base, u32 serial);
18+static void seat_capabilities(void* data, struct wl_seat* seat, 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, uint32_t serial, struct wl_surface* surface, wl_fixed_t sx, wl_fixed_t sy);
21-static void pointer_leave(void* data, struct wl_pointer* pointer, uint32_t serial, struct wl_surface* surface);
22-static void pointer_motion(void* data, struct wl_pointer* pointer, uint32_t time, wl_fixed_t sx, wl_fixed_t sy);
23-static void pointer_button(void* data, struct wl_pointer* pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state);
24-static void pointer_axis(void* data, struct wl_pointer* pointer, uint32_t time, uint32_t axis, wl_fixed_t value);
25+static void pointer_enter(void* data, struct wl_pointer* pointer, 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, u32 serial, struct wl_surface* surface);
27+static void pointer_motion(void* data, struct wl_pointer* pointer, u32 time, wl_fixed_t sx, wl_fixed_t sy);
28+static void pointer_button(void* data, struct wl_pointer* pointer, u32 serial, u32 time, u32 button, u32 state);
29+static void pointer_axis(void* data, struct wl_pointer* pointer, u32 time, 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, uint32_t axis_source);
32-static void pointer_axis_stop(void* data, struct wl_pointer* pointer, uint32_t time, uint32_t axis);
33-static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, uint32_t axis, int32_t discrete);
34-static void pointer_axis_value120(void* data, struct wl_pointer* pointer, uint32_t axis, int32_t value120);
35-static void pointer_axis_relative_direction(void* data, struct wl_pointer* pointer, uint32_t axis, uint32_t direction);
36-static void relative_pointer_motion(void* data, struct zwp_relative_pointer_v1* relative_pointer, uint32_t utime_hi, uint32_t 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, uint32_t format, int32_t fd, uint32_t size);
38-static void keyboard_enter(void* data, struct wl_keyboard* keyboard, uint32_t serial, struct wl_surface* surface, struct wl_array* keys);
39-static void keyboard_leave(void* data, struct wl_keyboard* keyboard, uint32_t serial, struct wl_surface* surface);
40-static void keyboard_key(void* data, struct wl_keyboard* keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state);
41-static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group);
42-static void keyboard_repeat_info(void* data, struct wl_keyboard* keyboard, int32_t rate, int32_t delay);
43-static void registry_global(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
44-
45-static int8_t cursor_init(Maus* mw);
46+static void pointer_axis_source(void* data, struct wl_pointer* pointer, u32 axis_source);
47+static void pointer_axis_stop(void* data, struct wl_pointer* pointer, u32 time, u32 axis);
48+static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, u32 axis, i32 discrete);
49+static void pointer_axis_value120(void* data, struct wl_pointer* pointer, u32 axis, i32 value120);
50+static void pointer_axis_relative_direction(void* data, struct wl_pointer* pointer, u32 axis, u32 direction);
51+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);
52+static void keyboard_keymap(void* data, struct wl_keyboard* keyboard, u32 format, i32 fd, u32 size);
53+static void keyboard_enter(void* data, struct wl_keyboard* keyboard, u32 serial, struct wl_surface* surface, struct wl_array* keys);
54+static void keyboard_leave(void* data, struct wl_keyboard* keyboard, u32 serial, struct wl_surface* surface);
55+static void keyboard_key(void* data, struct wl_keyboard* keyboard, u32 serial, u32 time, u32 key, u32 state);
56+static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, u32 serial, u32 mods_depressed, u32 mods_latched, u32 mods_locked, u32 group);
57+static void keyboard_repeat_info(void* data, struct wl_keyboard* keyboard, i32 rate, i32 delay);
58+static void registry_global(void* data, struct wl_registry* registry, u32 name, const char* interface, u32 version);
59+
60+static 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 int8_t event_pop(Maus* mw, MausEventPending* ev);
69-static void event_push_key(Maus* mw, uint32_t code, uint32_t sym, char text, uint8_t pressed);
70-static int8_t repeat_push_due(Maus* mw);
71-static int32_t repeat_timeout_ms(Maus* mw);
72-static int8_t display_read(Maus* mw, int timeout_ms);
73+static i8 event_pop(Maus* mw, MausEventPending* ev);
74+static void event_push_key(Maus* mw, u32 code, u32 sym, char text, u8 pressed);
75+static i8 repeat_push_due(Maus* mw);
76+static i32 repeat_timeout_ms(Maus* mw);
77+static 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(uint32_t button);
80+static MausMouseButton wl_button_to_maus(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 int8_t event_pop(Maus* mw, MausEventPending* ev)
89+static i8 event_pop(Maus* mw, MausEventPending* ev)
90 {
91 MausBackend* be = &mw->backend;
92
93@@ -126,7 +126,7 @@ static int8_t event_pop(Maus* mw, MausEventPending* ev)
94 return 1;
95 }
96
97-static void event_push_key(Maus* mw, uint32_t code, uint32_t sym, char text, uint8_t pressed)
98+static void event_push_key(Maus* mw, u32 code, u32 sym, char text, u8 pressed)
99 {
100 MausBackend* be = &mw->backend;
101
102@@ -139,14 +139,14 @@ static void event_push_key(Maus* mw, uint32_t code, uint32_t sym, char text, uin
103 event_push_pending(mw);
104 }
105
106-static void registry_global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
107+static void registry_global_remove(void *data, struct wl_registry *wl_registry, 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, uint32_t serial)
115+static void xdg_surface_configure(void* data, struct xdg_surface* xdg_surface, 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- int32_t width, int32_t height, struct wl_array* states)
124+ i32 width, 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- int32_t width, int32_t height)
133+ i32 width, 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, uint32_t serial)
142+static void wm_base_ping(void* data, struct xdg_wm_base* wm_base, 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- uint32_t name, const char* interface,
150- uint32_t version)
151+ u32 name, const char* interface,
152+ 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, uint32_t capabilities)
161+static void seat_capabilities(void* data, struct wl_seat* seat, 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, uint32_t serial,
170+static void pointer_enter(void* data, struct wl_pointer* pointer, 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, uint32_t seria
175 cursor_hide(mw);
176 }
177
178-static void pointer_leave(void* data, struct wl_pointer* pointer, uint32_t serial,
179+static void pointer_leave(void* data, struct wl_pointer* pointer, 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, uint32_t seria
184 (void)surface;
185 }
186
187-static void pointer_motion(void* data, struct wl_pointer* pointer, uint32_t time,
188+static void pointer_motion(void* data, struct wl_pointer* pointer, u32 time,
189 wl_fixed_t sx, wl_fixed_t sy)
190 {
191 Maus* mw = data;
192 MausBackend* be = &mw->backend;
193- int32_t x;
194- int32_t y;
195+ i32 x;
196+ i32 y;
197
198 (void)pointer;
199 (void)time;
200@@ -324,8 +324,8 @@ static void pointer_motion(void* data, struct wl_pointer* pointer, uint32_t time
201 event_push_pending(mw);
202 }
203
204-static void pointer_button(void* data, struct wl_pointer* pointer, uint32_t serial,
205- uint32_t time, uint32_t button, uint32_t state)
206+static void pointer_button(void* data, struct wl_pointer* pointer, u32 serial,
207+ u32 time, u32 button, 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, uint32_t seri
212 event_push_pending(mw);
213 }
214
215-static void pointer_axis(void* data, struct wl_pointer* pointer, uint32_t time,
216- uint32_t axis, wl_fixed_t value)
217+static void pointer_axis(void* data, struct wl_pointer* pointer, u32 time,
218+ 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, uint32_t axis_source)
227+static void pointer_axis_source(void* data, struct wl_pointer* pointer, 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, uint32_t time, uint32_t axis) {
235+static void pointer_axis_stop(void* data, struct wl_pointer* pointer, u32 time, 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, uint32_t axis,
243- int32_t discrete)
244+static void pointer_axis_discrete(void* data, struct wl_pointer* pointer, u32 axis,
245+ 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, uint32
250 (void)discrete;
251 }
252
253-static void pointer_axis_value120(void* data, struct wl_pointer* pointer, uint32_t axis,
254- int32_t value120)
255+static void pointer_axis_value120(void* data, struct wl_pointer* pointer, u32 axis,
256+ 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, uint32
261 }
262
263 static void pointer_axis_relative_direction(void* data, struct wl_pointer* pointer,
264- uint32_t axis, uint32_t direction)
265+ u32 axis, 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- uint32_t utime_hi, uint32_t utime_lo,
274+ u32 utime_hi, 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, uint32_t format,
283- int32_t fd, uint32_t size)
284+static void keyboard_keymap(void* data, struct wl_keyboard* keyboard, u32 format,
285+ i32 fd, 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, uint32_t f
290 be->xkb_state = xkb_state_new(be->xkb_keymap);
291 }
292
293-static void keyboard_enter(void* data, struct wl_keyboard* keyboard, uint32_t serial,
294+static void keyboard_enter(void* data, struct wl_keyboard* keyboard, 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, uint32_t se
299 (void)keys;
300 }
301
302-static void keyboard_leave(void* data, struct wl_keyboard* keyboard, uint32_t serial,
303+static void keyboard_leave(void* data, struct wl_keyboard* keyboard, 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, uint32_t se
308 mw->backend.repeat_key_code = 0;
309 }
310
311-static void keyboard_key(void* data, struct wl_keyboard* keyboard, uint32_t serial,
312- uint32_t time, uint32_t key, uint32_t state)
313+static void keyboard_key(void* data, struct wl_keyboard* keyboard, u32 serial,
314+ u32 time, u32 key, u32 state)
315 {
316 Maus* mw = data;
317 MausBackend* be = &mw->backend;
318- uint32_t code;
319+ u32 code;
320 xkb_keysym_t sym;
321 MausKey maus_key;
322 char text[8];
323 int len;
324- uint8_t pressed;
325+ u8 pressed;
326
327 (void)keyboard;
328 (void)serial;
329@@ -553,9 +553,9 @@ static void keyboard_key(void* data, struct wl_keyboard* keyboard, uint32_t seri
330 be->repeat_key_code = 0;
331 }
332
333-static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, uint32_t serial,
334- uint32_t mods_depressed, uint32_t mods_latched,
335- uint32_t mods_locked, uint32_t group)
336+static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, u32 serial,
337+ u32 mods_depressed, u32 mods_latched,
338+ u32 mods_locked, u32 group)
339 {
340 Maus* mw = data;
341
342@@ -573,7 +573,7 @@ static void keyboard_modifiers(void* data, struct wl_keyboard* keyboard, uint32_
343 }
344
345 static void keyboard_repeat_info(void* data, struct wl_keyboard* keyboard,
346- int32_t rate, int32_t delay)
347+ i32 rate, 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 int8_t repeat_push_due(Maus* mw)
356+static i8 repeat_push_due(Maus* mw)
357 {
358 MausBackend* be = &mw->backend;
359- uint64_t now;
360- uint64_t interval;
361+ u64 now;
362+ u64 interval;
363
364 if (be->repeat_key_code == 0 || be->repeat_rate <= 0)
365 return 0;
366@@ -607,11 +607,11 @@ static int8_t repeat_push_due(Maus* mw)
367 return 1;
368 }
369
370-static int32_t repeat_timeout_ms(Maus* mw)
371+static i32 repeat_timeout_ms(Maus* mw)
372 {
373 MausBackend* be = &mw->backend;
374- uint64_t now;
375- uint64_t diff;
376+ u64 now;
377+ u64 diff;
378
379 if (be->repeat_key_code == 0 || be->repeat_rate <= 0)
380 return -1;
381@@ -622,10 +622,10 @@ static int32_t repeat_timeout_ms(Maus* mw)
382
383 diff = be->repeat_next_ns - now;
384 /* round xto nearest ms */
385- return (int32_t)((diff + 999999) / 1000000);
386+ return (i32)((diff + 999999) / 1000000);
387 }
388
389-static int8_t display_read(Maus* mw, int timeout_ms)
390+static i8 display_read(Maus* mw, int timeout_ms)
391 {
392 MausBackend* be = &mw->backend;
393 struct pollfd pfd;
394@@ -657,7 +657,7 @@ static int8_t display_read(Maus* mw, int timeout_ms)
395 }
396
397
398-static int8_t cursor_init(Maus* mw)
399+static 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 int8_t fb_create(Maus* mw);
408-static int8_t fb_create_buffer(Maus* mw, MausWLBuffer* wb);
409-static int8_t fb_create_shm(size_t size);
410+static i8 fb_create(Maus* mw);
411+static i8 fb_create_buffer(Maus* mw, MausWLBuffer* wb);
412+static i8 fb_create_shm(size_t size);
413 static void fb_destroy(Maus* mw);
414-static int8_t handle_event(Maus* mw, MausEvent* ev);
415+static i8 handle_event(Maus* mw, MausEvent* ev);
416
417-static int8_t fb_create(Maus* mw)
418+static i8 fb_create(Maus* mw)
419 {
420 MausBackend* be = &mw->backend;
421
422@@ -818,7 +818,7 @@ static int8_t fb_create(Maus* mw)
423 return 1;
424 }
425
426-static int8_t fb_create_buffer(Maus* mw, MausWLBuffer* wb)
427+static 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 int8_t fb_create_buffer(Maus* mw, MausWLBuffer* wb)
432 return 1;
433 }
434
435-static int8_t fb_create_shm(size_t size)
436+static 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- uint32_t i;
445+ 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 int8_t handle_event(Maus* mw, MausEvent* ev)
454+static i8 handle_event(Maus* mw, MausEvent* ev)
455 {
456 MausEventPending pending;
457
458@@ -952,7 +952,7 @@ static int8_t handle_event(Maus* mw, MausEvent* ev)
459 }
460 }
461
462-static MausMouseButton wl_button_to_maus(uint32_t button)
463+static MausMouseButton wl_button_to_maus(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- uint32_t up = MAUS_UNPACK_COL(col);
472- uint32_t pxs = mw->height * mw->width;
473+ u32 up = MAUS_UNPACK_COL(col);
474+ u32 pxs = mw->height * mw->width;
475
476- uint32_t i;
477+ 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-int8_t maus_close_window(Maus* mw)
486+i8 maus_close_window(Maus* mw)
487 {
488 MausBackend* be = &mw->backend;
489
490@@ -1129,7 +1129,7 @@ int8_t maus_close_window(Maus* mw)
491 return 1;
492 }
493
494-int8_t maus_create_window(Maus* mw)
495+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(uint32_t));
504+ mw->bfb = calloc(mw->stride * mw->height, sizeof(u32));
505 if (!mw->bfb)
506 goto close;
507
508@@ -1215,10 +1215,10 @@ close:
509 return NULL;
510 }
511
512-int8_t maus_event_poll(Maus* mw, MausEvent* ev)
513+i8 maus_event_poll(Maus* mw, MausEvent* ev)
514 {
515 MausBackend* be = &mw->backend;
516- int8_t read;
517+ i8 read;
518
519 ev->type = MAUS_EV_NONE;
520
521@@ -1248,8 +1248,8 @@ int8_t maus_event_poll(Maus* mw, MausEvent* ev)
522 void maus_event_wait(Maus* mw, MausEvent* ev)
523 {
524 MausBackend* be = &mw->backend;
525- int32_t timeout;
526- int8_t read;
527+ i32 timeout;
528+ 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- uint32_t i;
537+ 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(uint32_t);
546+ bytes = mw->stride * mw->height * sizeof(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-int8_t maus_resize(Maus* mw, uint32_t width, uint32_t height)
555+i8 maus_resize(Maus* mw, u32 width, u32 height)
556 {
557- uint32_t* bfb;
558+ u32* bfb;
559
560 if (width == 0 || height == 0)
561 return 0;
562
563- bfb = calloc(width * height, sizeof(uint32_t));
564+ bfb = calloc(width * height, sizeof(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 int8_t fb_create(Maus* mw);
6+static i8 fb_create(Maus* mw);
7 static void fb_destroy(Maus* mw);
8-static int8_t handle_event(const MSG* msg, MausEvent* ev, Maus* mw);
9+static 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 int8_t fb_create(Maus* mw)
18+static 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 int8_t handle_event(const MSG* msg, MausEvent* ev, Maus* mw)
27+static i8 handle_event(const MSG* msg, MausEvent* ev, Maus* mw)
28 {
29 UINT scan;
30 UINT vk;
31@@ -161,7 +161,7 @@ static int8_t 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 = (uint32_t)msg->wParam;
36+ ev->key.code = (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 int8_t 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 = (uint32_t)msg->wParam;
45+ ev->key.code = (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- uint32_t col_up = MAUS_UNPACK_COL(col);
54- uint32_t pxs = mw->height * mw->width;
55- uint32_t i;
56+ u32 col_up = MAUS_UNPACK_COL(col);
57+ u32 pxs = mw->height * mw->width;
58+ 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-int8_t maus_close_window(Maus* mw)
67+i8 maus_close_window(Maus* mw)
68 {
69 MausBackend* be = &mw->backend;
70
71@@ -375,7 +375,7 @@ int8_t maus_close_window(Maus* mw)
72 }
73
74
75-int8_t maus_create_window(Maus* mw)
76+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(uint32_t));
85+ mw->bfb = calloc(mw->stride * mw->height, sizeof(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-int8_t maus_event_poll(Maus* mw, MausEvent* ev)
94+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- uint32_t bytes;
103+ 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(uint32_t);
111+ bytes = mw->stride * mw->height * sizeof(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-int8_t maus_resize(Maus* mw, uint32_t width, uint32_t height)
119+i8 maus_resize(Maus* mw, u32 width, u32 height)
120 {
121 if (width == 0 || height == 0 ||
122 (mw->width == width && mw->height == height))
123@@ -535,7 +535,7 @@ int8_t maus_resize(Maus* mw, uint32_t width, uint32_t height)
124 if (!fb_create(mw))
125 return 0;
126
127- mw->bfb = calloc(mw->stride * mw->height, sizeof(uint32_t));
128+ mw->bfb = calloc(mw->stride * mw->height, sizeof(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 int8_t fb_create(Maus* mw);
6-static int8_t fb_create_shm(Maus* mw);
7-/* TODO static int8_t fb_create_ximage(Maus* mw); */
8+static i8 fb_create(Maus* mw);
9+static i8 fb_create_shm(Maus* mw);
10+/* TODO static i8 fb_create_ximage(Maus* mw); */
11 static void fb_destroy(Maus* mw);
12-static int8_t handle_event(XEvent* xev, MausEvent* ev, Maus* mw);
13+static 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 int8_t xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent* ev);
18+static 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 int8_t fb_create(Maus* mw)
27+static i8 fb_create(Maus* mw)
28 {
29 MausBackend* be = &mw->backend;
30
31@@ -76,7 +76,7 @@ static int8_t fb_create(Maus* mw)
32 }
33
34 /* allocate and store a new shm for the framebuffer */
35-static int8_t fb_create_shm(Maus* mw)
36+static i8 fb_create_shm(Maus* mw)
37 {
38 MausBackend* be = &mw->backend;
39 int scr = DefaultScreen(be->display);
40@@ -156,8 +156,8 @@ static int8_t fb_create_shm(Maus* mw)
41 shmctl(be->shm.shmid, IPC_RMID, NULL);
42
43 be->shmat = 1;
44- mw->fb = (uint32_t*) be->image->data;
45- mw->stride = be->image->bytes_per_line / sizeof(uint32_t);
46+ mw->fb = (u32*) be->image->data;
47+ mw->stride = be->image->bytes_per_line / sizeof(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 int8_t handle_event(XEvent* xev, MausEvent* ev, Maus* mw)
56+static i8 handle_event(XEvent* xev, MausEvent* ev, Maus* mw)
57 {
58 MausBackend* be = &mw->backend;
59- uint32_t code = 0;
60+ u32 code = 0;
61 unsigned int mb;
62 MausMouseButton mbtype;
63
64@@ -213,7 +213,7 @@ static int8_t handle_event(XEvent* xev, MausEvent* ev, Maus* mw)
65
66 int cx;
67 int cy;
68- int8_t handled;
69+ 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 int8_t xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent* ev)
78+static 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 int8_t xi2_handle_event(Maus* mw, XGenericEventCookie* cookie, MausEvent*
83 }
84
85 ev->type = MAUS_EV_MOUSE_MOTION;
86- ev->mouse.motion.x = (int32_t)dx;
87- ev->mouse.motion.y = (int32_t)dy;
88+ ev->mouse.motion.x = (i32)dx;
89+ ev->mouse.motion.y = (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- int8_t ok = 0;
98+ 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-int8_t maus_close_window(Maus* mw)
107+i8 maus_close_window(Maus* mw)
108 {
109 MausBackend* be = &mw->backend;
110
111@@ -610,7 +610,7 @@ int8_t maus_close_window(Maus* mw)
112 return 1;
113 }
114
115-int8_t maus_create_window(Maus* mw)
116+i8 maus_create_window(Maus* mw)
117 {
118 MausBackend* be = &mw->backend;
119 Display* dpy = be->display;
120@@ -655,9 +655,9 @@ int8_t maus_create_window(Maus* mw)
121
122 void maus_clear(Maus* mw, MausColor col)
123 {
124- uint32_t col_up = MAUS_UNPACK_COL(col);
125- uint32_t pxs = mw->height * mw->width;
126- uint32_t i;
127+ u32 col_up = MAUS_UNPACK_COL(col);
128+ u32 pxs = mw->height * mw->width;
129+ 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(uint32_t));
138+ mw->bfb = calloc(mw->stride * mw->height, sizeof(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-int8_t maus_event_poll(Maus* mw, MausEvent* ev)
147+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- uint32_t bytes;
156+ u32 bytes;
157
158 if (!be->image || be->win == None)
159 return;
160
161- bytes = mw->stride * mw->height * sizeof(uint32_t);
162+ bytes = mw->stride * mw->height * sizeof(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-int8_t maus_resize(Maus* mw, uint32_t width, uint32_t height)
171+i8 maus_resize(Maus* mw, u32 width, u32 height)
172 {
173 MausBackend* be = &mw->backend;
174
175@@ -787,7 +787,7 @@ int8_t maus_resize(Maus* mw, uint32_t width, uint32_t height)
176 if (!fb_create(mw))
177 return 0;
178
179- mw->bfb = calloc(mw->stride * mw->height, sizeof(uint32_t));
180+ mw->bfb = calloc(mw->stride * mw->height, sizeof(u32));
181 if (!mw->bfb)
182 return 0;
183