aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-05 08:44:57 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-05 08:44:57 +0000
commita102ff09f97135e911809eb7d4ef97870b287f5a (patch)
tree3118d9bde1be5c0ba702b47b3deebb0531641137 /main.c
parentrender: load cursor theme from XCURSOR_THEME and XCURSOR_SIZE (diff)
input: mouse events
Diffstat (limited to 'main.c')
-rw-r--r--main.c23
1 files changed, 17 insertions, 6 deletions
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