From f43ec9b27ebe37b799709985f5587e29ec8ef88b Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Sat, 11 Oct 2025 02:30:18 -0400 Subject: refactor to .h files --- seat.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'seat.c') diff --git a/seat.c b/seat.c index 2dd84a3..6199f13 100644 --- a/seat.c +++ b/seat.c @@ -1,23 +1,23 @@ #include "state.h" -#include -extern struct wl_pointer_listener pointer_listener; -extern struct wl_keyboard_listener keyboard_listener; +#include "wayland.h" + +struct wl_seat_listener seat_listener; + +void setup_seat(client_state* state, uint32_t name) { + state->seat = wl_registry_bind(state->registry, name, &wl_seat_interface, 1); + wl_seat_add_listener(state->seat, &seat_listener, state); +} void capabilities(void *data, struct wl_seat *wl_seat, uint32_t capabilities) { client_state* state = data; if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD && !state->keyboard) { - state->keyboard = wl_seat_get_keyboard(wl_seat); - wl_keyboard_add_listener(state->keyboard, &keyboard_listener, state); + setup_keyboard(state); } if (capabilities & WL_SEAT_CAPABILITY_POINTER && !state->pointer) { - state->pointer = wl_seat_get_pointer(wl_seat); - state->cursor_shape_device = wp_cursor_shape_manager_v1_get_pointer( - state->cursor_shape_manager, state->pointer); - wl_pointer_add_listener(state->pointer, &pointer_listener, state); + setup_pointer(state); } - } void name(void *data, struct wl_seat *wl_seat, const char *name) { -- cgit v1.2.3