comparison src/include/types.h @ 0:f0372d3356b4 default tip

initial import
author Yasuri <linuxoverwindows@charliesmp.net>
date Sun, 30 Aug 2026 12:47:10 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0372d3356b4
1 #ifndef TYPES_H
2 #define TYPES_H
3
4 #include <stdbool.h>
5 #include <stdint.h>
6
7 #include <swc.h>
8 #include <wayland-server.h>
9
10 enum {
11 BTN_LEFT = 0x110,
12 BTN_RIGHT = 0x111,
13 BTN_MIDDLE = 0x112,
14 };
15
16 enum {
17 MOD1 = SWC_MOD_ALT,
18 MOD4 = SWC_MOD_LOGO,
19 SHFT = SWC_MOD_SHIFT,
20 CTRL = SWC_MOD_CTRL,
21 };
22
23 union arg {
24 int i;
25 uint32_t ui;
26 float f;
27 const void* v;
28 };
29
30 struct bind {
31 uint32_t type;
32 uint32_t mods;
33 uint32_t ksym;
34 union arg arg;
35 void (*fn)(void* data, uint32_t time, uint32_t value, uint32_t state);
36 };
37
38 struct client {
39 struct wl_list link;
40 struct swc_window* win;
41 struct screen* scr;
42 bool mapped;
43 bool floating;
44 bool fullscreen;
45 int32_t x;
46 int32_t y;
47 uint32_t w;
48 uint32_t h;
49 uint32_t ws;
50 };
51
52 struct config {
53 uint32_t motion_throttle_hz;
54 uint32_t border_col_active;
55 uint32_t border_col_normal;
56 uint32_t border_width;
57 uint32_t border_col_active_outer;
58 uint32_t border_col_normal_outer;
59 uint32_t border_width_outer;
60 uint32_t gaps;
61 uint32_t spawn_w;
62 uint32_t spawn_h;
63 int32_t repeat_rate;
64 int32_t repeat_delay;
65 };
66
67 struct grab {
68 bool active;
69 bool resize;
70 struct client* c;
71 };
72
73 struct screen {
74 struct wl_list link;
75 struct swc_screen* scr;
76 int32_t x;
77 int32_t y;
78 uint32_t w;
79 uint32_t h;
80 };
81
82 struct wm {
83 struct wl_display* dpy;
84 struct wl_event_loop* ev_loop;
85
86 struct wl_list screens;
87 struct wl_list clients;
88
89 struct screen* sel_screen;
90 struct client* sel_client;
91 struct grab grab;
92 uint8_t ws;
93 };
94
95 #endif /* TYPES_H */