aboutsummaryrefslogtreecommitdiff
path: root/seat.c
blob: 6199f139489a292158097ac98295a2c9438286b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "state.h"

#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) {
		setup_keyboard(state);
    }
    if (capabilities & WL_SEAT_CAPABILITY_POINTER && !state->pointer) {
		setup_pointer(state);
    }
}

void name(void *data, struct wl_seat *wl_seat, const char *name) {
}

struct wl_seat_listener seat_listener = {
	.capabilities = capabilities,
	.name = name,
};