summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>2013-10-03 10:54:37 +0900
committerHayato Nakamura <hayato.nakamura@mail.toyota-td.jp>2013-10-03 10:54:37 +0900
commite54b6d90ab34953e2e3bfdcd7ae4803002cb983f (patch)
tree5539caf411cacc14aa36b3f5da3824f88ebc1ef3
parent966005bb288bee88c44760890a1de14e282276ba (diff)
downloadico-uxf-weston-plugin-e54b6d90ab34953e2e3bfdcd7ae4803002cb983f.tar.gz
ico-uxf-weston-plugin-e54b6d90ab34953e2e3bfdcd7ae4803002cb983f.tar.bz2
ico-uxf-weston-plugin-e54b6d90ab34953e2e3bfdcd7ae4803002cb983f.zip
Change-Id: I14aaf988fd97b8e83ae0cdc21c8c225e14f30f40 Signed-off-by: Hayato Nakamura <hayato.nakamura@mail.toyota-td.jp>
-rw-r--r--src/ico_input_mgr.c303
-rw-r--r--src/ico_window_animation.c16
-rw-r--r--src/ico_window_mgr.c79
-rw-r--r--src/ico_window_mgr.h7
-rw-r--r--tests/test-homescreen.c4
-rw-r--r--tests/testdata/hs_inputregion.dat24
6 files changed, 401 insertions, 32 deletions
diff --git a/src/ico_input_mgr.c b/src/ico_input_mgr.c
index 64ac83b..3aaea7f 100644
--- a/src/ico_input_mgr.c
+++ b/src/ico_input_mgr.c
@@ -54,12 +54,15 @@
#define ICO_MINPUT_MAX_CODES 20
/* structure definition */
+struct uifw_region_mng;
+
/* working table of Multi Input Manager */
struct ico_input_mgr {
struct weston_compositor *compositor; /* Weston Compositor */
struct wl_list ictl_list; /* Input Controller List */
struct wl_list app_list; /* application List */
struct wl_list dev_list; /* pseudo device List */
+ struct wl_list free_region; /* free input region table list */
struct weston_seat *seat; /* input seat */
struct wl_resource *inputmgr;
};
@@ -84,7 +87,7 @@ struct ico_ictl_input {
struct ico_ictl_mgr {
struct wl_list link; /* link */
struct wl_client *client; /* client */
- struct wl_resource *resource; /* resource */
+ struct wl_resource *mgr_resource; /* resource as manager */
char device[ICO_MINPUT_DEVICE_LEN]; /* device name */
int type; /* device type */
struct wl_list ico_ictl_input; /* list of input switchs */
@@ -124,6 +127,12 @@ struct uifw_input_device {
char res[2]; /* (unused) */
};
+/* Input Region Table */
+struct uifw_region_mng {
+ struct wl_list link; /* link pointer */
+ struct ico_uifw_input_region region; /* input region */
+};
+
/* prototype of static function */
/* bind input manager form manager */
static void ico_control_bind(struct wl_client *client, void *data,
@@ -185,6 +194,7 @@ static void ico_device_configure_code(struct wl_client *client,
static void ico_device_input_event(struct wl_client *client, struct wl_resource *resource,
uint32_t time, const char *device,
int32_t input, int32_t code, int32_t state);
+static void ico_input_send_region_event(struct wl_array *array);
/* definition of Wayland protocol */
/* Input Manager Control interface */
@@ -753,10 +763,78 @@ ico_mgr_set_input_region(struct wl_client *client, struct wl_resource *resource,
int32_t hotspot_y, int32_t cursor_x, int32_t cursor_y,
int32_t cursor_width, int32_t cursor_height, uint32_t attr)
{
+ struct uifw_win_surface *usurf; /* UIFW surface */
+ struct uifw_region_mng *p;
+ struct ico_uifw_input_region *rp;
+ struct wl_array array;
+ int i;
+
uifw_trace("ico_mgr_set_input_region: Enter(%s %d/%d-%d/%d(%d/%d) %d/%d-%d/%d)",
target, x, y, width, height, hotspot_x, hotspot_y,
cursor_x, cursor_y, cursor_width, cursor_height);
+ /* get target surface */
+ usurf = ico_window_mgr_get_client_usurf(target);
+ if (! usurf) {
+ uifw_warn("ico_mgr_set_input_region: Leave(target<%s> dose not exist)", target);
+ return;
+ }
+
+ if (wl_list_empty(&pInputMgr->free_region)) {
+ p = malloc(sizeof(struct uifw_region_mng)*50);
+ if (! p) {
+ uifw_error("ico_mgr_set_input_region: No Memory");
+ return;
+ }
+ memset(p, 0, sizeof(struct uifw_region_mng)*50);
+ for (i = 0; i < 50; i++, p++) {
+ wl_list_insert(pInputMgr->free_region.prev, &p->link);
+ }
+ }
+ p = container_of(pInputMgr->free_region.next, struct uifw_region_mng, link);
+ wl_list_remove(&p->link);
+ p->region.node = usurf->node_tbl->node;
+ p->region.surfaceid = usurf->surfaceid;
+ p->region.surface_x = usurf->x;
+ p->region.surface_y = usurf->y;
+ p->region.x = x;
+ p->region.y = y;
+ p->region.width = width;
+ p->region.height = height;
+ if ((hotspot_x <= 0) && (hotspot_y <= 0)) {
+ p->region.hotspot_x = width / 2;
+ p->region.hotspot_y = height / 2;
+ }
+ else {
+ p->region.hotspot_x = hotspot_x;
+ p->region.hotspot_y = hotspot_y;
+ }
+ if ((cursor_width <= 0) && (cursor_height <= 0)) {
+ p->region.cursor_x = x;
+ p->region.cursor_y = y;
+ p->region.cursor_width = width;
+ p->region.cursor_height = height;
+ }
+ else {
+ p->region.cursor_x = cursor_x;
+ p->region.cursor_y = cursor_y;
+ p->region.cursor_width = cursor_width;
+ p->region.cursor_height = cursor_height;
+ }
+ p->region.change = ico_window_mgr_is_visible(usurf);
+ wl_list_insert(usurf->input_region.prev, &p->link);
+
+ /* send input region to haptic device input controller */
+ if (p->region.change > 0) {
+ wl_array_init(&array);
+ rp = (struct ico_uifw_input_region *)
+ wl_array_add(&array, sizeof(struct ico_uifw_input_region));
+ if (rp) {
+ memcpy(rp, &p->region, sizeof(struct ico_uifw_input_region));
+ rp->change = ICO_INPUT_MGR_DEVICE_REGION_ADD;
+ ico_input_send_region_event(&array);
+ }
+ }
uifw_trace("ico_mgr_set_input_region: Leave");
}
@@ -779,14 +857,175 @@ ico_mgr_unset_input_region(struct wl_client *client, struct wl_resource *resourc
const char *target, int32_t x, int32_t y,
int32_t width, int32_t height)
{
+ struct uifw_win_surface *usurf; /* UIFW surface */
+ struct uifw_region_mng *p; /* input region mamagement table*/
+ struct uifw_region_mng *np; /* next region mamagement table */
+ struct ico_uifw_input_region *rp; /* input region */
+ struct wl_array array;
+ int alldel;
+ int delcount = 0;
+
uifw_trace("ico_mgr_unset_input_region: Enter(%s %d/%d-%d/%d)",
target, x, y, width, height);
+ /* get target surface */
+ usurf = ico_window_mgr_get_client_usurf(target);
+ if (! usurf) {
+ uifw_warn("ico_mgr_unset_input_region: Leave(target<%s> dose not exist)", target);
+ return;
+ }
+
+ if ((x <= 0) && (y <= 0) && (width <= 0) && (height <= 0)) {
+ alldel = 1;
+ }
+ else {
+ alldel = 0;
+ }
+
+ wl_array_init(&array);
+
+ wl_list_for_each_safe(p, np, &usurf->input_region, link) {
+ if ((alldel != 0) ||
+ ((x == p->region.x) && (y == p->region.y) &&
+ (width == p->region.width) && (height == p->region.height))) {
+ if (p->region.change > 0) {
+ /* visible, send remove event */
+ rp = (struct ico_uifw_input_region *)
+ wl_array_add(&array, sizeof(struct ico_uifw_input_region));
+ if (rp) {
+ delcount ++;
+ memcpy(rp, &p->region, sizeof(struct ico_uifw_input_region));
+ rp->change = ICO_INPUT_MGR_DEVICE_REGION_REMOVE;
+ }
+ }
+ wl_list_remove(&p->link);
+ wl_list_insert(pInputMgr->free_region.prev, &p->link);
+ }
+ }
+ if (delcount > 0) {
+ /* send region delete to haptic device input controller */
+ ico_input_send_region_event(&array);
+ }
uifw_trace("ico_mgr_unset_input_region: Leave");
}
/*--------------------------------------------------------------------------*/
/**
+ * @brief ico_input_hook_region_visible: change surface visibility
+ *
+ * @param[in] usurf UIFW surface
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_input_hook_region_visible(struct uifw_win_surface *usurf)
+{
+ struct uifw_region_mng *p; /* input region mamagement table*/
+ struct ico_uifw_input_region *rp; /* input region */
+ struct wl_array array;
+ int chgcount = 0;
+ int visible;
+
+ visible = ico_window_mgr_is_visible(usurf);
+
+ uifw_trace("ico_input_hook_region_visible: Entery(surf=%08x, visible=%d)",
+ usurf->surfaceid, visible);
+
+ wl_array_init(&array);
+
+ wl_list_for_each(p, &usurf->input_region, link) {
+ if (((p->region.change > 0) && (visible <= 0)) ||
+ ((p->region.change <= 0) && (visible > 0))) {
+ /* visible change, send remove event */
+ rp = (struct ico_uifw_input_region *)
+ wl_array_add(&array, sizeof(struct ico_uifw_input_region));
+ if (rp) {
+ chgcount ++;
+ memcpy(rp, &p->region, sizeof(struct ico_uifw_input_region));
+ if (visible > 0) {
+ rp->change = ICO_INPUT_MGR_DEVICE_REGION_ADD;
+ }
+ else {
+ rp->change = ICO_INPUT_MGR_DEVICE_REGION_REMOVE;
+ }
+ }
+ }
+ p->region.change = visible;
+ }
+ if (chgcount > 0) {
+ /* send region delete to haptic device input controller */
+ ico_input_send_region_event(&array);
+ }
+
+ uifw_trace("ico_input_hook_region_visible: Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief ico_input_hook_region_destroy: destory surface
+ *
+ * @param[in] usurf UIFW surface
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_input_hook_region_destroy(struct uifw_win_surface *usurf)
+{
+ struct uifw_region_mng *p; /* input region mamagement table*/
+ struct uifw_region_mng *np; /* next region mamagement table */
+ struct ico_uifw_input_region *rp; /* input region */
+ struct wl_array array;
+ int delcount = 0;
+
+ uifw_trace("ico_input_hook_region_destroy: Entery(surf=%08x)", usurf->surfaceid);
+
+ wl_array_init(&array);
+
+ wl_list_for_each_safe(p, np, &usurf->input_region, link) {
+ if (p->region.change > 0) {
+ /* visible, send remove event */
+ rp = (struct ico_uifw_input_region *)
+ wl_array_add(&array, sizeof(struct ico_uifw_input_region));
+ if (rp) {
+ delcount ++;
+ memcpy(rp, &p->region, sizeof(struct ico_uifw_input_region));
+ rp->change = ICO_INPUT_MGR_DEVICE_REGION_REMOVE;
+ }
+ }
+ wl_list_remove(&p->link);
+ wl_list_insert(pInputMgr->free_region.prev, &p->link);
+ }
+ if (delcount > 0) {
+ /* send region delete to haptic device input controller */
+ ico_input_send_region_event(&array);
+ }
+ uifw_trace("ico_input_hook_region_destroy: Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief ico_input_send_region_event: send region event to Haptic dic
+ *
+ * @param[in] usurf UIFW surface
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+static void
+ico_input_send_region_event(struct wl_array *array)
+{
+ struct ico_ictl_mgr *pIctlMgr;
+
+ wl_list_for_each (pIctlMgr, &pInputMgr->ictl_list, link) {
+ if ((pIctlMgr->type == ICO_INPUT_MGR_DEVICE_TYPE_HAPTIC) &&
+ (pIctlMgr->mgr_resource != NULL)) {
+ uifw_trace("ico_input_send_region_event: send event to Hapfic");
+ ico_input_mgr_device_send_input_regions(pIctlMgr->mgr_resource, array);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief ico_device_configure_input: configure input device and input switch
* from Device Input Controller.
*
@@ -816,23 +1055,21 @@ ico_device_configure_input(struct wl_client *client, struct wl_resource *resourc
pIctlMgr = find_ictlmgr_by_device(device);
if (! pIctlMgr) {
- /* create ictl mgr table */
- pIctlMgr = (struct ico_ictl_mgr *)malloc(sizeof(struct ico_ictl_mgr));
- if (pIctlMgr == NULL) {
- uifw_error("ico_device_configure_input: Leave(No Memory)");
+ /* search binded table */
+ wl_list_for_each (pIctlMgr, &pInputMgr->ictl_list, link) {
+ if (pIctlMgr->client == client) {
+ uifw_trace("ico_device_configure_input: setup pIctlMgr(mgr=%08x,input=%d)",
+ (int)pIctlMgr, input);
+ strncpy(pIctlMgr->device, device, sizeof(pIctlMgr->device)-1);
+ break;
+ }
+ }
+ if (&pIctlMgr->link == &pInputMgr->ictl_list) {
+ uifw_error("ico_device_configure_input: Leave(not found client)");
return;
}
- uifw_trace("ico_device_configure_input: create pIctlMgr(mgr=%08x,input=%d)",
- (int)pIctlMgr, input);
- memset(pIctlMgr, 0, sizeof(struct ico_ictl_mgr));
- wl_list_init(&pIctlMgr->ico_ictl_input);
- strncpy(pIctlMgr->device, device, sizeof(pIctlMgr->device)-1);
-
- /* add list */
- wl_list_insert(pInputMgr->ictl_list.prev, &pIctlMgr->link);
}
- pIctlMgr->client = client;
- pIctlMgr->resource = resource;
+
if (type) {
pIctlMgr->type = type;
}
@@ -1077,7 +1314,7 @@ ico_control_bind(struct wl_client *client, void *data, uint32_t version, uint32_
static void
ico_control_unbind(struct wl_resource *resource)
{
- struct ico_app_mgr *pAppMgr;
+ struct ico_app_mgr *pAppMgr;
uifw_trace("ico_control_unbind: Enter(resource=%08x)", (int)resource);
@@ -1105,14 +1342,29 @@ ico_control_unbind(struct wl_resource *resource)
static void
ico_device_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
- struct wl_resource *mgr_resource;
+ struct ico_ictl_mgr *pIctlMgr;
+ struct wl_resource *mgr_resource;
uifw_trace("ico_device_bind: Enter(client=%08x)", (int)client);
+ /* create ictl mgr table */
+ pIctlMgr = (struct ico_ictl_mgr *)malloc(sizeof(struct ico_ictl_mgr));
+ if (pIctlMgr == NULL) {
+ uifw_error("ico_device_bind: Leave(No Memory)");
+ return;
+ }
+ memset(pIctlMgr, 0, sizeof(struct ico_ictl_mgr));
+ wl_list_init(&pIctlMgr->ico_ictl_input);
+ pIctlMgr->client = client;
+
+ /* add list */
+ wl_list_insert(pInputMgr->ictl_list.prev, &pIctlMgr->link);
+
mgr_resource = wl_resource_create(client, &ico_input_mgr_device_interface, 1, id);
if (mgr_resource) {
+ pIctlMgr->mgr_resource = mgr_resource;
wl_resource_set_implementation(mgr_resource, &input_mgr_ictl_implementation,
- pInputMgr, ico_device_unbind);
+ pIctlMgr, ico_device_unbind);
}
uifw_trace("ico_device_bind: Leave");
}
@@ -1355,6 +1607,9 @@ find_app_by_appid(const char *appid)
WL_EXPORT int
module_init(struct weston_compositor *ec, int *argc, char *argv[])
{
+ struct uifw_region_mng *p;
+ int i;
+
uifw_info("ico_input_mgr: Enter(module_init)");
/* initialize management table */
@@ -1391,10 +1646,22 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[])
wl_list_init(&pInputMgr->ictl_list);
wl_list_init(&pInputMgr->app_list);
wl_list_init(&pInputMgr->dev_list);
+ wl_list_init(&pInputMgr->free_region);
+ p = malloc(sizeof(struct uifw_region_mng)*100);
+ if (p) {
+ memset(p, 0, sizeof(struct uifw_region_mng)*100);
+ for (i = 0; i < 100; i++, p++) {
+ wl_list_insert(pInputMgr->free_region.prev, &p->link);
+ }
+ }
/* found input seat */
pInputMgr->seat = container_of(ec->seat_list.next, struct weston_seat, link);
+ /* set hook for input region control */
+ ico_window_mgr_set_hook_visible(ico_input_hook_region_visible);
+ ico_window_mgr_set_hook_destory(ico_input_hook_region_destroy);
+
uifw_info("ico_input_mgr: Leave(module_init)");
return 0;
}
diff --git a/src/ico_window_animation.c b/src/ico_window_animation.c
index a5f497d..5db60eb 100644
--- a/src/ico_window_animation.c
+++ b/src/ico_window_animation.c
@@ -79,6 +79,7 @@ static struct weston_compositor *weston_ec; /* Weston compositor
static char *default_animation; /* default animation name */
static int animation_fps; /* animation frame rate(frame/sec) */
static int animation_time; /* default animation time(ms) */
+static int animation_count; /* current number of animations */
static struct animation_data *free_data; /* free data list */
/* support animation names */
@@ -206,6 +207,7 @@ ico_window_animation(const int op, void *data)
struct weston_output, link);
wl_list_insert(output->animation_list.prev,
&usurf->animation.animation.link);
+ animation_count ++;
}
}
else if (((usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) &&
@@ -399,7 +401,8 @@ animation_cont(struct weston_animation *animation, struct weston_output *output,
}
if ((par >= 100) ||
(abs(usurf->animation.current - par) >=
- (((1000 * 100) / animation_fps) / usurf->animation.time))) {
+ (((1000 * 100) / animation_fps) / usurf->animation.time)) ||
+ ((animation_count > 1) && (par != usurf->animation.current))) {
usurf->animation.current = par;
return 0;
}
@@ -423,6 +426,10 @@ animation_end(struct uifw_win_surface *usurf, const int disp)
usurf->animation.state = ICO_WINDOW_MGR_ANIMATION_STATE_NONE;
animadata = (struct animation_data *)usurf->animation.animadata;
+ if (animation_count > 0) {
+ animation_count --;
+ }
+
if (animadata) {
if (animadata->end_function) {
(*animadata->end_function)(&usurf->animation.animation);
@@ -537,8 +544,7 @@ animation_slide(struct weston_animation *animation,
}
break;
case ANIMA_SLIDE_TOLEFT: /* slide in right to left */
- dwidth = (container_of(weston_ec->output_list.next,
- struct weston_output, link))->width;
+ dwidth = usurf->node_tbl->disp_width;
if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) {
/* slide in right to left */
x = usurf->animation.pos_x +
@@ -562,8 +568,7 @@ animation_slide(struct weston_animation *animation,
}
break;
default: /*ANIMA_SLIDE_TOTOP*/ /* slide in bottom to top */
- dheight = (container_of(weston_ec->output_list.next,
- struct weston_output, link))->height;
+ dheight = usurf->node_tbl->disp_height;
if (usurf->animation.state == ICO_WINDOW_MGR_ANIMATION_STATE_SHOW) {
/* slide in bottom to top */
y = usurf->animation.pos_y +
@@ -1175,6 +1180,7 @@ module_init(struct weston_compositor *ec, int *argc, char *argv[])
default_animation = (char *)ico_ivi_default_animation_name();
animation_time = ico_ivi_default_animation_time();
animation_fps = ico_ivi_default_animation_fps();
+ animation_count = 0;
ico_window_mgr_set_hook_animation(ico_window_animation);
diff --git a/src/ico_window_mgr.c b/src/ico_window_mgr.c
index 890bca5..fe97775 100644
--- a/src/ico_window_mgr.c
+++ b/src/ico_window_mgr.c
@@ -282,6 +282,9 @@ static int win_mgr_set_scale(struct uifw_win_surface *usurf);
static int ico_get_animation_name(const char *animation);
/* hook for animation */
static int (*win_mgr_hook_animation)(const int op, void *data) = NULL;
+ /* hook for input region */
+static void (*win_mgr_hook_visible)(struct uifw_win_surface *usurf) = NULL;
+static void (*win_mgr_hook_destory)(struct uifw_win_surface *usurf) = NULL;
/* static tables */
/* Multi Window Manager interface */
@@ -968,6 +971,7 @@ win_mgr_register_surface(struct wl_client *client, struct wl_resource *resource,
wl_list_init(&usurf->client_link);
wl_list_init(&usurf->animation.animation.link);
wl_list_init(&usurf->surf_map);
+ wl_list_init(&usurf->input_region);
usurf->animation.hide_anima = ico_get_animation_name(ico_ivi_default_animation_name());
usurf->animation.hide_time = ico_ivi_default_animation_time();;
usurf->animation.show_anima = usurf->animation.hide_anima;
@@ -1137,6 +1141,12 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc
struct weston_surface *surface, *surfacetmp;
int num_visible = 0;
int layer_type;
+ int old_visible;
+
+ /* save current visible */
+ if (usurf) {
+ old_visible = ico_window_mgr_is_visible(usurf);
+ }
/* set layer type */
ico_ivi_shell_set_layertype();
@@ -1235,6 +1245,13 @@ ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touc
ico_ivi_shell_startup(_ico_win_mgr->shell);
}
}
+
+ /* if visible change, call hook for input region */
+ if ((usurf != NULL) && (win_mgr_hook_visible != NULL)) {
+ if (old_visible != ico_window_mgr_is_visible(usurf)) {
+ (*win_mgr_hook_visible)(usurf);
+ }
+ }
uifw_trace("ico_window_mgr_restack_layer: Leave");
}
@@ -2598,7 +2615,7 @@ uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource,
uclient = NULL;
wl_list_for_each(sm, &usurf->surf_map, surf_link) {
if (sm->uclient->mgr != NULL) {
- uifw_trace("uifw_unmap_surface: send MAP event(ev=%d surf=%08x name=%08x "
+ uifw_trace("uifw_unmap_surface: send UNMAP event(ev=%d surf=%08x name=%08x "
"w/h/s=%d/%d/%d format=%x",
ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP, surfaceid,
sm->eglname, sm->width, sm->height, sm->stride, sm->format);
@@ -2614,7 +2631,7 @@ uifw_unmap_surface(struct wl_client *client, struct wl_resource *resource,
if (((uclient != NULL) && (sm->uclient != uclient))) continue;
/* send unmap event */
if ((uclient != NULL) && (uclient->mgr != NULL)) {
- uifw_trace("uifw_unmap_surface: send MAP event(ev=%d surf=%08x name=%08x "
+ uifw_trace("uifw_unmap_surface: send UNMAP event(ev=%d surf=%08x name=%08x "
"w/h/s=%d/%d/%d format=%x",
ICO_WINDOW_MGR_MAP_SURFACE_EVENT_UNMAP, surfaceid,
sm->eglname, sm->width, sm->height, sm->stride, sm->format);
@@ -3064,6 +3081,11 @@ win_mgr_destroy_surface(struct weston_surface *surface)
}
uifw_trace("win_mgr_destroy_surface: Enter(%08x) %08x", (int)surface, usurf->surfaceid);
+ /* destory input region */
+ if (win_mgr_hook_destory) {
+ (*win_mgr_hook_destory)(usurf);
+ }
+
/* unmap surface */
if (&usurf->surf_map != usurf->surf_map.next) {
uifw_unmap_surface(NULL, NULL, usurf->surfaceid);
@@ -3490,6 +3512,31 @@ ico_window_mgr_get_client_usurf(const char *target)
/*--------------------------------------------------------------------------*/
/**
+ * @brief ico_window_mgr_is_visible: check surface visible
+ *
+ * @param[in] usurf UIFW surface
+ * @return visibility
+ * @retval =1 visible
+ * @retval =0 not visible
+ * @retval =-1 surface visible but layer not vlsible
+ * @retval =-2 surface visible but lower
+ */
+/*--------------------------------------------------------------------------*/
+WL_EXPORT int
+ico_window_mgr_is_visible(struct uifw_win_surface *usurf)
+{
+ if ((usurf->visible == 0) || (usurf->surface == NULL) ||
+ (usurf->mapped == 0) || (usurf->surface->buffer_ref.buffer == NULL)) {
+ return 0;
+ }
+ if (usurf->win_layer->visible == 0) {
+ return -1;
+ }
+ return 1;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief ico_window_mgr_set_hook_animation: set animation hook routine
*
* @param[in] hook_animation hook routine
@@ -3504,6 +3551,34 @@ ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data
/*--------------------------------------------------------------------------*/
/**
+ * @brief ico_window_mgr_set_hook_visible: set input region hook routine
+ *
+ * @param[in] hook_visible hook routine
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+WL_EXPORT void
+ico_window_mgr_set_hook_visible(void (*hook_visible)(struct uifw_win_surface *usurf))
+{
+ win_mgr_hook_visible = hook_visible;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief ico_window_mgr_set_hook_destory: set input region hook routine
+ *
+ * @param[in] hook_destroy hook routine
+ * @return none
+ */
+/*--------------------------------------------------------------------------*/
+WL_EXPORT void
+ico_window_mgr_set_hook_destory(void (*hook_destroy)(struct uifw_win_surface *usurf))
+{
+ win_mgr_hook_destory = hook_destroy;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
* @brief module_init: initialize ico_window_mgr
* this function called from ico_pluign_loader
*
diff --git a/src/ico_window_mgr.h b/src/ico_window_mgr.h
index c4c31a6..06a11bd 100644
--- a/src/ico_window_mgr.h
+++ b/src/ico_window_mgr.h
@@ -152,6 +152,7 @@ struct uifw_win_surface {
struct wl_list ivi_layer; /* surface list of same layer */
struct wl_list client_link; /* surface list of same client */
struct wl_list surf_map; /* surface map list */
+ struct wl_list input_region; /* surface input region list */
struct uifw_win_surface *next_idhash; /* UIFW SurfaceId hash list */
struct uifw_win_surface *next_wshash; /* Weston SurfaceId hash list */
};
@@ -216,8 +217,14 @@ struct uifw_win_surface *ico_window_mgr_get_usurf_client(const uint32_t surfacei
struct uifw_win_surface *ico_window_mgr_get_client_usurf(const char *target);
/* rebuild surface layer list */
void ico_window_mgr_restack_layer(struct uifw_win_surface *usurf, const int omit_touch);
+ /* chek surface visibility */
+int ico_window_mgr_is_visible(struct uifw_win_surface *usurf);
/* set window animation hook */
void ico_window_mgr_set_hook_animation(int (*hook_animation)(const int op, void *data));
+ /* set surface visible change hook */
+void ico_window_mgr_set_hook_visible(void (*hook_visible)(struct uifw_win_surface *usurf));
+ /* set surface destory hook */
+void ico_window_mgr_set_hook_destory(void (*hook_destroy)(struct uifw_win_surface *usurf));
#endif /*_ICO_WINDOW_MGR_H_*/
diff --git a/tests/test-homescreen.c b/tests/test-homescreen.c
index d726e3d..40bf037 100644
--- a/tests/test-homescreen.c
+++ b/tests/test-homescreen.c
@@ -785,8 +785,8 @@ cb_input_regions(void *data, struct ico_input_mgr_device *ico_input_mgr_device,
if (regions) {
wl_array_for_each(region, regions) {
n ++;
- print_log("HOMESCREEN: Event[input_regions] number of regions=%d", n);
}
+ print_log("HOMESCREEN: Event[input_regions] number of regions=%d", n);
n = 0;
wl_array_for_each(region, regions) {
n ++;
@@ -804,7 +804,7 @@ cb_input_regions(void *data, struct ico_input_mgr_device *ico_input_mgr_device,
sprintf(schange, "?%d?", region->change);
break;
}
- print_log("HOMESCREEN:%2d. %s %d.%08(%d/%d) &d/%d-%d/%d "
+ print_log("HOMESCREEN:%2d. %s %d.%08x(%d/%d) %d/%d-%d/%d "
"hot=%d/%d cur=%d/%d-%d/%d attr=%x",
n, schange, region->node, region->surfaceid, region->surface_x,
region->surface_y, region->x, region->y, region->width,
diff --git a/tests/testdata/hs_inputregion.dat b/tests/testdata/hs_inputregion.dat
index e7579a6..649e5eb 100644
--- a/tests/testdata/hs_inputregion.dat
+++ b/tests/testdata/hs_inputregion.dat
@@ -4,6 +4,9 @@
#
# 1. Make surfaces
#
+# set input device for Haptic
+input_conf Haptic 16 switch 1 code 2
+#
launch ../tests/test-client < ../tests/testdata/cl_inputregion.dat 2> ../tests/testlog/test-client01.log 1>&2
waitcreate 2
show test-client
@@ -14,8 +17,20 @@ set_region test-client@test-client 70 200 50 80
sleep 1
# unset region
## unset_region test-client@test-client 50 100 30 60 # request from application
-unset_region test-client@ 70 200 50 80
+unset_region @test-client 70 200 50 80
+sleep 1
+set_region test-client@test-client 10 20 40 30
+set_region test-client@test-client 80 120 50 60
+set_region test-client@test-client 120 60 20 20
+sleep 1
+unset_region test-client@test-client 80 120 50 60
sleep 1
+hide test-client
+sleep 1
+show test-client
+sleep 1
+kill test-client
+sleep 2
#
launch ../tests/test-eflapp @1 -color=0xe02040ff 2> ../tests/testlog/test-eflapp.log 1>&2
waitcreate 2
@@ -24,14 +39,13 @@ show test-eflapp@1
sleep 1
#
# set region
-set_region test-eflapp@@1@test-eflapp@@1 60 90 40 70
-set_region test-eflapp@@1@test0eflapp@@1 80 190 60 100
+set_region EFL_Native_Application_1@test-eflapp@@1 60 90 40 70
+set_region EFL_Native_Application_1@test-eflapp@@1 80 190 60 100
sleep 1
# unset region
-unset_region test-eflapp@@1 main 0 0 0 0
+unset_region @test-eflapp@@1 main 0 0 0 0
#
sleep 2
-kill test-client
kill test-eflapp@1
sleep 1
#