diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-12-11 21:49:13 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-12-11 23:57:44 -0500 |
commit | cd7f09975a756050cd9e1f2ad70ec24297e45524 (patch) | |
tree | fc2935c21ab01bb06832fe4038223cde636bc481 | |
parent | 1f188db7e76cdcec82259b77ff23413d2019ee7e (diff) | |
download | weston-cd7f09975a756050cd9e1f2ad70ec24297e45524.tar.gz |
weston-test-client-helper: Use a frame callback to flush surface geometry
When moving a test surface, use a frame callback to make sure the
surface has been moved and the geometry updated. The compositor may
delay updating the transform matrices, but once we get the frame
callback we know the surface has been repainted and the geometry
updated.
-rw-r--r-- | tests/weston-test-client-helper.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index 1859356a..01405d83 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -63,10 +63,27 @@ move_pointer(struct client *client, int x, int y) yield(client); } +static void +move_client_frame_handler(void *data, + struct wl_callback *callback, uint32_t time) +{ + int *done = data; + + *done = 1; + + wl_callback_destroy(callback); +} + +static const struct wl_callback_listener frame_listener = { + move_client_frame_handler +}; + void move_client(struct client *client, int x, int y) { struct surface *surface = client->surface; + struct wl_callback *callback; + int done; client->surface->x = x; client->surface->y = y; @@ -74,10 +91,15 @@ move_client(struct client *client, int x, int y) surface->x, surface->y); wl_surface_damage(surface->wl_surface, 0, 0, surface->width, surface->height); + + callback = wl_surface_frame(surface->wl_surface); + done = 0; + wl_callback_add_listener(callback, &frame_listener, &done); + wl_surface_commit(surface->wl_surface); - yield(client); - yield(client); + while (!done) + wl_display_dispatch(client->wl_display); } static void |