Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 DENSO CORPORATION |
| 3 | * |
| 4 | * Permission to use, copy, modify, distribute, and sell this software and |
| 5 | * its documentation for any purpose is hereby granted without fee, provided |
| 6 | * that the above copyright notice appear in all copies and that both that |
| 7 | * copyright notice and this permission notice appear in supporting |
| 8 | * documentation, and that the name of the copyright holders not be used in |
| 9 | * advertising or publicity pertaining to distribution of the software |
| 10 | * without specific, written prior permission. The copyright holders make |
| 11 | * no representations about the suitability of this software for any |
| 12 | * purpose. It is provided "as is" without express or implied warranty. |
| 13 | * |
| 14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS |
| 15 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 16 | * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 17 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER |
| 18 | * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
| 19 | * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 20 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * ivi-shell supports a type of shell for In-Vehicle Infotainment system. |
| 25 | * In-Vehicle Infotainment system traditionally manages surfaces with global |
| 26 | * identification. A protocol, ivi_application, supports such a feature |
| 27 | * by implementing a request, ivi_application::surface_creation defined in |
| 28 | * ivi_application.xml. |
| 29 | * |
| 30 | * The ivi-shell explicitly loads a module to add business logic like how to |
| 31 | * layout surfaces by using internal ivi-layout APIs. |
| 32 | */ |
| 33 | #include "config.h" |
| 34 | |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 35 | #include <string.h> |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 36 | #include <dlfcn.h> |
| 37 | #include <limits.h> |
| 38 | #include <assert.h> |
Pekka Paalanen | 6c7a1c7 | 2015-02-19 17:12:19 +0200 | [diff] [blame] | 39 | #include <linux/input.h> |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 40 | |
| 41 | #include "ivi-shell.h" |
| 42 | #include "ivi-application-server-protocol.h" |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 43 | #include "ivi-layout-export.h" |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 44 | #include "ivi-layout-private.h" |
| 45 | |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 46 | /* Representation of ivi_surface protocol object. */ |
| 47 | struct ivi_shell_surface |
| 48 | { |
| 49 | struct wl_resource* resource; |
| 50 | struct ivi_shell *shell; |
| 51 | struct ivi_layout_surface *layout_surface; |
| 52 | |
| 53 | struct weston_surface *surface; |
| 54 | struct wl_listener surface_destroy_listener; |
| 55 | |
| 56 | uint32_t id_surface; |
| 57 | |
| 58 | int32_t width; |
| 59 | int32_t height; |
| 60 | |
| 61 | struct wl_list link; |
| 62 | |
| 63 | struct wl_listener configured_listener; |
| 64 | }; |
| 65 | |
| 66 | struct ivi_shell_setting |
| 67 | { |
| 68 | char *ivi_module; |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 69 | int developermode; |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | /* |
| 73 | * Implementation of ivi_surface |
| 74 | */ |
| 75 | |
| 76 | static void |
| 77 | surface_configure_notify(struct wl_listener *listener, void *data) |
| 78 | { |
| 79 | struct ivi_layout_surface *layout_surf = |
| 80 | (struct ivi_layout_surface *)data; |
| 81 | |
| 82 | struct ivi_shell_surface *shell_surf = |
| 83 | container_of(listener, |
| 84 | struct ivi_shell_surface, |
| 85 | configured_listener); |
| 86 | |
| 87 | int32_t dest_width = 0; |
| 88 | int32_t dest_height = 0; |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 89 | |
| 90 | ivi_layout_surface_get_dimension(layout_surf, |
| 91 | &dest_width, &dest_height); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 92 | |
| 93 | if (shell_surf->resource) |
| 94 | ivi_surface_send_configure(shell_surf->resource, |
| 95 | dest_width, dest_height); |
| 96 | } |
| 97 | |
| 98 | static void |
| 99 | ivi_shell_surface_configure(struct weston_surface *, int32_t, int32_t); |
| 100 | |
| 101 | static struct ivi_shell_surface * |
| 102 | get_ivi_shell_surface(struct weston_surface *surface) |
| 103 | { |
| 104 | if (surface->configure == ivi_shell_surface_configure) |
| 105 | return surface->configure_private; |
| 106 | |
| 107 | return NULL; |
| 108 | } |
| 109 | |
| 110 | static void |
| 111 | ivi_shell_surface_configure(struct weston_surface *surface, |
| 112 | int32_t sx, int32_t sy) |
| 113 | { |
| 114 | struct ivi_shell_surface *ivisurf = get_ivi_shell_surface(surface); |
| 115 | struct weston_view *view; |
| 116 | float from_x; |
| 117 | float from_y; |
| 118 | float to_x; |
| 119 | float to_y; |
| 120 | |
| 121 | if (surface->width == 0 || surface->height == 0 || ivisurf == NULL) |
| 122 | return; |
| 123 | |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 124 | view = ivi_layout_get_weston_view(ivisurf->layout_surface); |
| 125 | |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 126 | if (view == NULL) |
| 127 | return; |
| 128 | |
| 129 | if (ivisurf->width != surface->width || |
| 130 | ivisurf->height != surface->height) { |
| 131 | ivisurf->width = surface->width; |
| 132 | ivisurf->height = surface->height; |
| 133 | |
| 134 | weston_view_to_global_float(view, 0, 0, &from_x, &from_y); |
| 135 | weston_view_to_global_float(view, sx, sy, &to_x, &to_y); |
| 136 | |
| 137 | weston_view_set_position(view, |
| 138 | view->geometry.x + to_x - from_x, |
| 139 | view->geometry.y + to_y - from_y); |
| 140 | weston_view_update_transform(view); |
| 141 | |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 142 | ivi_layout_surface_configure(ivisurf->layout_surface, |
| 143 | surface->width, surface->height); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 144 | } |
| 145 | } |
| 146 | |
| 147 | /* |
| 148 | * The ivi_surface wl_resource destructor. |
| 149 | * |
| 150 | * Gets called via ivi_surface.destroy request or automatic wl_client clean-up. |
| 151 | */ |
| 152 | static void |
| 153 | shell_destroy_shell_surface(struct wl_resource *resource) |
| 154 | { |
| 155 | struct ivi_shell_surface *ivisurf = wl_resource_get_user_data(resource); |
| 156 | if (ivisurf != NULL) { |
| 157 | ivisurf->resource = NULL; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /* Gets called through the weston_surface destroy signal. */ |
| 162 | static void |
| 163 | shell_handle_surface_destroy(struct wl_listener *listener, void *data) |
| 164 | { |
| 165 | struct ivi_shell_surface *ivisurf = |
| 166 | container_of(listener, struct ivi_shell_surface, |
| 167 | surface_destroy_listener); |
| 168 | |
| 169 | assert(ivisurf != NULL); |
| 170 | |
| 171 | if (ivisurf->surface!=NULL) { |
| 172 | ivisurf->surface->configure = NULL; |
| 173 | ivisurf->surface->configure_private = NULL; |
| 174 | ivisurf->surface = NULL; |
| 175 | } |
| 176 | |
| 177 | wl_list_remove(&ivisurf->surface_destroy_listener.link); |
| 178 | wl_list_remove(&ivisurf->link); |
| 179 | |
| 180 | if (ivisurf->resource != NULL) { |
| 181 | wl_resource_set_user_data(ivisurf->resource, NULL); |
| 182 | ivisurf->resource = NULL; |
| 183 | } |
| 184 | free(ivisurf); |
| 185 | |
| 186 | } |
| 187 | |
| 188 | /* Gets called, when a client sends ivi_surface.destroy request. */ |
| 189 | static void |
| 190 | surface_destroy(struct wl_client *client, struct wl_resource *resource) |
| 191 | { |
| 192 | /* |
| 193 | * Fires the wl_resource destroy signal, and then calls |
| 194 | * ivi_surface wl_resource destructor: shell_destroy_shell_surface() |
| 195 | */ |
| 196 | wl_resource_destroy(resource); |
| 197 | } |
| 198 | |
| 199 | static const struct ivi_surface_interface surface_implementation = { |
| 200 | surface_destroy, |
| 201 | }; |
| 202 | |
| 203 | /** |
| 204 | * Request handler for ivi_application.surface_create. |
| 205 | * |
| 206 | * Creates an ivi_surface protocol object associated with the given wl_surface. |
| 207 | * ivi_surface protocol object is represented by struct ivi_shell_surface. |
| 208 | * |
| 209 | * \param client The client. |
| 210 | * \param resource The ivi_application protocol object. |
| 211 | * \param id_surface The IVI surface ID. |
| 212 | * \param surface_resource The wl_surface protocol object. |
| 213 | * \param id The protocol object id for the new ivi_surface protocol object. |
| 214 | * |
| 215 | * The wl_surface is given the ivi_surface role and associated with a unique |
| 216 | * IVI ID which is used to identify the surface in a controller |
| 217 | * (window manager). |
| 218 | */ |
| 219 | static void |
| 220 | application_surface_create(struct wl_client *client, |
| 221 | struct wl_resource *resource, |
| 222 | uint32_t id_surface, |
| 223 | struct wl_resource *surface_resource, |
| 224 | uint32_t id) |
| 225 | { |
| 226 | struct ivi_shell *shell = wl_resource_get_user_data(resource); |
| 227 | struct ivi_shell_surface *ivisurf; |
| 228 | struct ivi_layout_surface *layout_surface; |
| 229 | struct weston_surface *weston_surface = |
| 230 | wl_resource_get_user_data(surface_resource); |
| 231 | struct wl_resource *res; |
| 232 | |
| 233 | if (weston_surface_set_role(weston_surface, "ivi_surface", |
| 234 | resource, IVI_APPLICATION_ERROR_ROLE) < 0) |
| 235 | return; |
| 236 | |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 237 | layout_surface = ivi_layout_surface_create(weston_surface, id_surface); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 238 | |
| 239 | /* check if id_ivi is already used for wl_surface*/ |
| 240 | if (layout_surface == NULL){ |
| 241 | wl_resource_post_error(resource, |
| 242 | IVI_APPLICATION_ERROR_IVI_ID, |
| 243 | "surface_id is already assigned " |
| 244 | "by another app"); |
| 245 | return; |
| 246 | } |
| 247 | |
| 248 | ivisurf = zalloc(sizeof *ivisurf); |
| 249 | if (ivisurf == NULL) { |
| 250 | wl_resource_post_no_memory(resource); |
| 251 | return; |
| 252 | } |
| 253 | |
| 254 | wl_list_init(&ivisurf->link); |
| 255 | wl_list_insert(&shell->ivi_surface_list, &ivisurf->link); |
| 256 | |
| 257 | ivisurf->shell = shell; |
| 258 | ivisurf->id_surface = id_surface; |
| 259 | |
| 260 | ivisurf->width = 0; |
| 261 | ivisurf->height = 0; |
| 262 | ivisurf->layout_surface = layout_surface; |
| 263 | ivisurf->configured_listener.notify = surface_configure_notify; |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 264 | ivi_layout_surface_add_configured_listener(layout_surface, |
| 265 | &ivisurf->configured_listener); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 266 | /* |
| 267 | * The following code relies on wl_surface destruction triggering |
| 268 | * immediateweston_surface destruction |
| 269 | */ |
| 270 | ivisurf->surface_destroy_listener.notify = shell_handle_surface_destroy; |
| 271 | wl_signal_add(&weston_surface->destroy_signal, |
| 272 | &ivisurf->surface_destroy_listener); |
| 273 | |
| 274 | ivisurf->surface = weston_surface; |
| 275 | |
| 276 | weston_surface->configure = ivi_shell_surface_configure; |
| 277 | weston_surface->configure_private = ivisurf; |
| 278 | |
| 279 | res = wl_resource_create(client, &ivi_surface_interface, 1, id); |
| 280 | if (res == NULL) { |
| 281 | wl_client_post_no_memory(client); |
| 282 | return; |
| 283 | } |
| 284 | |
| 285 | ivisurf->resource = res; |
| 286 | |
| 287 | wl_resource_set_implementation(res, &surface_implementation, |
| 288 | ivisurf, shell_destroy_shell_surface); |
| 289 | } |
| 290 | |
| 291 | static const struct ivi_application_interface application_implementation = { |
| 292 | application_surface_create |
| 293 | }; |
| 294 | |
| 295 | /* |
| 296 | * Handle wl_registry.bind of ivi_application global singleton. |
| 297 | */ |
| 298 | static void |
| 299 | bind_ivi_application(struct wl_client *client, |
| 300 | void *data, uint32_t version, uint32_t id) |
| 301 | { |
| 302 | struct ivi_shell *shell = data; |
| 303 | struct wl_resource *resource; |
| 304 | |
| 305 | resource = wl_resource_create(client, &ivi_application_interface, |
| 306 | 1, id); |
| 307 | |
| 308 | wl_resource_set_implementation(resource, |
| 309 | &application_implementation, |
| 310 | shell, NULL); |
| 311 | } |
| 312 | |
Nobuhiko Tanibata | 0038b73 | 2014-11-27 13:25:34 +0900 | [diff] [blame] | 313 | struct weston_view * |
| 314 | get_default_view(struct weston_surface *surface) |
| 315 | { |
| 316 | struct ivi_shell_surface *shsurf; |
| 317 | struct weston_view *view; |
| 318 | |
| 319 | if (!surface || wl_list_empty(&surface->views)) |
| 320 | return NULL; |
| 321 | |
| 322 | shsurf = get_ivi_shell_surface(surface); |
| 323 | if (shsurf && shsurf->layout_surface) { |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 324 | view = ivi_layout_get_weston_view(shsurf->layout_surface); |
Nobuhiko Tanibata | 0038b73 | 2014-11-27 13:25:34 +0900 | [diff] [blame] | 325 | if (view) |
| 326 | return view; |
| 327 | } |
| 328 | |
| 329 | wl_list_for_each(view, &surface->views, surface_link) { |
| 330 | if (weston_view_is_mapped(view)) |
| 331 | return view; |
| 332 | } |
| 333 | |
| 334 | return container_of(surface->views.next, |
| 335 | struct weston_view, surface_link); |
| 336 | } |
| 337 | |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 338 | /* |
| 339 | * Called through the compositor's destroy signal. |
| 340 | */ |
| 341 | static void |
| 342 | shell_destroy(struct wl_listener *listener, void *data) |
| 343 | { |
| 344 | struct ivi_shell *shell = |
| 345 | container_of(listener, struct ivi_shell, destroy_listener); |
| 346 | struct ivi_shell_surface *ivisurf, *next; |
| 347 | |
Nobuhiko Tanibata | 0038b73 | 2014-11-27 13:25:34 +0900 | [diff] [blame] | 348 | input_panel_destroy(shell); |
| 349 | |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 350 | wl_list_for_each_safe(ivisurf, next, &shell->ivi_surface_list, link) { |
| 351 | wl_list_remove(&ivisurf->link); |
| 352 | free(ivisurf); |
| 353 | } |
| 354 | |
| 355 | free(shell); |
| 356 | } |
| 357 | |
| 358 | static void |
Pekka Paalanen | 6c7a1c7 | 2015-02-19 17:12:19 +0200 | [diff] [blame] | 359 | terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key, |
| 360 | void *data) |
| 361 | { |
| 362 | struct weston_compositor *compositor = data; |
| 363 | |
| 364 | wl_display_terminate(compositor->wl_display); |
| 365 | } |
| 366 | |
| 367 | static void |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 368 | init_ivi_shell(struct weston_compositor *compositor, struct ivi_shell *shell, |
| 369 | const struct ivi_shell_setting *setting) |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 370 | { |
| 371 | shell->compositor = compositor; |
| 372 | |
| 373 | wl_list_init(&shell->ivi_surface_list); |
| 374 | |
Nobuhiko Tanibata | 0038b73 | 2014-11-27 13:25:34 +0900 | [diff] [blame] | 375 | weston_layer_init(&shell->input_panel_layer, NULL); |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 376 | |
Pekka Paalanen | 6c7a1c7 | 2015-02-19 17:12:19 +0200 | [diff] [blame] | 377 | if (setting->developermode) { |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 378 | weston_install_debug_key_binding(compositor, MODIFIER_SUPER); |
Pekka Paalanen | 6c7a1c7 | 2015-02-19 17:12:19 +0200 | [diff] [blame] | 379 | |
| 380 | weston_compositor_add_key_binding(compositor, KEY_BACKSPACE, |
| 381 | MODIFIER_CTRL | MODIFIER_ALT, |
| 382 | terminate_binding, |
| 383 | compositor); |
| 384 | } |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | static int |
| 388 | ivi_shell_setting_create(struct ivi_shell_setting *dest, |
Pekka Paalanen | 8a00525 | 2015-03-20 15:53:53 +0200 | [diff] [blame^] | 389 | struct weston_compositor *compositor, |
| 390 | int *argc, char *argv[]) |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 391 | { |
| 392 | int result = 0; |
| 393 | struct weston_config *config = compositor->config; |
| 394 | struct weston_config_section *section; |
| 395 | |
Pekka Paalanen | 8a00525 | 2015-03-20 15:53:53 +0200 | [diff] [blame^] | 396 | const struct weston_option ivi_shell_options[] = { |
| 397 | { WESTON_OPTION_STRING, "ivi-module", 0, &dest->ivi_module }, |
| 398 | }; |
| 399 | |
| 400 | parse_options(ivi_shell_options, ARRAY_LENGTH(ivi_shell_options), |
| 401 | argc, argv); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 402 | |
| 403 | section = weston_config_get_section(config, "ivi-shell", NULL, NULL); |
| 404 | |
Pekka Paalanen | 8a00525 | 2015-03-20 15:53:53 +0200 | [diff] [blame^] | 405 | if (!dest->ivi_module && |
| 406 | weston_config_section_get_string(section, "ivi-module", |
| 407 | &dest->ivi_module, NULL) < 0) { |
| 408 | weston_log("Error: ivi-shell: No ivi-module set\n"); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 409 | result = -1; |
| 410 | } |
| 411 | |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 412 | weston_config_section_get_bool(section, "developermode", |
| 413 | &dest->developermode, 0); |
| 414 | |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 415 | return result; |
| 416 | } |
| 417 | |
| 418 | /* |
| 419 | * Initialization of ivi-shell. |
| 420 | */ |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 421 | WL_EXPORT int |
| 422 | module_init(struct weston_compositor *compositor, |
| 423 | int *argc, char *argv[]) |
| 424 | { |
| 425 | struct ivi_shell *shell; |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 426 | struct ivi_shell_setting setting = { }; |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 427 | int retval = -1; |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 428 | |
| 429 | shell = zalloc(sizeof *shell); |
| 430 | if (shell == NULL) |
| 431 | return -1; |
| 432 | |
Pekka Paalanen | 8a00525 | 2015-03-20 15:53:53 +0200 | [diff] [blame^] | 433 | if (ivi_shell_setting_create(&setting, compositor, argc, argv) != 0) |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 434 | return -1; |
| 435 | |
| 436 | init_ivi_shell(compositor, shell, &setting); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 437 | |
| 438 | shell->destroy_listener.notify = shell_destroy; |
| 439 | wl_signal_add(&compositor->destroy_signal, &shell->destroy_listener); |
| 440 | |
Nobuhiko Tanibata | 0038b73 | 2014-11-27 13:25:34 +0900 | [diff] [blame] | 441 | if (input_panel_setup(shell) < 0) |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 442 | goto out_settings; |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 443 | |
| 444 | if (wl_global_create(compositor->wl_display, |
| 445 | &ivi_application_interface, 1, |
| 446 | shell, bind_ivi_application) == NULL) |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 447 | goto out_settings; |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 448 | |
Nobuhiko Tanibata | 28dc18c | 2014-12-15 13:22:31 +0900 | [diff] [blame] | 449 | ivi_layout_init_with_compositor(compositor); |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 450 | |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 451 | /* Call module_init of ivi-modules which are defined in weston.ini */ |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 452 | if (load_controller_modules(compositor, setting.ivi_module, |
| 453 | argc, argv) < 0) |
| 454 | goto out_settings; |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 455 | |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 456 | retval = 0; |
| 457 | |
| 458 | out_settings: |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 459 | free(setting.ivi_module); |
Pekka Paalanen | e35b223 | 2015-02-19 17:08:44 +0200 | [diff] [blame] | 460 | |
| 461 | return retval; |
Nobuhiko Tanibata | 487adc4 | 2014-11-27 13:22:37 +0900 | [diff] [blame] | 462 | } |