1 From fb66405f4f8ee200a443e22d3b4f56a0e917f785 Mon Sep 17 00:00:00 2001
2 From: Manuel Bachmann <mbc@iot.bzh>
3 Date: Wed, 30 Sep 2015 05:22:25 +0200
4 Subject: [PATCH] Backport to Wayland/Weston 1.9.0 > 1.5.0.
6 Downgrade requirements to Wayland/Weston 1.9.0 > 1.5.0.
8 "wl_display_roundtrip_queue()" did not exist at the time,
9 so just use the wrapper functions instead.
11 Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
13 .../ilmClient/src/ilm_client_wayland_platform.c | 15 ++-----
14 .../ilmControl/src/ilm_control_wayland_platform.c | 52 +++++++++++++++++++---
15 protocol/CMakeLists.txt | 4 +-
16 weston-ivi-shell/CMakeLists.txt | 4 +-
17 4 files changed, 53 insertions(+), 22 deletions(-)
19 diff --git a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c
20 index 55b1621..8730616 100644
21 --- a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c
22 +++ b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c
23 @@ -61,7 +61,6 @@ struct ilm_client_context {
24 struct wl_registry *registry;
25 struct wl_compositor *compositor;
26 struct ivi_application *ivi_application;
27 - struct wl_event_queue *queue;
29 struct wl_list list_surface;
31 @@ -167,12 +166,6 @@ destroy_client_resouses(void)
32 ctx->ivi_application = NULL;
37 - wl_event_queue_destroy(ctx->queue);
43 wl_registry_destroy(ctx->registry);
44 @@ -203,21 +196,19 @@ init_client(void)
46 wl_list_init(&ctx->list_surface);
48 - ctx->queue = wl_display_create_queue(ctx->display);
49 ctx->registry = wl_display_get_registry(ctx->display);
50 if (ctx->registry == NULL) {
51 - wl_event_queue_destroy(ctx->queue);
52 fprintf(stderr, "Failed to get registry\n");
56 - wl_proxy_set_queue((void*)ctx->registry, ctx->queue);
57 if (wl_registry_add_listener(ctx->registry,
58 ®istry_client_listener, ctx)) {
59 fprintf(stderr, "Failed to add registry listener\n");
62 - wl_display_roundtrip_queue(ctx->display, ctx->queue);
63 + wl_display_dispatch(ctx->display);
64 + wl_display_roundtrip(ctx->display);
66 if ((ctx->display == NULL) || (ctx->ivi_application == NULL)) {
67 fprintf(stderr, "Failed to connect display at ilm_client\n");
68 @@ -239,7 +230,7 @@ get_client_instance(void)
72 - wl_display_roundtrip_queue(ctx->display, ctx->queue);
73 + wl_display_roundtrip(ctx->display);
77 diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
78 index 8910df5..61bdfc5 100644
79 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
80 +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
81 @@ -76,6 +76,46 @@ struct screen_context {
82 struct ilm_control_context *ctx;
85 +static void roundtrip_done(void *data, struct wl_callback *callback,
92 + wl_callback_destroy(callback);
95 +static struct wl_callback_listener roundtrip_listener = {roundtrip_done};
97 +int display_roundtrip_queue(struct wl_display *display,
98 + struct wl_event_queue *queue)
102 + struct wl_callback *callback = wl_display_sync(display);
109 + wl_proxy_set_queue((void *)callback, queue);
110 + wl_callback_add_listener(callback, &roundtrip_listener, &done);
112 + while (ret != -1 && !done)
114 + ret = wl_display_dispatch_queue(display, queue);
117 + if (ret == -1 && !done)
119 + wl_callback_destroy(callback);
125 static inline void lock_context(struct ilm_control_context *ctx)
127 pthread_mutex_lock(&ctx->mutex);
128 @@ -1304,11 +1344,11 @@ init_control(void)
131 // first level objects; ivi_controller
132 - wl_display_roundtrip_queue(wl->display, wl->queue) == -1 ||
133 + display_roundtrip_queue(wl->display, wl->queue) == -1 ||
134 // second level object: ivi_controller_surfaces/layers
135 - wl_display_roundtrip_queue(wl->display, wl->queue) == -1 ||
136 + display_roundtrip_queue(wl->display, wl->queue) == -1 ||
137 // third level objects: ivi_controller_surfaces/layers properties
138 - wl_display_roundtrip_queue(wl->display, wl->queue) == -1)
139 + display_roundtrip_queue(wl->display, wl->queue) == -1)
141 fprintf(stderr, "Failed to initialize wayland connection: %s\n", strerror(errno));
143 @@ -1349,7 +1389,7 @@ ilmErrorTypes impl_sync_and_acquire_instance(struct ilm_control_context *ctx)
147 - if (wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) == -1) {
148 + if (display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) == -1) {
149 int err = wl_display_get_error(ctx->wl.display);
150 fprintf(stderr, "Error communicating with wayland: %s\n", strerror(err));
152 @@ -2454,7 +2494,7 @@ ilm_getPropertiesOfSurface(t_ilm_uint surfaceID,
153 // request statistics for surface
154 ivi_controller_surface_send_stats(ctx_surf->controller);
156 - int ret = wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue);
157 + int ret = display_roundtrip_queue(ctx->wl.display, ctx->wl.queue);
159 // If we got an error here, there is really no sense
160 // in returning the properties as something is fundamentally
161 @@ -2567,7 +2607,7 @@ ilm_commitChanges(void)
162 if (ctx->wl.controller != NULL) {
163 ivi_controller_commit_changes(ctx->wl.controller);
165 - if (wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) != -1)
166 + if (display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) != -1)
168 returnValue = ILM_SUCCESS;
170 diff --git a/protocol/CMakeLists.txt b/protocol/CMakeLists.txt
171 index 6842131..207b8f1 100644
172 --- a/protocol/CMakeLists.txt
173 +++ b/protocol/CMakeLists.txt
174 @@ -22,8 +22,8 @@ cmake_minimum_required (VERSION 2.6)
175 project(ivi-extension-protocol)
177 find_package(PkgConfig REQUIRED)
178 -pkg_check_modules(WAYLAND_CLIENT wayland-client>=1.9.0 REQUIRED)
179 -pkg_check_modules(WAYLAND_SERVER wayland-server>=1.9.0 REQUIRED)
180 +pkg_check_modules(WAYLAND_CLIENT wayland-client>=1.5.0 REQUIRED)
181 +pkg_check_modules(WAYLAND_SERVER wayland-server>=1.5.0 REQUIRED)
183 find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
185 diff --git a/weston-ivi-shell/CMakeLists.txt b/weston-ivi-shell/CMakeLists.txt
186 index c2664df..927e3f5 100644
187 --- a/weston-ivi-shell/CMakeLists.txt
188 +++ b/weston-ivi-shell/CMakeLists.txt
189 @@ -23,8 +23,8 @@ cmake_minimum_required (VERSION 2.6)
190 project(ivi-controller)
192 find_package(PkgConfig REQUIRED)
193 -pkg_check_modules(WAYLAND_SERVER wayland-server>=1.9.0 REQUIRED)
194 -pkg_check_modules(WESTON weston>=1.9.0 REQUIRED)
195 +pkg_check_modules(WAYLAND_SERVER wayland-server>=1.5.0 REQUIRED)
196 +pkg_check_modules(WESTON weston>=1.5.0 REQUIRED)
197 pkg_check_modules(PIXMAN pixman-1 REQUIRED)
199 GET_TARGET_PROPERTY(IVI_EXTENSION_INCLUDE_DIRS ivi-extension-protocol INCLUDE_DIRECTORIES)