input: Don't test keyboard/pointer/touch pointers

Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.

This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ã…dahl <jadahl@gmail.com>
diff --git a/tests/weston-test.c b/tests/weston-test.c
index df9a139..b593f1e 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -83,7 +83,7 @@
 notify_pointer_position(struct weston_test *test, struct wl_resource *resource)
 {
 	struct weston_seat *seat = get_seat(test);
-	struct weston_pointer *pointer = seat->pointer;
+	struct weston_pointer *pointer = weston_seat_get_pointer(seat);
 
 	weston_test_send_pointer_position(resource, pointer->x, pointer->y);
 }
@@ -144,7 +144,7 @@
 {
 	struct weston_test *test = wl_resource_get_user_data(resource);
 	struct weston_seat *seat = get_seat(test);
-	struct weston_pointer *pointer = seat->pointer;
+	struct weston_pointer *pointer = weston_seat_get_pointer(seat);
 
 	notify_motion(seat, 100,
 		      wl_fixed_from_int(x) - pointer->x,
@@ -171,12 +171,13 @@
 		wl_resource_get_user_data(surface_resource) : NULL;
 	struct weston_test *test = wl_resource_get_user_data(resource);
 	struct weston_seat *seat;
+	struct weston_keyboard *keyboard;
 
 	seat = get_seat(test);
-
+	keyboard = weston_seat_get_keyboard(seat);
 	if (surface) {
 		weston_surface_activate(surface, seat);
-		notify_keyboard_focus_in(seat, &seat->keyboard->keys,
+		notify_keyboard_focus_in(seat, &keyboard->keys,
 					 STATE_UPDATE_AUTOMATIC);
 	}
 	else {