aboutsummaryrefslogtreecommitdiff
path: root/registry.c
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2025-10-11 02:30:18 -0400
committerJack Jamison <jackqjamison@gmail.com>2025-10-11 02:30:18 -0400
commitf43ec9b27ebe37b799709985f5587e29ec8ef88b (patch)
treecfae61b2e1ffc3658bdf67450666f5f0c89b2b92 /registry.c
parentba3a68a4f73f6653b1e1b095abc08234dedc504d (diff)
refactor to .h files
Diffstat (limited to 'registry.c')
-rw-r--r--registry.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/registry.c b/registry.c
index 2f98d12..bee7d1b 100644
--- a/registry.c
+++ b/registry.c
@@ -2,9 +2,15 @@
#include <string.h>
#include "./state.h"
+#include "wayland.h"
-extern struct wl_seat_listener seat_listener;
+struct wl_registry_listener registry_listener;
+void setup_registry(client_state* state) {
+ state->registry = wl_display_get_registry(state->display);
+ wl_registry_add_listener(state->registry, &registry_listener, state);
+ wl_display_roundtrip(state->display);
+}
void global(void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, uint32_t version) {
client_state* state = data;
@@ -14,8 +20,7 @@ void global(void *data, struct wl_registry *wl_registry, uint32_t name, const ch
state->compositor = wl_registry_bind(wl_registry, name, &wl_compositor_interface, 1);
}
else if (!strcmp(interface, wl_seat_interface.name)) {
- state->seat = wl_registry_bind(wl_registry, name, &wl_seat_interface, 1);
- wl_seat_add_listener(state->seat, &seat_listener, state);
+ setup_seat(state, name);
}
else if (!strcmp(interface, zwlr_layer_shell_v1_interface.name)) {
state->layer_shell = wl_registry_bind(wl_registry, name, &zwlr_layer_shell_v1_interface, version);