diff options
author | Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> | 2014-06-19 15:10:10 +0900 |
---|---|---|
committer | Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> | 2014-06-30 11:35:27 +0900 |
commit | bb153032702c5081cab4c042472475ce032a39ee (patch) | |
tree | 71bbc88600b8ed075ce0d4fe115c6c7450ae4573 | |
parent | 1c7586618702e83c9ad4c1a8249685e68ca798b7 (diff) | |
download | wayland-ivi-extension-bb153032702c5081cab4c042472475ce032a39ee.tar.gz |
weston-ivi-shell: Separate code of updating layer properties from sending layer events.
Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@denso.co.jp>
-rwxr-xr-x | weston-ivi-shell/src/ivi-controller.c | 80 |
1 files changed, 63 insertions, 17 deletions
diff --git a/weston-ivi-shell/src/ivi-controller.c b/weston-ivi-shell/src/ivi-controller.c index 8aee389..4f30d09 100755 --- a/weston-ivi-shell/src/ivi-controller.c +++ b/weston-ivi-shell/src/ivi-controller.c @@ -554,35 +554,22 @@ send_layer_add_event(struct ivilayer *ivilayer, if (mask & IVI_NOTIFICATION_REMOVE) { wl_list_for_each_safe(link_scrn, next, &ivilayer->list_screen, link) { ivi_controller_layer_send_screen(resource, NULL); - wl_list_remove(&link_scrn->link); - free(link_scrn); - link_scrn = NULL; } } else if (mask & IVI_NOTIFICATION_ADD) { for (i = 0; i < (int)length; i++) { - /* Create list_screen */ - link_scrn = calloc(1, sizeof(*link_scrn)); - if (NULL == link_scrn) { - continue; - } - wl_list_init(&link_scrn->link); - link_scrn->screen = NULL; + /* Send new layer event */ + iviscrn = NULL; wl_list_for_each(iviscrn, &shell->list_screen, link) { if (iviscrn->layout_screen == pArray[i]) { - link_scrn->screen = iviscrn; break; } } - if (link_scrn->screen == NULL) { - free(link_scrn); - link_scrn = NULL; + if (iviscrn == NULL) { continue; } - wl_list_insert(&ivilayer->list_screen, &link_scrn->link); - /* Send new layer event */ resource_output = wl_resource_find_for_client(&iviscrn->output->resource_list, client); @@ -628,12 +615,69 @@ send_layer_event(struct wl_resource *resource, ivi_controller_layer_send_visibility(resource, prop->visibility); } + if (mask & IVI_NOTIFICATION_REMOVE) { + send_layer_add_event(ivilayer, resource, IVI_NOTIFICATION_REMOVE); + } if (mask & IVI_NOTIFICATION_ADD) { send_layer_add_event(ivilayer, resource, IVI_NOTIFICATION_ADD); } +} + +static void +update_layer_prop(struct ivilayer *ivilayer, + enum ivi_layout_notification_mask mask) +{ + struct ivi_layout_screen **pArray = NULL; + uint32_t length = 0; + int32_t ans = 0; + struct link_screen *link_scrn = NULL; + struct link_screen *next = NULL; + + ans = ivi_layout_getScreensUnderLayer(ivilayer->layout_layer, + &length, &pArray); + if (0 != ans) { + weston_log("failed to get screens at send_layer_add_event\n"); + return; + } + + /* Send Null to cancel added layer */ if (mask & IVI_NOTIFICATION_REMOVE) { - send_layer_add_event(ivilayer, resource, IVI_NOTIFICATION_REMOVE); + wl_list_for_each_safe(link_scrn, next, &ivilayer->list_screen, link) { + wl_list_remove(&link_scrn->link); + free(link_scrn); + link_scrn = NULL; + } + } + if (mask & IVI_NOTIFICATION_ADD) { + int i = 0; + for (i = 0; i < (int)length; i++) { + struct ivishell *shell = ivilayer->shell; + struct iviscreen *iviscrn = NULL; + /* Create list_screen */ + link_scrn = calloc(1, sizeof(*link_scrn)); + if (NULL == link_scrn) { + continue; + } + wl_list_init(&link_scrn->link); + link_scrn->screen = NULL; + wl_list_for_each(iviscrn, &shell->list_screen, link) { + if (iviscrn->layout_screen == pArray[i]) { + link_scrn->screen = iviscrn; + break; + } + } + + if (link_scrn->screen == NULL) { + free(link_scrn); + link_scrn = NULL; + continue; + } + wl_list_insert(&ivilayer->list_screen, &link_scrn->link); + } } + + free(pArray); + pArray = NULL; } static void @@ -654,6 +698,8 @@ send_layer_prop(struct ivi_layout_layer *layer, } send_layer_event(ctrllayer->resource, ivilayer, prop, mask); } + + update_layer_prop(ivilayer, mask); } static void |