Massive code refactor

This commit is contained in:
2026-07-02 01:24:16 -04:00
parent c10722aa69
commit b5ccb2621b
22 changed files with 3277 additions and 2760 deletions
+5 -6
View File
@@ -34,7 +34,7 @@ extern struct wl_list clients;
/* Internal watcher state */
typedef struct {
typedef struct WatchState {
int inotify_fd;
int watch_fd;
char path[1024];
@@ -802,7 +802,7 @@ watch_dispatch(int fd, uint32_t mask, void *data)
return 0;
}
struct wl_event_source *
WatchState *
config_watch_start(struct wl_event_loop *loop, const char *path,
config_reload_cb cb, void *userdata)
{
@@ -845,14 +845,13 @@ config_watch_start(struct wl_event_loop *loop, const char *path,
ws->event_src = src;
fprintf(stderr, "peachwm config: watching '%s'\n", path);
return (struct wl_event_source *)ws;
return ws;
}
void
config_watch_stop(struct wl_event_source *src)
config_watch_stop(WatchState *ws)
{
if (!src) return;
WatchState *ws = (WatchState *)src;
if (!ws) return;
wl_event_source_remove(ws->event_src);
close(ws->inotify_fd);
free(ws);
+4 -2
View File
@@ -149,13 +149,15 @@ void config_autostart_run(const Config *cfg);
typedef void (*config_reload_cb)(const Config *cfg, void *userdata);
struct wl_event_source *config_watch_start(
typedef struct WatchState WatchState;
WatchState *config_watch_start(
struct wl_event_loop *loop,
const char *path,
config_reload_cb cb,
void *userdata
);
void config_watch_stop(struct wl_event_source *src);
void config_watch_stop(WatchState *ws);
#endif