commit 09086f8
uint
·
2026-08-03 13:39:38 +0000 UTC
parent 26fccca
Reformat structs
6 files changed,
+59,
-54
+26,
-26
1@@ -36,7 +36,7 @@
2 #include "maus_x11.h"
3
4 #elif defined(BACKEND_WAY)
5- /* ... */
6+ #include "maus_wayland.h"
7
8 #elif defined(BACKEND_WIN)
9 #include "maus_win.h"
10@@ -67,10 +67,10 @@ typedef enum {
11 } MausEventType;
12
13 typedef struct {
14- uint8_t a;
15- uint8_t r;
16- uint8_t g;
17- uint8_t b;
18+ uint8_t a;
19+ uint8_t r;
20+ uint8_t g;
21+ uint8_t b;
22 } MausColor;
23
24 typedef struct {
25@@ -78,10 +78,10 @@ typedef struct {
26
27 union {
28 struct {
29- uint32_t code; /* raw, backend keycode */
30- MausKey key; /* logical, mapped key */
31- char text; /* translated text from key */
32- bool pressed;
33+ uint32_t code; /* raw, backend keycode */
34+ MausKey key; /* logical, mapped key */
35+ char text; /* translated text from key */
36+ bool pressed;
37 } key;
38
39 struct {
40@@ -91,8 +91,8 @@ typedef struct {
41 } button;
42
43 struct {
44- int32_t x;
45- int32_t y;
46+ int32_t x;
47+ int32_t y;
48 } motion;
49 } mouse;
50
51@@ -104,25 +104,25 @@ typedef struct {
52 } MausEvent;
53
54 typedef struct {
55- MausBackend backend;
56- uint64_t frame_time_last;
57- char* clipboard;
58+ MausBackend backend;
59+ uint64_t frame_time_last;
60+ char* clipboard;
61
62- uint32_t* fb; /* front frame buffer */
63- uint32_t* bfb; /* back frame buffer */
64- uint32_t stride;
65+ uint32_t* fb; /* front frame buffer */
66+ uint32_t* bfb; /* back frame buffer */
67+ uint32_t stride;
68
69- const char* title;
70- uint32_t width;
71- uint32_t height;
72- int32_t x;
73- int32_t y;
74+ const char* title;
75+ uint32_t width;
76+ uint32_t height;
77+ int32_t x;
78+ int32_t y;
79
80- bool key_codes[MAUS_KEYCODE_LAST]; /* physical keys */
81- bool key_syms[MAUS_KEY_LAST]; /* logical keys */
82+ bool key_codes[MAUS_KEYCODE_LAST]; /* physical keys */
83+ bool key_syms[MAUS_KEY_LAST]; /* logical keys */
84
85- MausCursor cursor;
86- bool mouse_buttons[MAUS_MOUSE_BUTTON_LAST];
87+ MausCursor cursor;
88+ bool mouse_buttons[MAUS_MOUSE_BUTTON_LAST];
89 } Maus;
90
91 /* clear screen with color: `col` */
+12,
-11
1@@ -9,21 +9,22 @@
2 #define MAUS_BDF_GLYPHS_MAX 256
3
4 typedef struct {
5- uint8_t* bmp;
6- uint16_t w;
7- uint16_t h;
8- int16_t xoff;
9- int16_t yoff;
10- uint16_t adv;
11- bool valid;
12+ uint8_t* bmp;
13+ uint16_t w;
14+ uint16_t h;
15+ int16_t xoff;
16+ int16_t yoff;
17+ uint16_t adv;
18+ bool valid;
19 } MausGlyph;
20
21 typedef struct {
22 MausGlyph glyphs[MAUS_BDF_GLYPHS_MAX];
23- int32_t asc;
24- int32_t dsc;
25- int32_t cellh;
26- int32_t cellw;
27+
28+ int32_t asc;
29+ int32_t dsc;
30+ int32_t cellh;
31+ int32_t cellw;
32 } MausFont;
33
34 /* Loops through text passing parameters to glyph drawer */
+2,
-2
1@@ -63,8 +63,8 @@ typedef enum {
2 } MausKey;
3
4 typedef struct {
5- int32_t x;
6- int32_t y;
7+ int32_t x;
8+ int32_t y;
9 } MausCursor;
10
11 typedef enum {
+4,
-0
1@@ -0,0 +1,4 @@
2+#ifndef MAUS_WAYLAND_H
3+#define MAUS_WAYLAND_H
4+
5+#endif /* MAUS_WAYLAND_H */
+8,
-8
1@@ -7,14 +7,14 @@
2 #include <windows.h>
3
4 typedef struct {
5- HWND hwnd;
6- HINSTANCE hInst;
7- HDC hdc;
8- HBITMAP hbm;
9- HDC memdc;
10- bool resized;
11- uint32_t rw;
12- uint32_t rh;
13+ HWND hwnd;
14+ HINSTANCE hInst;
15+ HDC hdc;
16+ HBITMAP hbm;
17+ HDC memdc;
18+ bool resized;
19+ uint32_t rw;
20+ uint32_t rh;
21 } MausBackend;
22
23 #endif /* MAUS_WIN_H */
+7,
-7
1@@ -12,15 +12,15 @@ typedef enum {
2 } MausX11Atoms;
3
4 typedef struct {
5- Display* display;
6- Window root;
7- Window win;
8- Atom atoms[MAUS_ATOM_LAST];
9- GC gc;
10+ Display* display;
11+ Window root;
12+ Window win;
13+ Atom atoms[MAUS_ATOM_LAST];
14+ GC gc;
15
16- XImage* image;
17 XShmSegmentInfo shm;
18- bool shmat;
19+ bool shmat;
20+ XImage* image; /* TODO: XImage path */
21 } MausBackend;
22
23 #endif /* MAUS_X11_H */