main tohu / source / include / types.h
 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
10enum {
11	BTN_LEFT   = 0x110,
12	BTN_RIGHT  = 0x111,
13	BTN_MIDDLE = 0x112,
14};
15
16enum {
17	MOD1 = SWC_MOD_ALT,
18	MOD4 = SWC_MOD_LOGO,
19	SHFT = SWC_MOD_SHIFT,
20	CTRL = SWC_MOD_CTRL,
21};
22
23union arg {
24	int            i;
25	uint32_t       ui;
26	float          f;
27	const void*    v;
28};
29
30struct 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
38struct 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
52struct 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	struct swc_decor decor;
58	uint32_t       gaps;
59};
60
61struct grab {
62	bool           active;
63	bool           resize;
64	struct client* c;
65};
66
67struct screen {
68	struct wl_list link;
69	struct swc_screen* scr;
70	int32_t        x;
71	int32_t        y;
72	uint32_t       w;
73	uint32_t       h;
74};
75
76struct wm {
77	struct wl_display* dpy;
78	struct wl_event_loop* ev_loop;
79
80	struct wl_list screens;
81	struct wl_list clients;
82
83	struct screen* sel_screen;
84	struct client* sel_client;
85	struct grab    grab;
86	uint8_t        ws;
87};
88
89#endif /* TYPES_H */