diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2015-07-31 16:55:32 -0500 |
---|---|---|
committer | Bryce Harrington <bryce@osg.samsung.com> | 2015-07-31 15:16:09 -0700 |
commit | 1281a36e3bcd27345bd4a107f282213ecca56f0e (patch) | |
tree | 5d797ffcd96f5542da153bec095a1c7800ce9cda /tests | |
parent | b41b59e2fae83124f90ce54b6ae3f088bfec3338 (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/surface-screenshot.c | 7 | ||||
-rw-r--r-- | tests/weston-test.c | 9 |
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/surface-screenshot.c b/tests/surface-screenshot.c index a54ae22e..703d48b0 100644 --- a/tests/surface-screenshot.c +++ b/tests/surface-screenshot.c @@ -139,6 +139,7 @@ trigger_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key, 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 @@ trigger_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key, 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); diff --git a/tests/weston-test.c b/tests/weston-test.c index df9a1391..b593f1e8 100644 --- a/tests/weston-test.c +++ b/tests/weston-test.c @@ -83,7 +83,7 @@ static void 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 @@ move_pointer(struct wl_client *client, struct wl_resource *resource, { 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 @@ activate_surface(struct wl_client *client, struct wl_resource *resource, 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 { |