diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-07-05 08:44:57 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-07-05 08:44:57 +0000 |
| commit | a102ff09f97135e911809eb7d4ef97870b287f5a (patch) | |
| tree | 3118d9bde1be5c0ba702b47b3deebb0531641137 /main.c | |
| parent | render: load cursor theme from XCURSOR_THEME and XCURSOR_SIZE (diff) | |
input: mouse events
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -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 |
