summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman@collabora.com>2022-02-03 16:40:10 -0600
committerPekka Paalanen <pq@iki.fi>2023-02-17 13:51:23 +0000
commit583fbcda3bba5a31b83d95ed8d64bed326ea1806 (patch)
tree06b6ae41a0378650eb4f90297434d2efc672cec2 /tests
parent8f33e86cda37253e2bc0185ff4a376fb69ff267d (diff)
downloadweston-583fbcda3bba5a31b83d95ed8d64bed326ea1806.tar.gz
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 <derek.foreman@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/weston-test.c10
1 files changed, 7 insertions, 3 deletions
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);