diff options
author | Emre Ucan <eucan@de.adit-jv.com> | 2016-02-26 15:33:37 +0100 |
---|---|---|
committer | Wataru Natsume <wataru_natsume@xddp.denso.co.jp> | 2016-06-28 15:22:27 +0900 |
commit | 84cbfe3a5c5795b1904125101eccb7c44470b1cf (patch) | |
tree | 3a86efd99d1d9d6831fdcb5c8d9decb14bcabfbd | |
parent | 9a3788c4e420e84c2169baa5b89c2b4c009f5742 (diff) | |
download | wayland-ivi-extension-84cbfe3a5c5795b1904125101eccb7c44470b1cf.tar.gz |
ivi-controller: copy controller_module init to ivi-controller
it is copied from ivi-extension.c, because ivi-extension.c
will be removed.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
-rw-r--r-- | weston-ivi-shell/src/ivi-controller-impl.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/weston-ivi-shell/src/ivi-controller-impl.c b/weston-ivi-shell/src/ivi-controller-impl.c index 7e730a7..74c8df6 100644 --- a/weston-ivi-shell/src/ivi-controller-impl.c +++ b/weston-ivi-shell/src/ivi-controller-impl.c @@ -34,6 +34,9 @@ #include "bitmap.h" #include "wayland-util.h" +#ifdef IVI_SHARE_ENABLE +# include "ivi-share.h" +#endif struct ivilayer; struct iviscreen; @@ -1419,3 +1422,80 @@ setup_ivi_controller_server(struct weston_compositor *compositor, return 0; } + +static int +load_input_module(struct weston_compositor *ec, + const struct ivi_layout_interface *interface, + size_t interface_version) +{ + struct weston_config *config = ec->config; + struct weston_config_section *section; + char *input_module = NULL; + + int (*input_module_init)(struct weston_compositor *ec, + const struct ivi_layout_interface *interface, + size_t interface_version); + + section = weston_config_get_section(config, "ivi-shell", NULL, NULL); + + if (weston_config_section_get_string(section, "ivi-input-module", + &input_module, NULL) < 0) { + /* input events are handled by weston's default grabs */ + weston_log("ivi-controller: No ivi-input-module set\n"); + return 0; + } + + input_module_init = weston_load_module(input_module, "input_controller_module_init"); + if (!input_module_init) + return -1; + + if (input_module_init(ec, interface, + sizeof(struct ivi_layout_interface)) != 0) { + weston_log("ivi-controller: Initialization of input module failes"); + return -1; + } + + free(input_module); + + return 0; +} + +WL_EXPORT int +controller_module_init(struct weston_compositor *compositor, + int *argc, char *argv[], + const struct ivi_layout_interface *interface, + size_t interface_version) +{ + struct ivishell *shell; + (void)argc; + (void)argv; + + shell = malloc(sizeof *shell); + if (shell == NULL) + return -1; + + memset(shell, 0, sizeof *shell); + + shell->interface = interface; + + init_ivi_shell(compositor, shell); + +#ifdef IVI_SHARE_ENABLE + if (setup_buffer_sharing(compositor, interface) < 0) { + free(shell); + return -1; + } +#endif + + if (setup_ivi_controller_server(compositor, shell)) { + free(shell); + return -1; + } + + if (load_input_module(compositor, interface, interface_version) < 0) { + free(shell); + return -1; + } + + return 0; +} |