From: Nobuhiko Tanibata Date: Mon, 15 Dec 2014 04:20:44 +0000 (+0900) Subject: ivi-shell: reordering method in ivi_layout.c X-Git-Tag: 1.6.91~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef6c7864e2779af55f6e709a93d097f2dd0fb859;p=platform%2Fupstream%2Fweston.git ivi-shell: reordering method in ivi_layout.c In the future, re-alignmenet of WL_EXPORT per method should be done. For that work, re-ordering is required to be used by another method. Signed-off-by: Nobuhiko Tanibata Acked-by: Pekka Paalanen --- diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index dd2ebe7..8683e7d 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -268,6 +268,81 @@ get_layer(struct wl_list *layer_list, uint32_t id_layer) return NULL; } +static void +remove_configured_listener(struct ivi_layout_surface *ivisurf) +{ + struct wl_listener *link = NULL; + struct wl_listener *next = NULL; + + wl_list_for_each_safe(link, next, &ivisurf->configured.listener_list, link) { + wl_list_remove(&link->link); + } +} + + +static void +remove_all_notification(struct wl_list *listener_list) +{ + struct wl_listener *listener = NULL; + struct wl_listener *next = NULL; + + wl_list_for_each_safe(listener, next, listener_list, link) { + struct listener_layout_notification *notification = NULL; + if (!wl_list_empty(&listener->link)) { + wl_list_remove(&listener->link); + } + + notification = + container_of(listener, + struct listener_layout_notification, + listener); + + free(notification->userdata); + free(notification); + } +} + +WL_EXPORT void +ivi_layout_surface_remove_notification(struct ivi_layout_surface *ivisurf) +{ + if (ivisurf == NULL) { + weston_log("ivi_layout_surface_remove_notification: invalid argument\n"); + return; + } + + remove_all_notification(&ivisurf->property_changed.listener_list); +} + +void +ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf) +{ + struct ivi_layout *layout = get_instance(); + + if (ivisurf == NULL) { + weston_log("ivi_layout_surface_remove: invalid argument\n"); + return; + } + + if (!wl_list_empty(&ivisurf->pending.link)) { + wl_list_remove(&ivisurf->pending.link); + } + if (!wl_list_empty(&ivisurf->order.link)) { + wl_list_remove(&ivisurf->order.link); + } + if (!wl_list_empty(&ivisurf->link)) { + wl_list_remove(&ivisurf->link); + } + remove_ordersurface_from_layer(ivisurf); + + wl_signal_emit(&layout->surface_notification.removed, ivisurf); + + remove_configured_listener(ivisurf); + + ivi_layout_surface_remove_notification(ivisurf); + + free(ivisurf); +} + /** * Called at destruction of ivi_surface */ @@ -1205,28 +1280,6 @@ remove_notification(struct wl_list *listener_list, void *callback, void *userdat } } -static void -remove_all_notification(struct wl_list *listener_list) -{ - struct wl_listener *listener = NULL; - struct wl_listener *next = NULL; - - wl_list_for_each_safe(listener, next, listener_list, link) { - struct listener_layout_notification *notification = NULL; - if (!wl_list_empty(&listener->link)) { - wl_list_remove(&listener->link); - } - - notification = - container_of(listener, - struct listener_layout_notification, - listener); - - free(notification->userdata); - free(notification); - } -} - /** * Exported APIs of ivi-layout library are implemented from here. * Brief of APIs is described in ivi-layout-export.h. @@ -1510,58 +1563,6 @@ ivi_layout_surface_add_notification(struct ivi_layout_surface *ivisurf, return IVI_SUCCEEDED; } -WL_EXPORT void -ivi_layout_surface_remove_notification(struct ivi_layout_surface *ivisurf) -{ - if (ivisurf == NULL) { - weston_log("ivi_layout_surface_remove_notification: invalid argument\n"); - return; - } - - remove_all_notification(&ivisurf->property_changed.listener_list); -} - -static void -remove_configured_listener(struct ivi_layout_surface *ivisurf) -{ - struct wl_listener *link = NULL; - struct wl_listener *next = NULL; - - wl_list_for_each_safe(link, next, &ivisurf->configured.listener_list, link) { - wl_list_remove(&link->link); - } -} - -void -ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf) -{ - struct ivi_layout *layout = get_instance(); - - if (ivisurf == NULL) { - weston_log("ivi_layout_surface_remove: invalid argument\n"); - return; - } - - if (!wl_list_empty(&ivisurf->pending.link)) { - wl_list_remove(&ivisurf->pending.link); - } - if (!wl_list_empty(&ivisurf->order.link)) { - wl_list_remove(&ivisurf->order.link); - } - if (!wl_list_empty(&ivisurf->link)) { - wl_list_remove(&ivisurf->link); - } - remove_ordersurface_from_layer(ivisurf); - - wl_signal_emit(&layout->surface_notification.removed, ivisurf); - - remove_configured_listener(ivisurf); - - ivi_layout_surface_remove_notification(ivisurf); - - free(ivisurf); -} - WL_EXPORT const struct ivi_layout_layer_properties * ivi_layout_get_properties_of_layer(struct ivi_layout_layer *ivilayer) { @@ -1852,6 +1853,17 @@ ivi_layout_layer_create_with_dimension(uint32_t id_layer, } WL_EXPORT void +ivi_layout_layer_remove_notification(struct ivi_layout_layer *ivilayer) +{ + if (ivilayer == NULL) { + weston_log("ivi_layout_layer_remove_notification: invalid argument\n"); + return; + } + + remove_all_notification(&ivilayer->property_changed.listener_list); +} + +WL_EXPORT void ivi_layout_layer_remove(struct ivi_layout_layer *ivilayer) { struct ivi_layout *layout = get_instance(); @@ -2465,17 +2477,6 @@ ivi_layout_layer_add_notification(struct ivi_layout_layer *ivilayer, prop_callback); } -WL_EXPORT void -ivi_layout_layer_remove_notification(struct ivi_layout_layer *ivilayer) -{ - if (ivilayer == NULL) { - weston_log("ivi_layout_layer_remove_notification: invalid argument\n"); - return; - } - - remove_all_notification(&ivilayer->property_changed.listener_list); -} - WL_EXPORT const struct ivi_layout_surface_properties * ivi_layout_get_properties_of_surface(struct ivi_layout_surface *ivisurf) {