From a102ff09f97135e911809eb7d4ef97870b287f5a Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 5 Jul 2019 10:44:57 +0200 Subject: input: mouse events --- main.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 934461e5..98fd5045 100644 --- a/main.c +++ b/main.c @@ -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; + } + + 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); + } - 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 -- cgit v1.3