input: Unset focus of seat device when releasing last reference

When the last input device with a certain capability is removed, unset
the focus of the seat device associated with the capability.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
diff --git a/src/input.c b/src/input.c
index d1acd92..6e14766 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1680,6 +1680,7 @@
 {
 	seat->keyboard_device_count--;
 	if (seat->keyboard_device_count == 0) {
+		weston_keyboard_set_focus(seat->keyboard, NULL);
 		seat_send_updated_caps(seat);
 	}
 }
@@ -1714,6 +1715,10 @@
 
 	seat->pointer_device_count--;
 	if (seat->pointer_device_count == 0) {
+		weston_pointer_set_focus(pointer, NULL,
+					 wl_fixed_from_int(0),
+					 wl_fixed_from_int(0));
+
 		seat_send_updated_caps(seat);
 	}
 }
@@ -1746,6 +1751,7 @@
 {
 	seat->touch_device_count--;
 	if (seat->touch_device_count == 0) {
+		weston_touch_set_focus(seat, NULL);
 		seat_send_updated_caps(seat);
 	}
 }