diff options
author | Nakamura Hayato <hayato.nakamura@mail.toyota-td.jp> | 2013-06-14 10:36:21 +0900 |
---|---|---|
committer | Nakamura Hayato <hayato.nakamura@mail.toyota-td.jp> | 2013-06-14 10:39:04 +0900 |
commit | a734dfb193f61d7235fdd50e5e12b816dd1f26dd (patch) | |
tree | d6b411ddbc66bbd92a2f4a35eb1926e9cb936892 | |
parent | e0bc60d3c6728821f39d97f3ec4824372b6a310d (diff) | |
download | ico-uxf-weston-plugin-a734dfb193f61d7235fdd50e5e12b816dd1f26dd.tar.gz ico-uxf-weston-plugin-a734dfb193f61d7235fdd50e5e12b816dd1f26dd.tar.bz2 ico-uxf-weston-plugin-a734dfb193f61d7235fdd50e5e12b816dd1f26dd.zip |
[Fix:Conflict]Changed the animation of a default defined from none to fade.2.0alpha-wayland
Change-Id: I30923a6a8a274b98253a41209833249d69b93667
Signed-off-by: Nakamura Hayato <hayato.nakamura@mail.toyota-td.jp>
-rw-r--r-- | packaging/ico-uxf-weston-plugin.changes | 5 | ||||
-rw-r--r-- | packaging/ico-uxf-weston-plugin.spec | 2 | ||||
-rw-r--r-- | src/config-parser.c | 340 | ||||
-rw-r--r-- | src/ico_ivi_shell.c | 17 | ||||
-rw-r--r-- | src/ico_window_animation.c | 57 | ||||
-rw-r--r-- | tests/weston_ivi_plugin.ini | 4 | ||||
-rw-r--r-- | weston_ivi_plugin.ini | 4 |
7 files changed, 239 insertions, 190 deletions
diff --git a/packaging/ico-uxf-weston-plugin.changes b/packaging/ico-uxf-weston-plugin.changes index 65e9a1e..8f7d9be 100644 --- a/packaging/ico-uxf-weston-plugin.changes +++ b/packaging/ico-uxf-weston-plugin.changes @@ -1,3 +1,8 @@ +* Wed Jun 12 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> submit/2.0alpha-wayland/20130612.051916@5247a37 +- 0.5.06 release +- fixed for - weston loop forever when a fading animation is required in an animation of the fading again by same surface. +- changed the animation of a default defined from "none" to "fade" in configuration file(weston_ivi_plugin.ini), and changed animation time in 500ms from 600ms. + * Wed Jun 12 2013 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/2.0alpha-wayland/20130606.173106@48a3aa7 - 0.5.05 release - fixed for - During operation, a menu thumbnail may be non-displayed. diff --git a/packaging/ico-uxf-weston-plugin.spec b/packaging/ico-uxf-weston-plugin.spec index dc43b4d..9a6373d 100644 --- a/packaging/ico-uxf-weston-plugin.spec +++ b/packaging/ico-uxf-weston-plugin.spec @@ -1,6 +1,6 @@ Name: ico-uxf-weston-plugin Summary: Weston Plugins for IVI -Version: 0.5.05 +Version: 0.5.06 Release: 1.1 Group: System/GUI/Libraries License: MIT diff --git a/src/config-parser.c b/src/config-parser.c index 0397a38..261c425 100644 --- a/src/config-parser.c +++ b/src/config-parser.c @@ -37,187 +37,187 @@ static int handle_key(const struct config_key *key, const char *value) { - char *end, *s; - int i, len; - unsigned int ui; - - switch (key->type) { - case CONFIG_KEY_INTEGER: - i = strtol(value, &end, 0); - if (*end != '\n') { - fprintf(stderr, "invalid integer: %s\n", value); - return -1; - } - *(int *)key->data = i; - return 0; - - case CONFIG_KEY_UNSIGNED_INTEGER: - ui = strtoul(value, &end, 0); - if (*end != '\n') { - fprintf(stderr, "invalid integer: %s\n", value); - return -1; - } - *(unsigned int *)key->data = ui; - return 0; - - case CONFIG_KEY_STRING: - len = strlen(value); - while (len > 0 && isspace(value[len - 1])) - len--; - s = malloc(len + 1); - if (s == NULL) - return -1; - memcpy(s, value, len); - s[len] = '\0'; - *(char **)key->data = s; - return 0; - - case CONFIG_KEY_BOOLEAN: - if (strcmp(value, "false\n") == 0) - *(int *)key->data = 0; - else if (strcmp(value, "true\n") == 0) - *(int *)key->data = 1; - else { - fprintf(stderr, "invalid bool: %s\n", value); - return -1; - } - return 0; - - default: - assert(0); - break; - } - - return -1; + char *end, *s; + int i, len; + unsigned int ui; + + switch (key->type) { + case CONFIG_KEY_INTEGER: + i = strtol(value, &end, 0); + if (*end != '\n') { + fprintf(stderr, "invalid integer: %s\n", value); + return -1; + } + *(int *)key->data = i; + return 0; + + case CONFIG_KEY_UNSIGNED_INTEGER: + ui = strtoul(value, &end, 0); + if (*end != '\n') { + fprintf(stderr, "invalid integer: %s\n", value); + return -1; + } + *(unsigned int *)key->data = ui; + return 0; + + case CONFIG_KEY_STRING: + len = strlen(value); + while (len > 0 && isspace(value[len - 1])) + len--; + s = malloc(len + 1); + if (s == NULL) + return -1; + memcpy(s, value, len); + s[len] = '\0'; + *(char **)key->data = s; + return 0; + + case CONFIG_KEY_BOOLEAN: + if (strcmp(value, "false\n") == 0) + *(int *)key->data = 0; + else if (strcmp(value, "true\n") == 0) + *(int *)key->data = 1; + else { + fprintf(stderr, "invalid bool: %s\n", value); + return -1; + } + return 0; + + default: + assert(0); + break; + } + + return -1; } int parse_config_file(int fd, - const struct config_section *sections, int num_sections, - void *data) + const struct config_section *sections, int num_sections, + void *data) { - FILE *fp; - char line[512], *p; - const struct config_section *current = NULL; - int i; + FILE *fp; + char line[512], *p; + const struct config_section *current = NULL; + int i; - if (fd == -1) - return -1; + if (fd == -1) + return -1; - fp = fdopen(dup(fd), "r"); - if (fp == NULL) { + fp = fdopen(dup(fd), "r"); + if (fp == NULL) { perror("couldn't open config file"); - return -1; - } - - rewind(fp); - - while (fgets(line, sizeof line, fp)) { - if (line[0] == '#' || line[0] == '\n') { - continue; - } if (line[0] == '[') { - p = strchr(&line[1], ']'); - if (!p || p[1] != '\n') { - fprintf(stderr, "malformed " - "section header: %s\n", line); - fclose(fp); - return -1; - } - if (current && current->done) - current->done(data); - p[0] = '\0'; - for (i = 0; i < num_sections; i++) { - if (strcmp(sections[i].name, &line[1]) == 0) { - current = §ions[i]; - break; - } - } - if (i == num_sections) - current = NULL; - } else if (p = strchr(line, '='), p != NULL) { - if (current == NULL) - continue; - p[0] = '\0'; - for (i = 0; i < current->num_keys; i++) { - if (strcmp(current->keys[i].name, line) == 0) { - if (handle_key(¤t->keys[i], &p[1]) < 0) { - fclose(fp); - return -1; - } - break; - } - } - } else { - fprintf(stderr, "malformed config line: %s\n", line); - fclose(fp); - return -1; - } - } - - if (current && current->done) - current->done(data); - - fclose(fp); - - return 0; + return -1; + } + + rewind(fp); + + while (fgets(line, sizeof line, fp)) { + if (line[0] == '#' || line[0] == '\n') { + continue; + } if (line[0] == '[') { + p = strchr(&line[1], ']'); + if (!p || p[1] != '\n') { + fprintf(stderr, "malformed " + "section header: %s\n", line); + fclose(fp); + return -1; + } + if (current && current->done) + current->done(data); + p[0] = '\0'; + for (i = 0; i < num_sections; i++) { + if (strcmp(sections[i].name, &line[1]) == 0) { + current = §ions[i]; + break; + } + } + if (i == num_sections) + current = NULL; + } else if (p = strchr(line, '='), p != NULL) { + if (current == NULL) + continue; + p[0] = '\0'; + for (i = 0; i < current->num_keys; i++) { + if (strcmp(current->keys[i].name, line) == 0) { + if (handle_key(¤t->keys[i], &p[1]) < 0) { + fclose(fp); + return -1; + } + break; + } + } + } else { + fprintf(stderr, "malformed config line: %s\n", line); + fclose(fp); + return -1; + } + } + + if (current && current->done) + current->done(data); + + fclose(fp); + + return 0; } int open_config_file(const char *name) { - const char *config_dir = getenv("XDG_CONFIG_HOME"); - const char *home_dir = getenv("HOME"); - const char *config_dirs = getenv("XDG_CONFIG_DIRS"); - char path[PATH_MAX]; - const char *p, *next; - int fd; - - /* Precedence is given to config files in the home directory, - * and then to directories listed in XDG_CONFIG_DIRS and - * finally to the current working directory. */ - - /* $XDG_CONFIG_HOME */ - if (config_dir) { - snprintf(path, sizeof path, "%s/%s", config_dir, name); - fd = open(path, O_RDONLY | O_CLOEXEC); - if (fd >= 0) - return fd; - } - - /* $HOME/.config */ - if (home_dir) { - snprintf(path, sizeof path, "%s/.config/%s", home_dir, name); - fd = open(path, O_RDONLY | O_CLOEXEC); - if (fd >= 0) - return fd; - } - - /* For each $XDG_CONFIG_DIRS: weston/<config_file> */ - if (!config_dirs) - config_dirs = "/etc/xdg"; /* See XDG base dir spec. */ - - for (p = config_dirs; *p != '\0'; p = next) { - next = strchrnul(p, ':'); - snprintf(path, sizeof path, - "%.*s/weston/%s", (int)(next - p), p, name); - fd = open(path, O_RDONLY | O_CLOEXEC); - if (fd >= 0) - return fd; - - if (*next == ':') - next++; - } - - /* Current working directory. */ - snprintf(path, sizeof path, "./%s", name); - fd = open(path, O_RDONLY | O_CLOEXEC); - - if (fd >= 0) - fprintf(stderr, - "using config in current working directory: %s\n", - path); - else - fprintf(stderr, "config file \"%s\" not found.\n", name); - - return fd; + const char *config_dir = getenv("XDG_CONFIG_HOME"); + const char *home_dir = getenv("HOME"); + const char *config_dirs = getenv("XDG_CONFIG_DIRS"); + char path[PATH_MAX]; + const char *p, *next; + int fd; + + /* Precedence is given to config files in the home directory, + * and then to directories listed in XDG_CONFIG_DIRS and + * finally to the current working directory. */ + + /* $XDG_CONFIG_HOME */ + if (config_dir) { + snprintf(path, sizeof path, "%s/%s", config_dir, name); + fd = open(path, O_RDONLY | O_CLOEXEC); + if (fd >= 0) + return fd; + } + + /* $HOME/.config */ + if (home_dir) { + snprintf(path, sizeof path, "%s/.config/%s", home_dir, name); + fd = open(path, O_RDONLY | O_CLOEXEC); + if (fd >= 0) + return fd; + } + + /* For each $XDG_CONFIG_DIRS: weston/<config_file> */ + if (!config_dirs) + config_dirs = "/etc/xdg"; /* See XDG base dir spec. */ + + for (p = config_dirs; *p != '\0'; p = next) { + next = strchrnul(p, ':'); + snprintf(path, sizeof path, + "%.*s/weston/%s", (int)(next - p), p, name); + fd = open(path, O_RDONLY | O_CLOEXEC); + if (fd >= 0) + return fd; + + if (*next == ':') + next++; + } + + /* Current working directory. */ + snprintf(path, sizeof path, "./%s", name); + fd = open(path, O_RDONLY | O_CLOEXEC); + + if (fd >= 0) + fprintf(stderr, + "using config in current working directory: %s\n", + path); + else + fprintf(stderr, "config file \"%s\" not found.\n", name); + + return fd; } diff --git a/src/ico_ivi_shell.c b/src/ico_ivi_shell.c index fb7a61c..64d7a0f 100644 --- a/src/ico_ivi_shell.c +++ b/src/ico_ivi_shell.c @@ -1019,6 +1019,10 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy) uifw_trace("shell_surface_configure: Enter(surf=%08x out=%08x buf=%08x)", (int)es, (int)es->output, (int)es->buffer); + if (! es->buffer) { + uifw_trace("shell_surface_configure: Leave(no buffer)"); + return; + } if (shsurf->restrain) { uifw_trace("shell_surface_configure: Leave(restrain)"); return; @@ -1043,7 +1047,7 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy) } } else { - if ((shsurf->mapped == 0) && (es->buffer != NULL)) { + if (shsurf->mapped == 0) { if ((es->geometry.width > 0) && (es->geometry.height >0)) { uifw_trace("shell_surface_configure: map Surface size(sx/sy=%d/%d w/h=%d/%d)", sx, sy, es->buffer->width, es->buffer->height); @@ -1468,11 +1472,12 @@ ivi_shell_restrain_configure(struct shell_surface *shsurf, const int restrain) /*--------------------------------------------------------------------------*/ /** - * @brief ivi_shell_set_active: surface active control + * @brief ivi_shell_is_restrain: check surface restrain * * @param[in] shsurf shell surface(if NULL, no active surface) - * @param[in] restrain restrain(1)/not restrain(0) - * @return none + * @return restrain + * @retval =1 surface currently restrain + * @retval =0 not restrain */ /*--------------------------------------------------------------------------*/ WL_EXPORT int @@ -1570,7 +1575,8 @@ ivi_shell_set_visible(struct shell_surface *shsurf, const int visible) struct ivi_shell *shell = shell_surface_get_shell(shsurf); int next; - uifw_trace("ivi_shell_set_visible: [%08x] visible=%d", (int)shsurf, (int)visible); + uifw_trace("ivi_shell_set_visible: [%08x] (%08x) visible=%d", + (int)shsurf, (int)shsurf->surface, (int)visible); if (visible < 0) { next = shell->win_visible_on_create; @@ -1640,7 +1646,6 @@ ivi_shell_set_layer(struct shell_surface *shsurf, const int layer) /* search existing layer */ wl_list_for_each (el, &shell->ivi_layer.link, link) { - uifw_trace("ivi_shell_set_layer: el=%08x(%d)", (int)el, el->layer); if (el->layer == layer) break; } diff --git a/src/ico_window_animation.c b/src/ico_window_animation.c index a63b647..8e27a69 100644 --- a/src/ico_window_animation.c +++ b/src/ico_window_animation.c @@ -64,8 +64,11 @@ struct animation_data { int width; /* original width */ int height; /* original height */ char geometry_saved; /* need geometry restor at end */ - char res[3]; /* (unused) */ + char transform_set; /* need transform reset at end */ + char res[2]; /* (unused) */ struct weston_transform transform; /* transform matrix */ + void (*end_function)(struct weston_animation *animation); + /* animation end function */ }; /* static valiables */ @@ -82,6 +85,8 @@ static void animation_slide(struct weston_animation *animation, /* fade animation */ static void animation_fade(struct weston_animation *animation, struct weston_output *output, uint32_t msecs); + /* fade animation end */ +static void animation_fade_end(struct weston_animation *animation); /* continue animation */ static int animation_cont(struct weston_animation *animation, struct weston_output *output, uint32_t msecs); @@ -289,8 +294,6 @@ animation_cont(struct weston_animation *animation, struct weston_output *output, animadata->width = usurf->width; animadata->height = usurf->height; animadata->geometry_saved = 1; - weston_matrix_init(&animadata->transform.matrix); - wl_list_init(&animadata->transform.link); } else if (! usurf->animadata) { animation_end(usurf, 0); @@ -338,6 +341,9 @@ animation_end(struct uifw_win_surface *usurf, const int disp) animadata = (struct animation_data *)usurf->animadata; if (animadata) { + if (animadata->end_function) { + (*animadata->end_function)(&usurf->animation.animation); + } if (animadata->geometry_saved > 1) { usurf->x = animadata->x; usurf->y = animadata->y; @@ -346,7 +352,11 @@ animation_end(struct uifw_win_surface *usurf, const int disp) animadata->geometry_saved = 0; } wl_list_remove(&usurf->animation.animation.link); - wl_list_init(&usurf->animation.animation.link); + if (animadata->transform_set) { + wl_list_remove(&animadata->transform.link); + animadata->transform_set = 0; + } + usurf->surface->geometry.dirty = 1; } if (disp) { if ((usurf->animation.visible == ANIMA_HIDE_AT_END) && @@ -361,9 +371,9 @@ animation_end(struct uifw_win_surface *usurf, const int disp) ivi_shell_set_visible(usurf->shsurf, 1); weston_surface_damage_below(usurf->surface); weston_surface_damage(usurf->surface); - weston_compositor_schedule_repaint(weston_ec); } ivi_shell_restrain_configure(usurf->shsurf, 0); + weston_compositor_schedule_repaint(weston_ec); } usurf->animation.visible = ANIMA_NOCONTROL_AT_END; usurf->animation.type = usurf->animation.type_next; @@ -519,15 +529,20 @@ animation_fade(struct weston_animation *animation, es = usurf->surface; par = usurf->animation.current; if (animation->frame_counter == 1) { - wl_list_insert(&es->geometry.transformation_list, - &animadata->transform.link); + if (animadata->transform_set == 0) { + animadata->transform_set = 1; + weston_matrix_init(&animadata->transform.matrix); + wl_list_init(&animadata->transform.link); + wl_list_insert(&es->geometry.transformation_list, + &animadata->transform.link); + } + animadata->end_function = animation_fade_end; } uifw_trace("animation_fade: usurf=%08x count=%d %d%% type=%d state=%d", (int)usurf, animation->frame_counter, par, usurf->animation.type, usurf->animation.state); - if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_IN) { /* fade in */ es->alpha = ((double)par) / ((double)100.0); @@ -546,7 +561,6 @@ animation_fade(struct weston_animation *animation, } if (par >= 100) { /* end of animation */ - wl_list_remove(&animadata->transform.link); animation_end(usurf, 1); uifw_trace("animation_fade: End of animation"); } @@ -558,6 +572,31 @@ animation_fade(struct weston_animation *animation, /*--------------------------------------------------------------------------*/ /** + * @brief animation_fade_end: fade animation end + * + * @param[in] animation weston animation table + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +animation_fade_end(struct weston_animation *animation) +{ + struct uifw_win_surface *usurf; + struct weston_surface *es; + + usurf = container_of(animation, struct uifw_win_surface, animation.animation); + es = usurf->surface; + es->alpha = 1.0; + + if ((es->output) && (es->buffer) && + (es->geometry.width > 0) && (es->geometry.height > 0)) { + weston_surface_damage_below(es); + weston_surface_damage(es); + } +} + +/*--------------------------------------------------------------------------*/ +/** * @brief module_init: initialize ico_window_animation * this function called from ico_pluign_loader * diff --git a/tests/weston_ivi_plugin.ini b/tests/weston_ivi_plugin.ini index a021d9b..98ed6f7 100644 --- a/tests/weston_ivi_plugin.ini +++ b/tests/weston_ivi_plugin.ini @@ -3,9 +3,9 @@ modules=ico_ivi_common.so,ico_ivi_shell.so,ico_window_mgr.so,ico_window_animatio [shell] # default animation -animation=none +animation=fade # animation time (ms) -animation_time=600 +animation_time=500 # animation frame rate(frame/sec) animation_fps=15 diff --git a/weston_ivi_plugin.ini b/weston_ivi_plugin.ini index a021d9b..98ed6f7 100644 --- a/weston_ivi_plugin.ini +++ b/weston_ivi_plugin.ini @@ -3,9 +3,9 @@ modules=ico_ivi_common.so,ico_ivi_shell.so,ico_window_mgr.so,ico_window_animatio [shell] # default animation -animation=none +animation=fade # animation time (ms) -animation_time=600 +animation_time=500 # animation frame rate(frame/sec) animation_fps=15 |