diff options
author | Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp> | 2013-09-06 19:34:54 +0900 |
---|---|---|
committer | Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp> | 2013-09-06 19:51:10 +0900 |
commit | ffb17d1b41868672899be638aa21dd1130ea2522 (patch) | |
tree | 2aa724bc326cc4a83a4f6798c63f1f85d5afc626 /src | |
parent | c0ddb023649b0d9d58e36f022cf5eef374aadde4 (diff) | |
download | ico-uxf-weston-plugin-ffb17d1b41868672899be638aa21dd1130ea2522.tar.gz ico-uxf-weston-plugin-ffb17d1b41868672899be638aa21dd1130ea2522.tar.bz2 ico-uxf-weston-plugin-ffb17d1b41868672899be638aa21dd1130ea2522.zip |
Bug fix:TIVI-1693.
Change-Id: I5edfb53df811c37545017295c2b758d792999259
Signed-off-by: Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
Diffstat (limited to 'src')
-rw-r--r-- | src/ico_ivi_common.h | 1 | ||||
-rw-r--r-- | src/ico_ivi_shell.c | 24 | ||||
-rw-r--r-- | src/ico_window_animation.c | 383 | ||||
-rw-r--r-- | src/ico_window_mgr.c | 174 | ||||
-rw-r--r-- | src/ico_window_mgr.h | 6 |
5 files changed, 484 insertions, 104 deletions
diff --git a/src/ico_ivi_common.h b/src/ico_ivi_common.h index 64e2ef1..1fd0ad4 100644 --- a/src/ico_ivi_common.h +++ b/src/ico_ivi_common.h @@ -58,6 +58,7 @@ /* Debug flags */ #define ICO_IVI_DEBUG_SHOW_SURFACE 0x01 /* new surface show on create */ +#define ICO_IVI_DEBUG_SHOW_NODISP 0x02 /* show if display not exist */ /* Function prototype */ int ico_ivi_get_mynode(void); /* Get my node numner */ diff --git a/src/ico_ivi_shell.c b/src/ico_ivi_shell.c index 25e8698..3b88783 100644 --- a/src/ico_ivi_shell.c +++ b/src/ico_ivi_shell.c @@ -1333,7 +1333,7 @@ resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time) height += wl_fixed_to_int(to_y - from_y); } - uifw_trace("resize_grab_motion: send configure %08x %x w/h=%d/%d", + uifw_debug("resize_grab_motion: send configure %08x %x w/h=%d/%d", (int)shsurf->surface, resize->edges, width, height); shsurf->client->send_configure(shsurf->surface, resize->edges, width, height); @@ -1907,7 +1907,7 @@ shell_surface_set_maximized(struct wl_client *client, panel_height = get_output_panel_height(shell, shsurf->output); edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT; - uifw_trace("shell_surface_set_maximized: send %08x %x w/h=%d/%d", + uifw_debug("shell_surface_set_maximized: send %08x %x w/h=%d/%d", (int)shsurf->surface, edges, shsurf->output->width, shsurf->output->height - panel_height); shsurf->client->send_configure(shsurf->surface, edges, @@ -1935,7 +1935,7 @@ create_black_surface(struct weston_compositor *ec, surface->configure = black_surface_configure; surface->configure_private = fs_surface; - uifw_trace("create_black_surface: configure %08x x/y=%d/%d w/h=%d/%d", + uifw_debug("create_black_surface: configure %08x x/y=%d/%d w/h=%d/%d", (int)surface, (int)x, (int)y, w, h); weston_surface_configure(surface, x, y, w, h); weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1); @@ -2025,7 +2025,7 @@ shell_configure_fullscreen(struct shell_surface *shsurf) weston_surface_set_position(surface, output->x - surf_x, output->y - surf_y); - uifw_trace("shell_configure_fullscreen: configure %08x x/y=%d/%d w/h=%d/%d", + uifw_debug("shell_configure_fullscreen: configure %08x x/y=%d/%d w/h=%d/%d", (int)shsurf->fullscreen.black_surface, (int)(output->x - surf_x), (int)(output->y - surf_y), output->width, output->height); weston_surface_configure(shsurf->fullscreen.black_surface, @@ -2102,7 +2102,7 @@ set_fullscreen(struct shell_surface *shsurf, shsurf->fullscreen.framerate = framerate; shsurf->next_type = SHELL_SURFACE_FULLSCREEN; - uifw_trace("set_fullscreen: send %08x 0 w/h=%d/%d", + uifw_debug("set_fullscreen: send %08x 0 w/h=%d/%d", (int)shsurf->surface, shsurf->output->width, shsurf->output->height); shsurf->client->send_configure(shsurf->surface, 0, shsurf->output->width, @@ -2616,7 +2616,7 @@ configure_static_surface(struct weston_surface *es, struct weston_layer *layer, } } - uifw_trace("configure_static_surface: configure %08x x/y=%d/%d w/h=%d/%d", + uifw_debug("configure_static_surface: configure %08x x/y=%d/%d w/h=%d/%d", (int)es, (int)es->output->x, (int)es->output->y, width, height); weston_surface_configure(es, es->output->x, es->output->y, width, height); @@ -2659,7 +2659,7 @@ desktop_shell_set_background(struct wl_client *client, surface->configure = background_configure; surface->configure_private = shell; surface->output = wl_resource_get_user_data(output_resource); - uifw_trace("desktop_shell_set_background: send %08x 0 w/h=%d/%d", + uifw_debug("desktop_shell_set_background: send %08x 0 w/h=%d/%d", (int)surface, surface->output->width, surface->output->height); desktop_shell_send_configure(resource, 0, surface_resource, @@ -2695,7 +2695,7 @@ desktop_shell_set_panel(struct wl_client *client, surface->configure = panel_configure; surface->configure_private = shell; surface->output = wl_resource_get_user_data(output_resource); - uifw_trace("desktop_shell_set_panel: send %08x 0 w/h=%d/%d", + uifw_debug("desktop_shell_set_panel: send %08x 0 w/h=%d/%d", (int)surface, surface->output->width, surface->output->height); desktop_shell_send_configure(resource, 0, surface_resource, @@ -2711,7 +2711,7 @@ lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy, i if (width == 0) return; - uifw_trace("lock_surface_configure: change %08x w/h=%d/%d", (int)surface, width, height); + uifw_debug("lock_surface_configure: change %08x w/h=%d/%d", (int)surface, width, height); surface->geometry.width = width; surface->geometry.height = height; center_on_output(surface, get_default_output(shell->compositor)); @@ -3324,7 +3324,7 @@ shell_fade_create_surface(struct desktop_shell *shell) if (!surface) return NULL; - uifw_trace("shell_fade_create_surface: configure %08x x/y=%d/%d w/h=%d/%d", + uifw_debug("shell_fade_create_surface: configure %08x x/y=%d/%d w/h=%d/%d", (int)surface, 0, 0, 8192, 8192); weston_surface_configure(surface, 0, 0, 8192, 8192); weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0); @@ -3528,7 +3528,7 @@ center_on_output(struct weston_surface *surface, struct weston_output *output) x = output->x + (output->width - width) / 2 - surf_x / 2; y = output->y + (output->height - height) / 2 - surf_y / 2; - uifw_trace("center_on_output: %08x x/y=%d/%d w/h=%d/%d", + uifw_debug("center_on_output: %08x x/y=%d/%d w/h=%d/%d", (int)output, (int)x, (int)y, width, height); weston_surface_configure(surface, x, y, width, height); } @@ -4014,7 +4014,7 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy, in y = ip_surface->output->y + ip_surface->output->height - height; } - uifw_trace("input_panel_configure: configure %08x x/y=%d/%d w/h=%d/%d", + uifw_debug("input_panel_configure: configure %08x x/y=%d/%d w/h=%d/%d", (int)surface, (int)x, (int)y, width, height); weston_surface_configure(surface, x, y, diff --git a/src/ico_window_animation.c b/src/ico_window_animation.c index 12ff474..8d008b4 100644 --- a/src/ico_window_animation.c +++ b/src/ico_window_animation.c @@ -46,10 +46,18 @@ /* Animation type */ #define ANIMA_ZOOM 1 /* ZoomIn/ZoomOut */ #define ANIMA_FADE 2 /* FadeIn/FadeOut */ -#define ANIMA_SLIDE_TORIGHT 3 /* SlideIn left to right/SlideOut right to left*/ -#define ANIMA_SLIDE_TOLEFT 4 /* SlideIn right to left/SlideOut left to right*/ -#define ANIMA_SLIDE_TOBOTTOM 5 /* SlideIn top to bottom/SlideOut bottom to top*/ -#define ANIMA_SLIDE_TOTOP 6 /* SlideIn bottom to top/SlideOut top to bottom*/ +#define ANIMA_SLIDE_TORIGHT 11 /* SlideIn left to right/SlideOut right to left */ +#define ANIMA_SLIDE_TOLEFT 12 /* SlideIn right to left/SlideOut left to right */ +#define ANIMA_SLIDE_TOBOTTOM 13 /* SlideIn top to bottom/SlideOut bottom to top */ +#define ANIMA_SLIDE_TOTOP 14 /* SlideIn bottom to top/SlideOut top to bottom */ +#define ANIMA_WIPE_TORIGHT 21 /* WipeIn left to right/WipeOut right to left */ +#define ANIMA_WIPE_TOLEFT 22 /* WipeIn right to left/WipeOut left to right */ +#define ANIMA_WIPE_TOBOTTOM 23 /* WipeIn top to bottom/WipeOut bottom to top */ +#define ANIMA_WIPE_TOTOP 24 /* WipeIn bottom to top/WipeOut top to bottom */ +#define ANIMA_SWING_TORIGHT 31 /* SwingIn left to right/SwingOut right to left */ +#define ANIMA_SWING_TOLEFT 32 /* SwingIn right to left/SwingOut left to right */ +#define ANIMA_SWING_TOBOTTOM 33 /* SwingIn top to bottom/SwingOut bottom to top */ +#define ANIMA_SWING_TOTOP 34 /* SwingIn bottom to top/SwingOut top to bottom */ /* Visible control at end of animation */ #define ANIMA_NOCONTROL_AT_END 0 /* no need surface show/hide at end of animation*/ @@ -73,10 +81,43 @@ static int animation_fps; /* animation frame rate(frame/sec) static int animation_time; /* default animation time(ms) */ static struct animation_data *free_data; /* free data list */ +/* support animation names */ +static const struct _supprt_animaetions { + char *name; + int animaid; +} supprt_animaetions[] = { + { "fade", ANIMA_FADE }, + { "zoom", ANIMA_ZOOM }, + { "slide", ANIMA_SLIDE_TOTOP }, + { "slide.toleft", ANIMA_SLIDE_TOLEFT }, + { "slide.toright", ANIMA_SLIDE_TORIGHT }, + { "slide.totop", ANIMA_SLIDE_TOTOP }, + { "slide.tobottom", ANIMA_SLIDE_TOBOTTOM }, + { "wipe", ANIMA_WIPE_TOTOP }, + { "wipe.toleft", ANIMA_WIPE_TOLEFT }, + { "wipe.toright", ANIMA_WIPE_TORIGHT }, + { "wipe.totop", ANIMA_WIPE_TOTOP }, + { "wipe.tobottom", ANIMA_WIPE_TOBOTTOM }, + { "swing", ANIMA_SWING_TOTOP }, + { "swing.toleft", ANIMA_SWING_TOLEFT }, + { "swing.toright", ANIMA_SWING_TORIGHT }, + { "swing.totop", ANIMA_SWING_TOTOP }, + { "swing.tobottom", ANIMA_SWING_TOBOTTOM }, + { "\0", -1 } +}; + /* static function */ /* slide animation */ static void animation_slide(struct weston_animation *animation, struct weston_output *output, uint32_t msecs); + /* wipe animation */ +static void animation_wipe(struct weston_animation *animation, + struct weston_output *output, uint32_t msecs); + /* swing animation */ +static void animation_swing(struct weston_animation *animation, + struct weston_output *output, uint32_t msecs); + /* swing animation end */ +static void animation_swing_end(struct weston_animation *animation); /* fade animation */ static void animation_fade(struct weston_animation *animation, struct weston_output *output, uint32_t msecs); @@ -110,36 +151,19 @@ ico_window_animation(const int op, void *data) { struct uifw_win_surface *usurf; struct weston_output *output; + int idx; int ret; uint32_t nowsec; int animaid; if (op == ICO_WINDOW_MGR_ANIMATION_NAME) { /* convert animation name to animation type value */ - if (strcasecmp((char *)data, "fade") == 0) { - uifw_trace("ico_window_animation: Type %s(%d)", (char *)data, ANIMA_FADE); - return ANIMA_FADE; - } - else if (strcasecmp((char *)data, "zoom") == 0) { - uifw_trace("ico_window_animation: Type %s(%d)", (char *)data, ANIMA_ZOOM); - return ANIMA_ZOOM; - } - else if (strcasecmp((char *)data, "slide.toleft") == 0) { - uifw_trace("ico_window_animation: Type %s(%d)", (char *)data, ANIMA_SLIDE_TOLEFT); - return ANIMA_SLIDE_TOLEFT; - } - else if (strcasecmp((char *)data, "slide.toright") == 0) { - uifw_trace("ico_window_animation: Type %s(%d)", (char *)data, ANIMA_SLIDE_TORIGHT); - return ANIMA_SLIDE_TORIGHT; - } - else if ((strcasecmp((char *)data, "slide.totop") == 0) || - (strcasecmp((char *)data, "slide") == 0)) { - uifw_trace("ico_window_animation: Type %s(%d)", (char *)data, ANIMA_SLIDE_TOTOP); - return ANIMA_SLIDE_TOTOP; - } - else if (strcasecmp((char *)data, "slide.tobottom") == 0) { - uifw_trace("ico_window_animation: Type %s(%d)", (char *)data, ANIMA_SLIDE_TOBOTTOM); - return ANIMA_SLIDE_TOBOTTOM; + for (idx = 0; supprt_animaetions[idx].animaid > 0; idx++) { + if (strcasecmp(supprt_animaetions[idx].name, (char *)data) == 0) { + uifw_trace("ico_window_animation: Type %s(%d)", + (char *)data, supprt_animaetions[idx].animaid); + return supprt_animaetions[idx].animaid; + } } uifw_warn("ico_window_animation: Unknown Type %s", (char *)data); return ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA; @@ -150,7 +174,7 @@ ico_window_animation(const int op, void *data) if (op == ICO_WINDOW_MGR_ANIMATION_DESTROY) { if ((usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE) || (usurf->animation.animadata != NULL)) { - uifw_trace("ico_window_animation: Destroy %08x", (int)usurf); + uifw_trace("ico_window_animation: Destroy %08x", usurf->surfaceid); animation_end(usurf, 0); } return ICO_WINDOW_MGR_ANIMATION_RET_ANIMA; @@ -260,6 +284,18 @@ ico_window_animation(const int op, void *data) usurf->restrain_configure = 1; (*usurf->animation.animation.frame)(&usurf->animation.animation, NULL, 1); } + else if ((animaid == ANIMA_WIPE_TOLEFT) || (animaid == ANIMA_WIPE_TORIGHT) || + (animaid == ANIMA_WIPE_TOTOP) || (animaid == ANIMA_WIPE_TOBOTTOM)) { + usurf->animation.animation.frame = animation_wipe; + usurf->restrain_configure = 1; + (*usurf->animation.animation.frame)(&usurf->animation.animation, NULL, 1); + } + else if ((animaid == ANIMA_SWING_TOLEFT) || (animaid == ANIMA_SWING_TORIGHT) || + (animaid == ANIMA_SWING_TOTOP) || (animaid == ANIMA_SWING_TOBOTTOM)) { + usurf->animation.animation.frame = animation_swing; + usurf->restrain_configure = 1; + (*usurf->animation.animation.frame)(&usurf->animation.animation, NULL, 1); + } else if (animaid == ANIMA_FADE) { usurf->animation.animation.frame = animation_fade; usurf->restrain_configure = 1; @@ -476,8 +512,8 @@ animation_slide(struct weston_animation *animation, } par = usurf->animation.current; - uifw_trace("animation_slide: usurf=%08x count=%d %d%% anima=%d state=%d", - (int)usurf, animation->frame_counter, par, + uifw_trace("animation_slide: %08x count=%d %d%% anima=%d state=%d", + usurf->surfaceid, animation->frame_counter, par, usurf->animation.anima, usurf->animation.state); es = usurf->surface; @@ -557,6 +593,277 @@ animation_slide(struct weston_animation *animation, /*--------------------------------------------------------------------------*/ /** + * @brief animation_wipe: wipe animation + * + * @param[in] animation weston animation table + * @param[in] outout weston output table + * @param[in] mseces current time(unused) + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +animation_wipe(struct weston_animation *animation, + struct weston_output *output, uint32_t msecs) +{ + struct uifw_win_surface *usurf; + struct weston_surface *es; + int par; + int x; + int y; + int width; + int height; + + usurf = container_of(animation, struct uifw_win_surface, animation.animation); + + par = animation_cont(animation, output, msecs); + if (par > 0) { + /* continue animation */ + if( par <= 100) { + weston_compositor_schedule_repaint(weston_ec); + } + return; + } + par = usurf->animation.current; + + uifw_trace("animation_wipe: %08x count=%d %d%% anima=%d state=%d", + usurf->surfaceid, animation->frame_counter, par, + usurf->animation.anima, usurf->animation.state); + + es = usurf->surface; + x = usurf->x; + y = usurf->y; + width = usurf->width; + height = usurf->width; + + if (par < 100) { + switch (usurf->animation.anima) { + case ANIMA_WIPE_TORIGHT: /* wipe in left to right */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* wipe in left to right */ + width = ((float)width) * ((float)par + 5.0f) / 105.0f; + } + else { + /* wipe out right to left */ + width = width - (((float)width) * ((float)par + 5.0f) / 105.0f); + } + if (width <= 0) width = 1; + break; + case ANIMA_WIPE_TOLEFT: /* wipe in right to left */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* wipe in right to left */ + width = ((float)width) * ((float)par + 5.0f) / 105.0f; + } + else { + /* wipe out left to right */ + width = width - (((float)width) * ((float)par + 5.0f) / 105.0f); + } + if (width <= 0) width = 1; + x = x + (usurf->width - width); + break; + case ANIMA_WIPE_TOBOTTOM: /* wipe in top to bottom */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* wipe in top to bottom */ + height = ((float)height) * ((float)par + 5.0f) / 105.0f; + } + else { + /* wipe out bottom to top */ + height = height - (((float)height) * ((float)par + 5.0f) / 105.0f); + } + if (height <= 0) height = 1; + break; + default: /*ANIMA_WIPE_TOTOP*/ /* wipe in bottom to top */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* wipe in bottom to top */ + height = ((float)height) * ((float)par + 5.0f) / 105.0f; + } + else { + /* wipe out top to bottom */ + height = height - (((float)height) * ((float)par + 5.0f) / 105.0f); + } + if (height <= 0) height = 1; + y = y + (usurf->height - height); + break; + } + } + + es->geometry.x = usurf->node_tbl->disp_x + x; + es->geometry.y = usurf->node_tbl->disp_y + y; + es->geometry.width = width; + es->geometry.height = height; + if ((es->output) && (es->buffer_ref.buffer)) { + weston_surface_geometry_dirty(es); + weston_surface_damage(es); + } + if (par >= 100) { + /* end of animation */ + animation_end(usurf, 1); + uifw_trace("animation_wipe: End of animation"); + } + else { + /* continue animation */ + weston_compositor_schedule_repaint(weston_ec); + } +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief animation_swing: swing animation + * + * @param[in] animation weston animation table + * @param[in] outout weston output table + * @param[in] mseces current time(unused) + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +animation_swing(struct weston_animation *animation, + struct weston_output *output, uint32_t msecs) +{ + struct uifw_win_surface *usurf; + struct weston_surface *es; + struct animation_data *animadata; + int par; + int x; + int y; + float scalex; + float scaley; + + usurf = container_of(animation, struct uifw_win_surface, animation.animation); + + par = animation_cont(animation, output, msecs); + if (par > 0) { + /* continue animation */ + if( par <= 100) { + weston_compositor_schedule_repaint(weston_ec); + } + return; + } + + uifw_trace("animation_swing: %08x count=%d %d%% anima=%d state=%d", + usurf->surfaceid, animation->frame_counter, par, + usurf->animation.anima, usurf->animation.state); + + animadata = (struct animation_data *)usurf->animation.animadata; + es = usurf->surface; + par = usurf->animation.current; + if (animation->frame_counter == 1) { + 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_swing_end; + } + + x = usurf->x; + y = usurf->y; + scalex = 1.0; + scaley = 1.0; + + if (par < 100) { + switch (usurf->animation.anima) { + case ANIMA_SWING_TORIGHT: /* swing in left to right */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* swing in left to right */ + scalex = ((float)par + 5.0f) / 105.0f; + } + else { + /* swing out right to left */ + scalex = 1.0 - (((float)par + 5.0f) / 105.0f); + } + if (scalex <= 0.0) scalex = 0.01; + break; + case ANIMA_SWING_TOLEFT: /* seing in right to left */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* swing in right to left */ + scalex = ((float)par + 5.0f) / 105.0f; + } + else { + /* swing out left to right */ + scalex = 1.0 - (((float)par + 5.0f) / 105.0f); + } + if (scalex <= 0.0) scalex = 0.01; + x = x + (int)((float)usurf->width * (1.0f - scalex)); + break; + case ANIMA_SWING_TOBOTTOM: /* swing in top to bottom */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* swing in top to bottom */ + scaley = ((float)par + 5.0f) / 105.0f; + } + else { + /* swing out bottom to top */ + scalex = 1.0 - (((float)par + 5.0f) / 105.0f); + } + if (scaley <= 0.0) scaley = 0.01; + break; + default: /*ANIMA_SWING*/ /* swing in bottom to top */ + if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) { + /* wipe in bottom to top */ + scaley = ((float)par + 5.0f) / 105.0f; + } + else { + /* wipe out top to bottom */ + scalex = 1.0 - (((float)par + 5.0f) / 105.0f); + } + if (scaley <= 0.0) scaley = 0.01; + y = y + (int)((float)usurf->height * (1.0f - scaley)); + break; + } + } + + es->geometry.x = usurf->node_tbl->disp_x + x; + es->geometry.y = usurf->node_tbl->disp_y + y; + weston_matrix_init(&animadata->transform.matrix); + weston_matrix_translate(&animadata->transform.matrix, + -0.5f * usurf->width, -0.5f * usurf->height, 0); + weston_matrix_scale(&animadata->transform.matrix, scalex, scaley, 1.0f); + weston_matrix_translate(&animadata->transform.matrix, + 0.5f * usurf->width, 0.5f * usurf->height, 0); + + if ((es->output) && (es->buffer_ref.buffer)) { + weston_surface_geometry_dirty(es); + weston_surface_damage(es); + } + if (par >= 100) { + /* end of animation */ + animation_end(usurf, 1); + uifw_trace("animation_swing: End of animation"); + } + else { + /* continue animation */ + weston_compositor_schedule_repaint(weston_ec); + } +} + +/*--------------------------------------------------------------------------*/ +/** + * @brief animation_swing_end: swing animation end + * + * @param[in] animation weston animation table + * @return none + */ +/*--------------------------------------------------------------------------*/ +static void +animation_swing_end(struct weston_animation *animation) +{ + struct uifw_win_surface *usurf; + struct weston_surface *es; + + usurf = container_of(animation, struct uifw_win_surface, animation.animation); + if (usurf && usurf->surface) { + es = usurf->surface; + es->alpha = 1.0; + + if ((es->output) && (es->buffer_ref.buffer)) { + weston_surface_damage(es); + } + } +} + +/*--------------------------------------------------------------------------*/ +/** * @brief animation_fade: fade animation * * @param[in] animation weston animation table @@ -636,8 +943,8 @@ animation_fade(struct weston_animation *animation, if (es->alpha < 0.0) es->alpha = 0.0; else if (es->alpha > 1.0) es->alpha = 1.0; - uifw_trace("animation_fade: usurf=%08x count=%d %d%% alpha=%1.2f anima=%d state=%d", - (int)usurf, animation->frame_counter, par, es->alpha, + uifw_trace("animation_fade: %08x count=%d %d%% alpha=%1.2f anima=%d state=%d", + usurf->surfaceid, animation->frame_counter, par, es->alpha, usurf->animation.anima, usurf->animation.state); if ((es->output) && (es->buffer_ref.buffer) && @@ -764,8 +1071,8 @@ animation_zoom(struct weston_animation *animation, + (((float)usurf->width * scalex) - (float)usurf->width) / 2.0f; y = (((float)usurf->animation.pos_y) - ((float)usurf->y)) * fp + (float)usurf->y + (((float)usurf->height * scaley) - (float) usurf->height) / 2.0f; - uifw_trace("animation_zoom: usurf=%08x %d%% x=%d/%d y=%d/%d", - (int)usurf, par, x, usurf->x, y, usurf->y); + uifw_trace("animation_zoom: %08x %d%% x=%d/%d y=%d/%d", + usurf->surfaceid, par, x, usurf->x, y, usurf->y); uifw_trace("animation_zoom: sx=%4.2f sy=%4.2f x=%d->%d y=%d->%d cur=%d,%d", scalex, scaley, usurf->animation.pos_x, usurf->x, usurf->animation.pos_y, usurf->y, x, y); @@ -777,9 +1084,9 @@ animation_zoom(struct weston_animation *animation, weston_matrix_scale(&animadata->transform.matrix, scalex, scaley, 1.0f); weston_matrix_translate(&animadata->transform.matrix, 0.5f * usurf->width, 0.5f * usurf->height, 0); - - uifw_trace("animation_zoom: usurf=%08x count=%d %d%% w=%d/%d h=%d/%d anima=%d state=%d", - (int)usurf, animation->frame_counter, par, + + uifw_trace("animation_zoom: %08x count=%d %d%% w=%d/%d h=%d/%d anima=%d state=%d", + usurf->surfaceid, animation->frame_counter, par, (int)(usurf->width * scalex), usurf->width, (int)(usurf->height * scaley), usurf->height, usurf->animation.anima, usurf->animation.state); diff --git a/src/ico_window_mgr.c b/src/ico_window_mgr.c index 608f842..0e6c811 100644 --- a/src/ico_window_mgr.c +++ b/src/ico_window_mgr.c @@ -68,12 +68,14 @@ /* show/hide animation with position */ #define ICO_WINDOW_MGR_ANIMATION_POS 0x10000000 -/* wl_drm_buffer (inport from mesa-9.1.3/src/egl/wayland/wayland-drm/wayland-drm.h) */ +/* wl_buffer (inport from wayland-1.2.0/src/wayland-server.h) */ struct uifw_wl_buffer { struct wl_resource resource; int32_t width, height; uint32_t busy_count; }; + +/* wl_drm_buffer (inport from mesa-9.1.3/src/egl/wayland/wayland-drm/wayland-drm.h) */ struct uifw_drm_buffer { struct uifw_wl_buffer buffer; void *drm; /* struct wl_drm */ @@ -517,6 +519,44 @@ ico_window_mgr_get_usurf(const uint32_t surfaceid) /*--------------------------------------------------------------------------*/ /** + * @brief ico_window_mgr_get_usurf_client: find UIFW surface by surface id/or client + * + * @param[in] surfaceid UIFW surface id + * @param[in] client Wayland client + * @return UIFW surface table address + * @retval !=NULL success(surface table address) + * @retval NULL error(surface id or client dose not exist) + */ +/*--------------------------------------------------------------------------*/ +WL_EXPORT struct uifw_win_surface * +ico_window_mgr_get_usurf_client(const uint32_t surfaceid, struct wl_client *client) +{ + struct uifw_win_surface *usurf; + struct uifw_client *uclient; + + if (surfaceid == ICO_WINDOW_MGR_V_MAINSURFACE) { + uclient = find_client_from_client(client); + if (uclient) { + if (&uclient->surface_link != uclient->surface_link.next) { + usurf = container_of(uclient->surface_link.next, + struct uifw_win_surface, client_link); + } + else { + usurf = NULL; + } + } + else { + usurf = NULL; + } + } + else { + usurf = ico_window_mgr_get_usurf(surfaceid); + } + return usurf; +} + +/*--------------------------------------------------------------------------*/ +/** * @brief find_uifw_win_surface_by_ws: find UIFW surface by weston surface * * @param[in] wsurf Weston surface @@ -770,8 +810,6 @@ win_mgr_get_client_appid(struct uifw_client *uclient) int j; char procpath[128]; - uifw_trace("win_mgr_get_client_appid: Enter(pid=%d)", uclient->pid); - memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); i = aul_app_get_appid_bypid(uclient->pid, uclient->appid, ICO_IVI_APPID_LENGTH); uifw_trace("win_mgr_get_client_appid: aul_app_get_appid_bypid ret=%d " @@ -781,11 +819,8 @@ win_mgr_get_client_appid(struct uifw_client *uclient) uclient->fixed_appid = ICO_WINDOW_MGR_APPID_FIXCOUNT; } else { - uclient->fixed_appid ++; /* client dose not exist in AppCore, search Linux process table */ - uifw_trace("win_mgr_get_client_appid: pid=%d dose not exist in AppCore(AUL)", - uclient->pid); - + uclient->fixed_appid ++; memset(uclient->appid, 0, ICO_IVI_APPID_LENGTH); snprintf(procpath, sizeof(procpath)-1, "/proc/%d/cmdline", uclient->pid); fd = open(procpath, O_RDONLY); @@ -835,8 +870,6 @@ win_mgr_get_client_appid(struct uifw_client *uclient) sprintf(uclient->appid, "?%d?", uclient->pid); } } - uifw_trace("win_mgr_get_client_appid: Leave(pid=%d,appid=%s)", - uclient->pid, uclient->appid); } /*--------------------------------------------------------------------------*/ @@ -1122,8 +1155,8 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc num_visible ++; } else { - new_x = (float)(ICO_IVI_MAX_COORDINATE+1); - new_y = (float)(ICO_IVI_MAX_COORDINATE+1); + new_x = (float)(es->x + es->node_tbl->disp_x + es->xadd); + new_y = (float)(es->y + es->node_tbl->disp_y + es->yadd); } wl_list_insert(wlayer->surface_list.prev, &es->surface->layer_link); if ((new_x != es->surface->geometry.x) || @@ -1133,8 +1166,9 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc weston_surface_damage(es->surface); } #if 0 /* too many debug log */ - uifw_trace("ico_window_mgr_restack_layer: %08x x/y=%d/%d w/h=%d/%d", - es->surfaceid, + uifw_debug("ico_window_mgr_restack_layer:%3d(%d).%08x(%d) " + "x/y=%d/%d w/h=%d/%d", + el->layer, el->visible, es->surfaceid, es->visible, (int)es->surface->geometry.x, (int)es->surface->geometry.y, es->surface->geometry.width, es->surface->geometry.height); #endif @@ -1235,8 +1269,8 @@ win_mgr_set_layer(struct uifw_win_surface *usurf, const uint32_t layer) struct uifw_win_layer *el; struct uifw_win_layer *new_el; - uifw_trace("win_mgr_set_layer: Enter([%08x],%08x,%x)", - (int)usurf, (int)usurf->surface, layer); + uifw_trace("win_mgr_set_layer: Enter(%08x,%08x,%x)", + usurf->surfaceid, (int)usurf->surface, layer); /* check if same layer */ if ((usurf->win_layer != NULL) && (usurf->win_layer->layer == layer)) { @@ -1437,11 +1471,9 @@ uifw_declare_manager(struct wl_client *client, struct wl_resource *resource, int /*--------------------------------------------------------------------------*/ /** - * @brief uifw_set_window_layer: set layer id to surface + * @brief win_mgr_set_layer: set(or change) surface layer * - * @param[in] client Weyland client - * @param[in] resource resource of request - * @param[in] surfaceid UIFW surface id + * @param[in] usurf UIFW surface * @param[in] layer layer id * @return none */ @@ -1450,10 +1482,10 @@ static void uifw_set_window_layer(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceid, uint32_t layer) { - uifw_trace("uifw_set_window_layer: Enter res=%08x surfaceid=%08x layer=%d", - (int)resource, surfaceid, layer); + struct uifw_win_layer *el; + struct uifw_win_layer *new_el; - struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); + struct uifw_win_surface *usurf = ico_window_mgr_get_usurf_client(surfaceid, client); if (! usurf) { uifw_trace("uifw_set_window_layer: Leave(No Surface(id=%08x))", surfaceid); @@ -1464,7 +1496,28 @@ uifw_set_window_layer(struct wl_client *client, struct wl_resource *resource, win_mgr_change_surface(usurf->surface, -1, 1); } - uifw_trace("uifw_set_window_layer: Leave"); + + if (&el->link == &_ico_win_mgr->ivi_layer_list) { + /* layer not exist, create new layer */ + uifw_trace("win_mgr_set_layer: New Layer %d", layer); + new_el = win_mgr_create_layer(usurf, layer); + if (! new_el) { + uifw_trace("win_mgr_set_layer: Leave(No Memory)"); + return; + } + } + else { + uifw_trace("win_mgr_set_layer: Add surface to Layer %d", layer); + wl_list_remove(&usurf->ivi_layer); + wl_list_insert(&el->surface_list, &usurf->ivi_layer); + usurf->win_layer = el; + } + + /* rebild compositor surface list */ + if (usurf->visible) { + ico_window_mgr_restack_layer(usurf, 0); + } + uifw_trace("win_mgr_set_layer: Leave"); } /*--------------------------------------------------------------------------*/ @@ -1489,6 +1542,7 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource, int32_t width, int32_t height, int32_t flags) { struct uifw_client *uclient; + struct uifw_win_surface *usurf; struct weston_surface *es; int op; int retanima; @@ -1496,16 +1550,28 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_set_positionsize: Enter surf=%08x node=%x x/y/w/h=%d/%d/%d/%d flag=%x", surfaceid, node, x, y, width, height, flags); + usurf = ico_window_mgr_get_usurf_client(surfaceid, client); + if (! usurf) { + uifw_trace("uifw_set_positionsize: Leave(surf=%08x NOT Found)", surfaceid); + return; + } + + uclient = find_client_from_client(client); + + usurf->disable = 0; if (((int)node) >= _ico_num_nodes) { uifw_trace("uifw_set_positionsize: node=%d dose not exist(max=%d)", node, _ico_num_nodes); + if ((ico_ivi_debugflag() & ICO_IVI_DEBUG_SHOW_SURFACE) == 0) { + usurf->disable = 1; + } node = 0; } - struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); + usurf->node_tbl = &_ico_node_table[node]; - if (usurf && (usurf->surface)) { + es = usurf->surface; + if (es) { /* weston surface exist */ - usurf->node_tbl = &_ico_node_table[node]; es = usurf->surface; retanima = ICO_WINDOW_MGR_ANIMATION_RET_NOANIMA; @@ -1523,9 +1589,9 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource, return; } - uclient = find_client_from_client(client); if (uclient) { - if (! uclient->manager) uclient = NULL; + if ((surfaceid != ICO_WINDOW_MGR_V_MAINSURFACE) && + (uclient->manager == 0)) uclient = NULL; } if (! uclient) { if ((usurf->width > 0) && (usurf->height > 0)) { @@ -1601,7 +1667,11 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_set_positionsize: Leave(OK,output=%08x)", (int)es->output); } else { - uifw_trace("uifw_set_positionsize: Leave(surf=%08x NOT Found)", surfaceid); + usurf->x = x; + usurf->y = y; + usurf->width = width; + usurf->height = height; + uifw_trace("uifw_set_positionsize: Leave(OK,but no buffer)"); } } @@ -1630,9 +1700,16 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_set_visible: Enter(surf=%08x,%d,%d,%x)", surfaceid, visible, raise, flags); + usurf = ico_window_mgr_get_usurf_client(surfaceid, client); + if ((! usurf) || (! usurf->surface)) { + uifw_trace("uifw_set_visible: Leave(Surface Not Exist)"); + return; + } + uclient = find_client_from_client(client); if (uclient) { - if (! uclient->manager) { + if ((surfaceid != ICO_WINDOW_MGR_V_MAINSURFACE) && + (uclient->manager == 0)) { uifw_trace("uifw_set_visible: Request from App(%s), not Manager", uclient->appid); uclient = NULL; @@ -1645,15 +1722,9 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_set_visible: Request from Unknown App, not Manager"); } - usurf = ico_window_mgr_get_usurf(surfaceid); - - if ((! usurf) || (! usurf->surface)) { - uifw_trace("uifw_set_visible: Leave(Surface Not Exist)"); - return; - } restack = 0; - if (visible == ICO_WINDOW_MGR_VISIBLE_SHOW) { + if ((usurf->disable == 0) && (visible == ICO_WINDOW_MGR_VISIBLE_SHOW)) { if (! usurf->visible) { usurf->visible = 1; @@ -1791,7 +1862,7 @@ uifw_set_animation(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceid, int32_t type, const char *animation, int32_t time) { int animaid; - struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); + struct uifw_win_surface *usurf = ico_window_mgr_get_usurf_client(surfaceid, client); uifw_trace("uifw_set_transition: Enter(surf=%08x,type=%x,anim=%s,time=%d)", surfaceid, type, animation, time); @@ -1870,7 +1941,7 @@ static void uifw_set_attributes(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceid, uint32_t attributes) { - struct uifw_win_surface *usurf = ico_window_mgr_get_usurf(surfaceid); + struct uifw_win_surface *usurf = ico_window_mgr_get_usurf_client(surfaceid, client); uifw_trace("uifw_set_attributes: Enter(surf=%08x,attributes=%x)", surfaceid, attributes); @@ -1915,7 +1986,7 @@ uifw_visible_animation(struct wl_client *client, struct wl_resource *resource, uifw_trace("uifw_visible_animation: Enter(%08x,%d,x/y=%d/%d,w/h=%d/%d)", surfaceid, visible, x, y, width, height); - usurf = ico_window_mgr_get_usurf(surfaceid); + usurf = ico_window_mgr_get_usurf_client(surfaceid, client); if ((! usurf) || (! usurf->surface)) { uifw_trace("uifw_visible_animation: Leave(Surface Not Exist)"); @@ -1957,7 +2028,7 @@ uifw_set_active(struct wl_client *client, struct wl_resource *resource, if ((surfaceid > 0) && ((active & (ICO_WINDOW_MGR_ACTIVE_POINTER|ICO_WINDOW_MGR_ACTIVE_KEYBOARD)) != 0)) { - usurf = ico_window_mgr_get_usurf(surfaceid); + usurf = ico_window_mgr_get_usurf_client(surfaceid, client); } else { usurf = NULL; @@ -2357,7 +2428,7 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource, es = usurf->surface; /* check if buffered */ - if (es == NULL) { + if ((es == NULL) || (es->buffer_ref.buffer == NULL)) { /* surface has no buffer, error */ ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR, surfaceid, 3, 0, 0, 0, 0, 0); @@ -2367,15 +2438,13 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource, /* check buffer type */ gl_state = (struct uifw_gl_surface_state *)es->renderer_state; - if (gl_state) { - if (gl_state->buffer_type == BUFFER_TYPE_SHM) { - /* wl_shm_buffer not support */ - ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR, - surfaceid, 4, 0, 0, 0, 0, 0); - uifw_trace("uifw_map_surface: Leave(surface(%08x) is wl_shm_buffer, " - "not support)", surfaceid); - return; - } + if ((gl_state == NULL) || (gl_state->buffer_type == BUFFER_TYPE_SHM)) { + /* wl_shm_buffer not support */ + ico_window_mgr_send_map_surface(resource, ICO_WINDOW_MGR_MAP_SURFACE_EVENT_ERROR, + surfaceid, 4, 0, 0, 0, 0, 0); + uifw_trace("uifw_map_surface: Leave(surface(%08x) is wl_shm_buffer, " + "not support)", surfaceid); + return; } /* create map table */ @@ -2405,8 +2474,7 @@ uifw_map_surface(struct wl_client *client, struct wl_resource *resource, wl_list_insert(usurf->surf_map.prev, &sm->surf_link); buffer = es->buffer_ref.buffer; - if ((buffer != NULL) && (gl_state != NULL) && - (gl_state->buffer_type == BUFFER_TYPE_EGL)) { + if (gl_state->buffer_type == BUFFER_TYPE_EGL) { sm->width = buffer->width; sm->height = buffer->height; drm_buffer = (struct uifw_drm_buffer *)buffer->legacy_buffer; diff --git a/src/ico_window_mgr.h b/src/ico_window_mgr.h index 551bf28..3add4ad 100644 --- a/src/ico_window_mgr.h +++ b/src/ico_window_mgr.h @@ -113,13 +113,14 @@ struct uifw_win_surface { uint16_t conf_height; /* Height that notified to client */ uint32_t attributes; /* surface attributes */ char winname[ICO_IVI_WINNAME_LENGTH];/* Window name */ + char disable; /* can not display */ char visible; /* visibility */ char raise; /* raise(top of the layer) */ char created; /* sended created event to manager */ char mapped; /* end of map */ char restrain_configure; /* restrant configure event */ char set_transform; /* surface transform flag */ - char res[2]; /* (unused) */ + char res; /* (unused) */ struct _uifw_win_surface_animation { /* wndow animation */ struct weston_animation animation; /* weston animation control */ uint16_t type; /* current animation type */ @@ -204,6 +205,9 @@ void ico_window_mgr_change_surface(struct uifw_win_surface *usurf, struct uifw_client *ico_window_mgr_get_uclient(const char *appid); /* get UIFW surface table */ struct uifw_win_surface *ico_window_mgr_get_usurf(const uint32_t surfaceid); + /* get UIFW surface table */ +struct uifw_win_surface *ico_window_mgr_get_usurf_client(const uint32_t surfaceid, + struct wl_client *client); /* get application surface */ struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *appid, const char *winname); |