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/surface-screenshot.c b/tests/surface-screenshot.c
index a54ae22..703d48b 100644
--- a/tests/surface-screenshot.c
+++ b/tests/surface-screenshot.c
@@ -139,6 +139,7 @@
char fname[1024];
struct weston_surface *surface;
struct weston_seat *seat = keyboard->seat;
+ struct weston_pointer *pointer = weston_seat_get_pointer(seat);
int width, height;
char desc[512];
void *pixels;
@@ -147,12 +148,10 @@
int ret;
FILE *fp;
- if (seat->pointer_device_count == 0 ||
- !seat->pointer ||
- !seat->pointer->focus)
+ if (!pointer || !pointer->focus)
return;
- surface = seat->pointer->focus->surface;
+ surface = pointer->focus->surface;
weston_surface_get_content_size(surface, &width, &height);