diff options
author | Emre Ucan <eucan@de.adit-jv.com> | 2015-08-04 15:33:52 +0200 |
---|---|---|
committer | Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp> | 2015-08-05 13:59:52 +0900 |
commit | 4f6503f2d5ef4363cdd755fa31f18f42b10660e9 (patch) | |
tree | 4d56f1725d7b6248daf0b24de8b82cf6fea84db8 | |
parent | 6a487fa3fb7c8c07cc0e7384b08bcd9b17e4d2c9 (diff) | |
download | wayland-ivi-extension-4f6503f2d5ef4363cdd755fa31f18f42b10660e9.tar.gz |
ilmControl: use wl_display_roundtrip_queue
display_roundtrip_queue functions is an exact copy of the wl_display_roundtrip_queue.
Use the wayland implementation instead of its copy.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
-rw-r--r-- | ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c | 52 |
1 files changed, 6 insertions, 46 deletions
diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c index 9db014c..85fa978 100644 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c @@ -81,46 +81,6 @@ struct nativehandle_context { struct wl_list link; }; -static void roundtrip_done(void *data, struct wl_callback *callback, - uint32_t serial) -{ - (void) serial; - - *(int *)data = 1; - - wl_callback_destroy(callback); -} - -static struct wl_callback_listener roundtrip_listener = {roundtrip_done}; - -int display_roundtrip_queue(struct wl_display *display, - struct wl_event_queue *queue) -{ - int done = 0; - int ret = 0; - struct wl_callback *callback = wl_display_sync(display); - - if (! callback) - { - return -1; - } - - wl_proxy_set_queue((void *)callback, queue); - wl_callback_add_listener(callback, &roundtrip_listener, &done); - - while (ret != -1 && !done) - { - ret = wl_display_dispatch_queue(display, queue); - } - - if (ret == -1 && !done) - { - wl_callback_destroy(callback); - } - - return ret; -} - static inline void lock_context(struct ilm_control_context *ctx) { pthread_mutex_lock(&ctx->mutex); @@ -1317,11 +1277,11 @@ init_control(void) if ( // first level objects; ivi_controller - display_roundtrip_queue(wl->display, wl->queue) == -1 || + wl_display_roundtrip_queue(wl->display, wl->queue) == -1 || // second level object: ivi_controller_surfaces/layers - display_roundtrip_queue(wl->display, wl->queue) == -1 || + wl_display_roundtrip_queue(wl->display, wl->queue) == -1 || // third level objects: ivi_controller_surfaces/layers properties - display_roundtrip_queue(wl->display, wl->queue) == -1) + wl_display_roundtrip_queue(wl->display, wl->queue) == -1) { fprintf(stderr, "Failed to initialize wayland connection: %s\n", strerror(errno)); return -1; @@ -1362,7 +1322,7 @@ ilmErrorTypes impl_sync_and_acquire_instance(struct ilm_control_context *ctx) lock_context(ctx); - if (display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) == -1) { + if (wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) == -1) { int err = wl_display_get_error(ctx->wl.display); fprintf(stderr, "Error communicating with wayland: %s\n", strerror(err)); unlock_context(ctx); @@ -2488,7 +2448,7 @@ ilm_getPropertiesOfSurface(t_ilm_uint surfaceID, // request statistics for surface ivi_controller_surface_send_stats(ctx_surf->controller); // force submission - int ret = display_roundtrip_queue(ctx->wl.display, ctx->wl.queue); + int ret = wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue); // If we got an error here, there is really no sense // in returning the properties as something is fundamentally @@ -2601,7 +2561,7 @@ ilm_commitChanges(void) if (ctx->wl.controller != NULL) { ivi_controller_commit_changes(ctx->wl.controller); - if (display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) != -1) + if (wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) != -1) { returnValue = ILM_SUCCESS; } |