commit c446720

0uppy  ·  2026-03-13 15:39:04 +0000 UTC
parent 5cca9b2
slgro 1.0 - include directory
3 files changed,  +134, -0
+28, -0
 1@@ -0,0 +1,28 @@
 2+#ifndef SLGRO_H
 3+#define SLGRO_H
 4+
 5+#include <stdint.h>
 6+
 7+#include "types.h"
 8+
 9+extern void focus_next(void* data, uint32_t time, uint32_t value, uint32_t state);
10+extern void focus_prev(void* data, uint32_t time, uint32_t value, uint32_t state);
11+extern void kill_sel(void* data, uint32_t time, uint32_t value, uint32_t state);
12+extern void fullscreen(void* data, uint32_t time, uint32_t value, uint32_t state);
13+extern void kb_move_x(void* data, uint32_t time, uint32_t value, uint32_t state);
14+extern void kb_move_y(void* data, uint32_t time, uint32_t value, uint32_t state);
15+extern void kb_resize_width(void* data, uint32_t time, uint32_t value, uint32_t state);
16+extern void kb_resize_height(void* data, uint32_t time, uint32_t value, uint32_t state);
17+extern void snap_left_half(void* data, uint32_t time, uint32_t value, uint32_t state);
18+extern void snap_right_half(void* data, uint32_t time, uint32_t value, uint32_t state);
19+extern void center_window(void* data, uint32_t time, uint32_t value, uint32_t state);
20+extern void new_screen(struct swc_screen* scr);
21+extern void new_window(struct swc_window* win);
22+extern void new_device(struct libinput_device* dev);
23+extern void quit(void* data, uint32_t time, uint32_t value, uint32_t state);
24+extern void spawn(void* data, uint32_t time, uint32_t value, uint32_t state);
25+extern void workspace_goto(void* data, uint32_t time, uint32_t value, uint32_t state);
26+extern void workspace_moveto(void* data, uint32_t time, uint32_t value, uint32_t state);
27+extern struct wm wm;
28+
29+#endif /* TOHU_H */
+88, -0
 1@@ -0,0 +1,88 @@
 2+#ifndef TYPES_H
 3+#define TYPES_H
 4+
 5+#include <stdbool.h>
 6+#include <stdint.h>
 7+
 8+#include <swc.h>
 9+#include <wayland-server.h>
10+
11+enum {
12+	BTN_LEFT   = 0x110,
13+	BTN_RIGHT  = 0x111,
14+	BTN_MIDDLE = 0x112,
15+};
16+
17+enum {
18+	MOD1 = SWC_MOD_ALT,
19+	MOD4 = SWC_MOD_LOGO,
20+	SHFT = SWC_MOD_SHIFT,
21+	CTRL = SWC_MOD_CTRL,
22+};
23+
24+union arg {
25+	int            i;
26+	uint32_t       ui;
27+	float          f;
28+	const void*    v;
29+};
30+
31+struct bind {
32+	uint32_t       type;
33+	uint32_t       mods;
34+	uint32_t       ksym;
35+	union arg      arg;
36+	void           (*fn)(void* data, uint32_t time, uint32_t value, uint32_t state);
37+};
38+
39+struct client {
40+	struct wl_list link;
41+	struct swc_window* win;
42+	struct screen* scr;
43+	bool           mapped;
44+	bool           floating;
45+	bool           fullscreen;
46+	int32_t        x;
47+	int32_t        y;
48+	uint32_t       w;
49+	uint32_t       h;
50+	uint32_t       ws;
51+};
52+
53+struct config {
54+	uint32_t       motion_throttle_hz;
55+	uint32_t       border_col_active;
56+	uint32_t       border_col_normal;
57+	uint32_t       border_width;
58+	uint32_t       gaps;
59+};
60+
61+struct grab {
62+	bool           active;
63+	bool           resize;
64+	struct client* c;
65+};
66+
67+struct 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+
76+struct 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 */
+18, -0
 1@@ -0,0 +1,18 @@
 2+#ifndef UTIL_H
 3+#define UTIL_H
 4+
 5+#include <stdarg.h>
 6+#include <stdint.h>
 7+#include <stdio.h>
 8+
 9+#include <swc.h>
10+#include <wayland-server.h>
11+
12+void die(int ret, const char* fmt, ...);
13+void _log(FILE* fd, const char* fmt, ...);
14+void sig_handler(int s);
15+
16+#define LENGTH(x) (sizeof(x) / sizeof((x)[0]))
17+
18+#endif /* UTIL_H */
19+