From 583fbcda3bba5a31b83d95ed8d64bed326ea1806 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 3 Feb 2022 16:40:10 -0600 Subject: libweston: Use weston_coord in struct weston_pointer Convert the bare x,y coordinates into struct weston_coord and update all users. We keep the surface position in wl_fixed_t for now so it still exactly matches the position most recently sent to clients. Signed-off-by: Derek Foreman --- tests/weston-test.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/weston-test.c b/tests/weston-test.c index 6d39e44e..2f7a2f8c 100644 --- a/tests/weston-test.c +++ b/tests/weston-test.c @@ -146,7 +146,9 @@ notify_pointer_position(struct weston_test *test, struct wl_resource *resource) struct weston_seat *seat = get_seat(test); struct weston_pointer *pointer = weston_seat_get_pointer(seat); - weston_test_send_pointer_position(resource, pointer->x, pointer->y); + weston_test_send_pointer_position(resource, + wl_fixed_from_double(pointer->pos.c.x), + wl_fixed_from_double(pointer->pos.c.y)); } static void @@ -285,13 +287,15 @@ move_pointer(struct wl_client *client, struct wl_resource *resource, struct weston_seat *seat = get_seat(test); struct weston_pointer *pointer = weston_seat_get_pointer(seat); struct weston_pointer_motion_event event = { 0 }; + struct weston_coord_global pos; struct timespec time; + pos.c = weston_coord(x, y); event = (struct weston_pointer_motion_event) { .mask = WESTON_POINTER_MOTION_REL, + .rel = weston_coord_sub(pos.c, pointer->pos.c), }; - event.rel = weston_coord_from_fixed(wl_fixed_from_int(x) - pointer->x, - wl_fixed_from_int(y) - pointer->y); + timespec_from_proto(&time, tv_sec_hi, tv_sec_lo, tv_nsec); notify_motion(seat, &time, &event); -- cgit v1.2.1