if (mask & IVI_NOTIFICATION_REMOVE) {
wl_list_for_each_safe(link_layer, next, &ivisurf->list_layer, link) {
ivi_controller_surface_send_layer(resource, NULL);
- wl_list_remove(&link_layer->link);
- free(link_layer);
- link_layer = NULL;
}
}
else if (mask & IVI_NOTIFICATION_ADD) {
for (i = 0; i < (int)length; i++) {
- /* Create list_layer */
- link_layer = calloc(1, sizeof(*link_layer));
- if (NULL == link_layer) {
- continue;
- }
- wl_list_init(&link_layer->link);
- link_layer->layer = NULL;
+ /* Send new surface event */
+ ivilayer = NULL;
wl_list_for_each(ivilayer, &shell->list_layer, link) {
if (ivilayer->layout_layer == pArray[i]) {
- link_layer->layer = ivilayer;
break;
}
}
- if (link_layer->layer == NULL) {
- free(link_layer);
- link_layer = NULL;
+ if (ivilayer == NULL) {
continue;
}
- struct link_layer *layer_link = NULL;
- wl_list_insert(&ivisurf->list_layer, &link_layer->link);
-
- /* Send new surface event */
id_layout_layer =
- ivi_layout_getIdOfLayer(link_layer->layer->layout_layer);
+ ivi_layout_getIdOfLayer(ivilayer->layout_layer);
wl_list_for_each(ctrllayer, &shell->list_controller_layer, link) {
if (id_layout_layer != ctrllayer->id_layer) {
continue;
ivi_controller_surface_send_pixelformat(resource,
prop->pixelformat);
}
+ if (mask & IVI_NOTIFICATION_REMOVE) {
+ send_surface_add_event(ivisurf, resource, IVI_NOTIFICATION_REMOVE);
+ }
if (mask & IVI_NOTIFICATION_ADD) {
send_surface_add_event(ivisurf, resource, IVI_NOTIFICATION_ADD);
}
+}
+
+static void
+update_surface_prop(struct ivisurface *ivisurf,
+ uint32_t mask)
+{
+ struct ivi_layout_layer **pArray = NULL;
+ uint32_t length = 0;
+ int32_t ans = 0;
+ int i = 0;
+ struct ivishell *shell = ivisurf->shell;
+
+ ans = ivi_layout_getLayersUnderSurface(ivisurf->layout_surface,
+ &length, &pArray);
+ if (0 != ans) {
+ weston_log("failed to get layers at send_surface_add_event\n");
+ return;
+ }
+
if (mask & IVI_NOTIFICATION_REMOVE) {
- send_surface_add_event(ivisurf, resource, IVI_NOTIFICATION_REMOVE);
+ struct link_layer *link_layer = NULL;
+ struct link_layer *next = NULL;
+
+ wl_list_for_each_safe(link_layer, next, &ivisurf->list_layer, link) {
+ wl_list_remove(&link_layer->link);
+ free(link_layer);
+ link_layer = NULL;
+ }
+ }
+ if (mask & IVI_NOTIFICATION_ADD) {
+ for (i = 0; i < (int)length; ++i) {
+ /* Create list_layer */
+ struct ivilayer *ivilayer = NULL;
+ struct link_layer *link_layer = calloc(1, sizeof(*link_layer));
+ if (NULL == link_layer) {
+ continue;
+ }
+ wl_list_init(&link_layer->link);
+ link_layer->layer = NULL;
+ wl_list_for_each(ivilayer, &shell->list_layer, link) {
+ if (ivilayer->layout_layer == pArray[i]) {
+ link_layer->layer = ivilayer;
+ break;
+ }
+ }
+
+ if (link_layer->layer == NULL) {
+ free(link_layer);
+ link_layer = NULL;
+ continue;
+ }
+
+ wl_list_insert(&ivisurf->list_layer, &link_layer->link);
+ }
}
}
}
send_surface_event(ctrlsurf->resource, ivisurf, prop, mask);
}
+
+ update_surface_prop(ivisurf, mask);
}
static void
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);
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
}
send_layer_event(ctrllayer->resource, ivilayer, prop, mask);
}
+
+ update_layer_prop(ivilayer, mask);
}
static void
uint32_t id_layout_surface = 0;
uint32_t id_layout_layer = 0;
- wl_list_for_each_reverse(ivisurf, &shell->list_surface, link) {
- id_layout_surface =
- ivi_layout_getIdOfSurface(ivisurf->layout_surface);
-
- ivi_controller_send_surface(controller->resource,
- id_layout_surface);
- }
-
- wl_list_for_each_reverse(ivilayer, &shell->list_layer, link) {
- id_layout_layer =
- ivi_layout_getIdOfLayer(ivilayer->layout_layer);
-
- ivi_controller_send_layer(controller->resource,
- id_layout_layer);
- }
-
wl_list_for_each(iviscrn, &shell->list_screen, link) {
resource_output = wl_resource_find_for_client(
&iviscrn->output->resource_list, client);
wl_resource_get_id(resource_output),
ctrlscrn->resource);
}
+ wl_list_for_each_reverse(ivilayer, &shell->list_layer, link) {
+ id_layout_layer =
+ ivi_layout_getIdOfLayer(ivilayer->layout_layer);
+
+ ivi_controller_send_layer(controller->resource,
+ id_layout_layer);
+ }
+ wl_list_for_each_reverse(ivisurf, &shell->list_surface, link) {
+ id_layout_surface =
+ ivi_layout_getIdOfSurface(ivisurf->layout_surface);
+
+ ivi_controller_send_surface(controller->resource,
+ id_layout_surface);
+ }
}
static void