diff --git a/clients/ivi-shell-user-interface.c b/clients/ivi-shell-user-interface.c index bbc2ff22f..dd7699200 100644 --- a/clients/ivi-shell-user-interface.c +++ b/clients/ivi-shell-user-interface.c @@ -143,6 +143,8 @@ hmi_homescreen_launcher { uint32_t workspace_id; char *icon; char *path; + char **argv; + struct wl_list link; }; @@ -308,12 +310,10 @@ launcher_button(uint32_t surfaceId, struct wl_list *launcher_list) struct hmi_homescreen_launcher *launcher = NULL; wl_list_for_each(launcher, launcher_list, link) { - char *argv[] = { NULL }; - if (surfaceId != launcher->icon_surface_id) continue; - execute_process(launcher->path, argv); + execute_process(launcher->path, launcher->argv); return 1; } @@ -1065,6 +1065,32 @@ create_launchers(struct wlContextCommon *cmm, struct wl_list *launcher_list) free(launchers); } +static char ** +parse_command(char *str) +{ + char **argv; + char *saveptr; + char *token; + int i; + int count = 1; + + for (i = 1; str[i]; i++) + if (str[i] == ' ' && str[i-1] != ' ') + count++; + + argv = xcalloc(count + 1, sizeof(char*)); + + i = 0; + token = strtok_r(str, " ", &saveptr); + while (token != NULL) { + argv[i++] = token; + + token = strtok_r(NULL, " ", &saveptr); + } + + return argv; +} + /** * Internal method to read out weston.ini to get configuration */ @@ -1177,6 +1203,7 @@ hmi_homescreen_setting_create(void) while (weston_config_next_section(config, §ion, &name)) { struct hmi_homescreen_launcher *launcher; + char *command; if (strcmp(name, "ivi-launcher") != 0) continue; @@ -1186,8 +1213,18 @@ hmi_homescreen_setting_create(void) weston_config_section_get_string(section, "icon", &launcher->icon, NULL); - weston_config_section_get_string(section, "path", - &launcher->path, NULL); + + weston_config_section_get_string(section, "command", + &command, NULL); + if (command == NULL) { + weston_config_section_get_string(section, "path", + &launcher->path, NULL); + launcher->argv = NULL; + } else { + launcher->argv = parse_command(command); + launcher->path = launcher->argv[0]; + } + weston_config_section_get_uint(section, "workspace-id", &launcher->workspace_id, 0); weston_config_section_get_uint(section, "icon-id", diff --git a/data/COPYING b/data/COPYING index 034502397..a18c6d676 100644 --- a/data/COPYING +++ b/data/COPYING @@ -33,6 +33,7 @@ home.png icon_ivi_clickdot.png icon_ivi_flower.png icon_ivi_simple-egl.png +icon_ivi_simple-egl-vertical.png icon_ivi_simple-shm.png icon_ivi_smoke.png diff --git a/data/icon_ivi_simple-egl-vertical.png b/data/icon_ivi_simple-egl-vertical.png new file mode 100644 index 000000000..1c9279380 Binary files /dev/null and b/data/icon_ivi_simple-egl-vertical.png differ diff --git a/data/meson.build b/data/meson.build index 10d820cb9..38a994a2b 100644 --- a/data/meson.build +++ b/data/meson.build @@ -9,6 +9,7 @@ install_data( 'icon_ivi_clickdot.png', 'icon_ivi_flower.png', 'icon_ivi_simple-egl.png', + 'icon_ivi_simple-egl-vertical.png', 'icon_ivi_simple-shm.png', 'icon_ivi_smoke.png', 'icon_terminal.png', diff --git a/ivi-shell/weston.ini.in b/ivi-shell/weston.ini.in index 3bdfbebb4..d6073e627 100644 --- a/ivi-shell/weston.ini.in +++ b/ivi-shell/weston.ini.in @@ -96,3 +96,9 @@ workspace-id=3 icon-id=4010 icon=@westondatadir@/icon_ivi_smoke.png path=@bindir@/weston-smoke + +[ivi-launcher] +workspace-id=3 +icon-id=4011 +icon=@westondatadir@/icon_ivi_simple-egl-vertical.png +command=@bindir@/weston-simple-egl -v diff --git a/tests/ivi-shell-app-test.c b/tests/ivi-shell-app-test.c index 65c5b0d3e..3420e8687 100644 --- a/tests/ivi-shell-app-test.c +++ b/tests/ivi-shell-app-test.c @@ -133,7 +133,13 @@ fixture_setup(struct weston_test_harness *harness) cfgln("workspace-id=%d", 3), cfgln("icon-id=%d", 4010), cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_smoke.png"), - cfgln("path=%s", BINDIR "/weston-smoke") + cfgln("path=%s", BINDIR "/weston-smoke"), + + cfgln("[ivi-launcher]"), + cfgln("workspace-id=%d", 3), + cfgln("icon-id=%d", 4011), + cfgln("icon=%s", WESTON_DATA_DIR "/icon_ivi_simple-egl-vertical.png"), + cfgln("command=%s", BINDIR "/weston-simple-egl -v") ); return weston_test_harness_execute_as_client(harness, &setup);