summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ico_ivi_shell.c73
-rw-r--r--src/ico_ivi_shell.h3
-rw-r--r--src/ico_window_animation.c22
-rw-r--r--src/ico_window_mgr.c50
-rw-r--r--src/ico_window_mgr.h2
5 files changed, 98 insertions, 52 deletions
diff --git a/src/ico_ivi_shell.c b/src/ico_ivi_shell.c
index c5215f5..fb7a61c 100644
--- a/src/ico_ivi_shell.c
+++ b/src/ico_ivi_shell.c
@@ -913,6 +913,7 @@ map(struct ivi_shell *shell, struct weston_surface *surface,
if ((ico_option_flag() & ICO_OPTION_FLAG_UNVISIBLE) && (shsurf->visible == FALSE)) {
surface->geometry.x = (float)(ICO_IVI_MAX_COORDINATE+1);
surface->geometry.y = (float)(ICO_IVI_MAX_COORDINATE+1);
+ surface->geometry.dirty = 1;
}
switch (surface_type) {
@@ -986,11 +987,7 @@ configure(struct ivi_shell *shell, struct weston_surface *surface,
ivi_shell_surface_configure(shsurf, x, y, width, height);
}
else {
- surface->geometry.x = x;
- surface->geometry.y = y;
- surface->geometry.width = width;
- surface->geometry.height = height;
- surface->geometry.dirty = 1;
+ weston_surface_configure(surface, x, y, width, height);
}
if (surface->output) {
@@ -1017,6 +1014,7 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
struct ivi_shell *shell = shsurf->shell;
int type_changed = 0;
int num_mgr;
+ int dx, dy, dw, dh;
uifw_trace("shell_surface_configure: Enter(surf=%08x out=%08x buf=%08x)",
(int)es, (int)es->output, (int)es->buffer);
@@ -1071,20 +1069,19 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
/* Surface change request from App */
uifw_trace("shell_surface_configure: App request change(sx/sy=%d/%d w/h=%d/%d)",
sx, sy, es->buffer->width, es->buffer->height);
- es->geometry.width = shsurf->geometry_width;
- es->geometry.height = shsurf->geometry_height;
- es->geometry.x = shsurf->geometry_x;
- es->geometry.y = shsurf->geometry_y;
- if (es->geometry.width > es->buffer->width) {
- es->geometry.width = es->buffer->width;
- es->geometry.x = shsurf->geometry_x +
- (shsurf->geometry_width - es->geometry.width)/2;
+ dx = shsurf->geometry_x;
+ dy = shsurf->geometry_y;
+ dw = shsurf->geometry_width;
+ dh = shsurf->geometry_height;
+ if (dw > es->buffer->width) {
+ dw = es->buffer->width;
+ dx = shsurf->geometry_x + (shsurf->geometry_width - dw)/2;
}
- if (es->geometry.height > es->buffer->height) {
- es->geometry.height = es->buffer->height;
- es->geometry.y = shsurf->geometry_y +
- (shsurf->geometry_height - es->geometry.height)/2;
+ if (dh > es->buffer->height) {
+ dh = es->buffer->height;
+ dy = shsurf->geometry_y + (shsurf->geometry_height - dh)/2;
}
+ weston_surface_configure(es, dx, dy, dw, dh);
ivi_shell_surface_configure(shsurf, es->geometry.x, es->geometry.y,
es->geometry.width, es->geometry.height);
uifw_trace("shell_surface_configure: w/h=%d/%d->%d/%d x/y=%d/%d->%d/%d",
@@ -1109,6 +1106,7 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
(shsurf->visible)) {
es->geometry.x = 0;
es->geometry.y = 0;
+ es->geometry.dirty = 1;
}
configure(shell, es,
es->geometry.x + to_x - from_x,
@@ -1284,6 +1282,7 @@ ivi_shell_restack_ivi_layer(struct ivi_shell *shell, struct shell_surface *shsur
weston_surface_damage_below(es->surface);
es->surface->geometry.x = new_x;
es->surface->geometry.y = new_y;
+ es->surface->geometry.dirty = 1;
weston_surface_damage_below(es->surface);
}
}
@@ -1462,12 +1461,28 @@ ivi_shell_restrain_configure(struct shell_surface *shsurf, const int restrain)
shsurf->restrain = restrain;
if (restrain == 0) {
+ shell_surface_configure(shsurf->surface, shsurf->geometry_x, shsurf->geometry_y);
ivi_shell_restack_ivi_layer(shell_surface_get_shell(shsurf), shsurf);
}
}
/*--------------------------------------------------------------------------*/
/**
+ * @brief ivi_shell_set_active: surface active control
+ *
+ * @param[in] shsurf shell surface(if NULL, no active surface)
+ * @param[in] restrain restrain(1)/not restrain(0)
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+WL_EXPORT int
+ivi_shell_is_restrain(struct shell_surface *shsurf)
+{
+ return shsurf->restrain;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief ivi_shell_default_animation: window default animation
*
* @param[out] msec animation time(ms)
@@ -1545,7 +1560,7 @@ click_to_activate_binding(struct wl_seat *seat, uint32_t time, uint32_t button,
* @brief ivi_shell_set_visible: surface visible control
*
* @param[in] shsurf shell surface
- * @param[in] visible visibility(1=visible/0=unvisible)
+ * @param[in] visible visibility(1=visible/0=unvisible/-1=system default)
* @return none
*/
/*--------------------------------------------------------------------------*/
@@ -1776,6 +1791,28 @@ ivi_shell_send_configure(struct shell_surface *shsurf, const int id,
/*--------------------------------------------------------------------------*/
/**
+ * @brief ivi_shell_get_positionsize: get surface position and size
+ *
+ * @param[in] shsurf shell surface
+ * @param[out] x surface upper-left X position on screen
+ * @param[out] y surface upper-left Y position on screen
+ * @param[out] width surface width
+ * @param[out] height surface height
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+WL_EXPORT void
+ivi_shell_get_positionsize(struct shell_surface *shsurf,
+ int *x, int *y, int *width, int *height)
+{
+ *x = shsurf->geometry_x;
+ *y = shsurf->geometry_y;
+ *width = shsurf->geometry_width;
+ *height = shsurf->geometry_height;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief ivi_shell_set_positionsize: set surface position and size
*
* @param[in] shsurf shell surface
diff --git a/src/ico_ivi_shell.h b/src/ico_ivi_shell.h
index 2a8b07d..de629fe 100644
--- a/src/ico_ivi_shell.h
+++ b/src/ico_ivi_shell.h
@@ -48,6 +48,8 @@ void ivi_shell_set_toplevel(struct shell_surface *shsurf);
void ivi_shell_set_surface_type(struct shell_surface *shsurf);
void ivi_shell_send_configure(struct shell_surface *shsurf, const int id,
const int edges, const int width, const int height);
+void ivi_shell_get_positionsize(struct shell_surface *shsurf, int *x,
+ int *y, int *width, int *height);
void ivi_shell_set_positionsize(struct shell_surface *shsurf, const int x,
const int y, const int width, const int height);
void ivi_shell_set_layer_visible(const int layer, const int visible);
@@ -56,6 +58,7 @@ void ivi_shell_surface_configure(struct shell_surface *shsurf, const int x,
void ivi_shell_set_active(struct shell_surface *shsurf, const int target);
void ivi_shell_set_client_attr(struct wl_client *client, const int attr, const int value);
void ivi_shell_restrain_configure(struct shell_surface *shsurf, const int restrain);
+int ivi_shell_is_restrain(struct shell_surface *shsurf);
const char *ivi_shell_default_animation(int *msec, int *fps);
/* Prototypr for hook routine */
diff --git a/src/ico_window_animation.c b/src/ico_window_animation.c
index 8b3960f..a63b647 100644
--- a/src/ico_window_animation.c
+++ b/src/ico_window_animation.c
@@ -108,6 +108,7 @@ ico_window_animation(const int op, void *data)
int ret;
uint32_t nowsec;
struct timeval nowtv;
+ int time;
if (op == ICO_WINDOW_MGR_ANIMATION_TYPE) {
/* convert animation name to animation type value */
@@ -166,10 +167,13 @@ ico_window_animation(const int op, void *data)
(usurf->animation.current > 95)) {
usurf->animation.animation.frame_counter = 1;
usurf->animation.current = 0;
- wl_list_init(&usurf->animation.animation.link);
- output = container_of(weston_ec->output_list.next,
- struct weston_output, link);
- wl_list_insert(output->animation_list.prev, &usurf->animation.animation.link);
+ if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_NONE) {
+ wl_list_init(&usurf->animation.animation.link);
+ output = container_of(weston_ec->output_list.next,
+ struct weston_output, link);
+ wl_list_insert(output->animation_list.prev,
+ &usurf->animation.animation.link);
+ }
}
else if (((usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_IN) &&
(op == ICO_WINDOW_MGR_ANIMATION_OPOUT)) ||
@@ -179,7 +183,8 @@ ico_window_animation(const int op, void *data)
nowsec = (uint32_t)(((long long)nowtv.tv_sec) * 1000L +
((long long)nowtv.tv_usec) / 1000L);
usurf->animation.current = 100 - usurf->animation.current;
- ret = ((usurf->animation.current) * animation_time) / 100;
+ time = (usurf->animation.time > 0) ? usurf->animation.time : animation_time;
+ ret = ((usurf->animation.current) * time) / 100;
if (nowsec >= (uint32_t)ret) {
usurf->animation.starttime = nowsec - ret;
}
@@ -213,7 +218,6 @@ ico_window_animation(const int op, void *data)
}
else if (usurf->animation.type == ANIMA_FADE) {
usurf->animation.animation.frame = animation_fade;
- ivi_shell_restrain_configure(usurf->shsurf, 1);
(*usurf->animation.animation.frame)(&usurf->animation.animation, NULL, 1);
}
else {
@@ -256,6 +260,7 @@ animation_cont(struct weston_animation *animation, struct weston_output *output,
int par;
uint32_t nowsec;
struct timeval nowtv;
+ int time;
gettimeofday(&nowtv, NULL);
nowsec = (uint32_t)(((long long)nowtv.tv_sec) * 1000L +
@@ -299,11 +304,12 @@ animation_cont(struct weston_animation *animation, struct weston_output *output,
nowsec = (uint32_t)(((long long)0x100000000L) +
((long long)nowsec) - ((long long)usurf->animation.starttime));
}
- if (((output == NULL) && (msecs == 0)) || (nowsec >= ((uint32_t)animation_time))) {
+ time = (usurf->animation.time > 0) ? usurf->animation.time : animation_time;
+ if (((output == NULL) && (msecs == 0)) || (nowsec >= ((uint32_t)time))) {
par = 100;
}
else {
- par = (nowsec * 100 + animation_time / 2) / animation_time;
+ par = (nowsec * 100 + time / 2) / time;
if (par < 2) par = 2;
}
if ((par >= 100) ||
diff --git a/src/ico_window_mgr.c b/src/ico_window_mgr.c
index 8fa5065..577911a 100644
--- a/src/ico_window_mgr.c
+++ b/src/ico_window_mgr.c
@@ -147,7 +147,7 @@ static void uifw_set_visible(struct wl_client *client, struct wl_resource *resou
uint32_t surfaceid, int32_t visible, int32_t raise);
/* set surface animation */
static void uifw_set_animation(struct wl_client *client, struct wl_resource *resource,
- uint32_t surfaceid, int32_t change, const char *animation);
+ uint32_t surfaceid, const char *animation, int32_t time);
/* set active surface (form HomeScreen) */
static void uifw_set_active(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceid, uint32_t target);
@@ -731,6 +731,7 @@ win_mgr_map_surface(struct weston_surface *surface, int32_t *width, int32_t *hei
*height = usurf->height;
surface->geometry.x = usurf->x;
surface->geometry.y = usurf->y;
+ surface->geometry.dirty = 1;
}
else {
uifw_trace("win_mgr_map_surface: HomeScreen not regist Surface, "
@@ -747,10 +748,6 @@ win_mgr_map_surface(struct weston_surface *surface, int32_t *width, int32_t *hei
/* HomeScreen exist, coodinate set by HomeScreen */
surface->geometry.x = 0;
surface->geometry.y = 0;
-
- /* change surface size, because HomeScreen change surface size */
- *width = 1;
- *height = 1;
uifw_trace("win_mgr_map_surface: Change size and position");
}
else {
@@ -959,6 +956,7 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
struct uifw_client *uclient;
+ int cx, cy, cwidth, cheight;
uifw_trace("uifw_set_positionsize: Enter res=%08x surf=%08x x/y/w/h=%d/%d/%d/%d",
(int)resource, surfaceid, x, y, width, height);
@@ -970,15 +968,14 @@ uifw_set_positionsize(struct wl_client *client, struct wl_resource *resource,
struct weston_surface *es = usurf->surface;
/* if x,y,width,height bigger then ICO_IVI_MAX_COORDINATE, no change */
- if (x > ICO_IVI_MAX_COORDINATE) x = usurf->x;
- if (y > ICO_IVI_MAX_COORDINATE) y = usurf->y;
- if (width > ICO_IVI_MAX_COORDINATE) width = usurf->width;
- if (height > ICO_IVI_MAX_COORDINATE) height = usurf->height;
+ ivi_shell_get_positionsize(usurf->shsurf, &cx, &cy, &cwidth, &cheight);
+ if (x > ICO_IVI_MAX_COORDINATE) x = cx;
+ if (y > ICO_IVI_MAX_COORDINATE) y = cy;
+ if (width > ICO_IVI_MAX_COORDINATE) width = cwidth;
+ if (height > ICO_IVI_MAX_COORDINATE) height = cheight;
/* check animation */
- if ((usurf->animation.type != ICO_WINDOW_MGR_ANIMATION_NONE) &&
- (usurf->animation.state != ICO_WINDOW_MGR_ANIMATION_STATE_NONE) &&
- (win_mgr_hook_animation != NULL) &&
+ if ((ivi_shell_is_restrain(usurf->shsurf)) &&
(x == usurf->x) && (y == usurf->y) &&
(width == usurf->width) && (height == usurf->height)) {
uifw_trace("uifw_set_positionsize: Leave(same position size at animation)");
@@ -1080,7 +1077,8 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
}
if ((visible == ICO_WINDOW_MGR_VISIBLE_SHOW) ||
- (visible == ICO_WINDOW_MGR_VISIBLE_SHOW_WO_ANIMATION)) {
+ (visible == ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION)) {
+
if ((usurf->width <= 0) || (usurf->height <= 0)) {
/* not declare surface geometry, initialize */
usurf->width = usurf->surface->geometry.width;
@@ -1103,7 +1101,7 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
uifw_set_weston_surface(usurf);
ivi_shell_set_surface_type(usurf->shsurf);
- if ((visible == ICO_WINDOW_MGR_VISIBLE_SHOW) &&
+ if ((visible == ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION) &&
(usurf->animation.type != ICO_WINDOW_MGR_ANIMATION_NONE) &&
(win_mgr_hook_animation != NULL)) {
animation = (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_OPIN,
@@ -1117,7 +1115,7 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
}
}
else if ((visible == ICO_WINDOW_MGR_VISIBLE_HIDE) ||
- (visible == ICO_WINDOW_MGR_VISIBLE_HIDE_WO_ANIMATION)) {
+ (visible == ICO_WINDOW_MGR_VISIBLE_HIDE_ANIMATION)) {
if (ivi_shell_is_visible(usurf->shsurf)) {
@@ -1125,7 +1123,7 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
uifw_set_weston_surface(usurf);
animation = ICO_WINDOW_MGR_ANIMATION_RET_ANIMA;
- if ((visible == ICO_WINDOW_MGR_VISIBLE_HIDE) &&
+ if ((visible == ICO_WINDOW_MGR_VISIBLE_HIDE_ANIMATION) &&
(usurf->animation.type > 0) &&
(win_mgr_hook_animation != NULL)) {
animation = (*win_mgr_hook_animation)(ICO_WINDOW_MGR_ANIMATION_OPOUT,
@@ -1165,9 +1163,9 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
ico_win_mgr_send_to_mgr(ICO_WINDOW_MGR_WINDOW_VISIBLE,
surfaceid, NULL,
(visible == ICO_WINDOW_MGR_VISIBLE_SHOW) ||
- (visible == ICO_WINDOW_MGR_VISIBLE_SHOW_WO_ANIMATION) ? 1 :
+ (visible == ICO_WINDOW_MGR_VISIBLE_SHOW_ANIMATION) ? 1 :
((visible == ICO_WINDOW_MGR_VISIBLE_HIDE) ||
- (visible == ICO_WINDOW_MGR_VISIBLE_HIDE_WO_ANIMATION) ? 0 :
+ (visible == ICO_WINDOW_MGR_VISIBLE_HIDE_ANIMATION) ? 0 :
ICO_WINDOW_MGR_VISIBLE_NOCHANGE),
raise, uclient ? 0 : 1, 0,0,0);
@@ -1181,31 +1179,31 @@ uifw_set_visible(struct wl_client *client, struct wl_resource *resource,
* @param[in] client Weyland client
* @param[in] resource resource of request
* @param[in] surfaceid UIFW surface id
- * @param[in] change change type(show/hide,reeize,move)
* @param[in] anmation animation name
+ * @param[in] time animation time(ms), if 0, default time
* @return none
*/
/*--------------------------------------------------------------------------*/
static void
uifw_set_animation(struct wl_client *client, struct wl_resource *resource,
- uint32_t surfaceid, int32_t change, const char *animation)
+ uint32_t surfaceid, const char *animation, int time)
{
struct uifw_win_surface* usurf = find_uifw_win_surface_by_id(surfaceid);
- uifw_trace("uifw_set_transition: Enter(surf=%08x, change=%d, animation=%s)",
- surfaceid, change, animation);
+ uifw_trace("uifw_set_transition: Enter(surf=%08x, animation=%s, time=%d)",
+ surfaceid, animation, time);
if (usurf) {
- if (change != ICO_WINDOW_MGR_ANIMATION_CHANGE_VISIBLE) {
- uifw_trace("uifw_set_animation: Leave(change type(%d9 not support)", change);
- }
- else {
+ if ((*animation != 0) && (*animation != ' ')) {
usurf->animation.type_next = ico_get_animation_type(animation);
uifw_trace("uifw_set_animation: Leave(OK) type=%d", usurf->animation.type_next);
if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_NONE) {
usurf->animation.type = usurf->animation.type_next;
}
}
+ if (time > 0) {
+ usurf->animation.time = time;
+ }
}
else {
uifw_trace("uifw_set_animation: Leave(Surface(%08x) Not exist)", surfaceid);
diff --git a/src/ico_window_mgr.h b/src/ico_window_mgr.h
index 62f73f2..c098d94 100644
--- a/src/ico_window_mgr.h
+++ b/src/ico_window_mgr.h
@@ -58,9 +58,11 @@ struct uifw_win_surface {
struct weston_animation animation; /* animation control */
short type; /* animation type */
short type_next; /* next animation type */
+ short time; /* animation time */
short current; /* animation current percentage */
char state; /* animation state */
char visible; /* need visible(1)/hide(2) at end of animation*/
+ char res[2]; /* (unused) */
uint32_t starttime; /* start time(ms) */
} animation;
void *animadata; /* animation data */