input: mouse events

This commit is contained in:
Daniel Eklöf 2019-07-05 10:44:57 +02:00
parent 1a341a56cc
commit a102ff09f9
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 103 additions and 6 deletions

23
main.c
View file

@ -61,14 +61,25 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
{
struct terminal *term = data;
if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD))
return;
if (term->wl.keyboard != NULL)
if (term->wl.keyboard != NULL) {
wl_keyboard_release(term->wl.keyboard);
term->wl.keyboard = NULL;
}
term->wl.keyboard = wl_seat_get_keyboard(wl_seat);
wl_keyboard_add_listener(term->wl.keyboard, &keyboard_listener, term);
if (term->wl.pointer.pointer != NULL) {
wl_pointer_release(term->wl.pointer.pointer);
term->wl.pointer.pointer = NULL;
}
if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
term->wl.keyboard = wl_seat_get_keyboard(wl_seat);
wl_keyboard_add_listener(term->wl.keyboard, &keyboard_listener, term);
}
if (caps & WL_SEAT_CAPABILITY_POINTER) {
term->wl.pointer.pointer = wl_seat_get_pointer(wl_seat);
wl_pointer_add_listener(term->wl.pointer.pointer, &pointer_listener, term);
}
}
static void