diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-08-23 18:14:06 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-08-29 17:12:36 -0400 |
commit | a8d1fa762efb501340bbde180b26b3fba76b7f60 (patch) | |
tree | 541b33a1cdbb03626a891f7de69a54c299b43535 /clients/screenshot.c | |
parent | f790c79ec71a371552077253539efeeb7966a9d1 (diff) |
clients: Bring clients up to date
Diffstat (limited to 'clients/screenshot.c')
-rw-r--r-- | clients/screenshot.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/clients/screenshot.c b/clients/screenshot.c index 82cf9cda..428befa7 100644 --- a/clients/screenshot.c +++ b/clients/screenshot.c @@ -81,38 +81,19 @@ handle_global(struct wl_display *display, uint32_t id, static int visual_count; if (strcmp(interface, "wl_output") == 0) { - output = wl_output_create(display, id, 1); + output = wl_display_bind(display, id, &wl_output_interface); wl_output_add_listener(output, &output_listener, NULL); } else if (strcmp(interface, "wl_shm") == 0) { - shm = wl_shm_create(display, id, 1); + shm = wl_display_bind(display, id, &wl_shm_interface); } else if (strcmp(interface, "wl_visual") == 0) { if (visual_count++ == 1) - visual = wl_visual_create(display, id, 1); + visual = wl_display_bind(display, id, + &wl_visual_interface); } else if (strcmp(interface, "screenshooter") == 0) { - screenshooter = screenshooter_create(display, id, 1); + screenshooter = wl_display_bind(display, id, &screenshooter_interface); } } -static void -sync_callback(void *data) -{ - int *done = data; - - *done = 1; -} - -static void -roundtrip(struct wl_display *display) -{ - int done; - - done = 0; - wl_display_sync_callback(display, sync_callback, &done); - wl_display_iterate(display, WL_DISPLAY_WRITABLE); - while (!done) - wl_display_iterate(display, WL_DISPLAY_READABLE); -} - static struct wl_buffer * create_shm_buffer(int width, int height, void **data_out) { @@ -183,7 +164,7 @@ int main(int argc, char *argv[]) wl_display_add_global_listener(display, handle_global, &screenshooter); wl_display_iterate(display, WL_DISPLAY_READABLE); - roundtrip(display); + wl_display_roundtrip(display); if (screenshooter == NULL) { fprintf(stderr, "display doesn't support screenshooter\n"); return -1; @@ -191,7 +172,7 @@ int main(int argc, char *argv[]) buffer = create_shm_buffer(output_width, output_height, &data); screenshooter_shoot(screenshooter, output, buffer); - roundtrip(display); + wl_display_roundtrip(display); write_png(output_width, output_height, data); |