[4/5] ivi-shell: remove is_surface_in_layer API

Submitted by Ucan, Emre (ADITG/ESB) on Aug. 28, 2015, 12:59 p.m.

Details

Message ID AF835182DB40564F805CF05008AAFCA1A0EF90@HI2EXCH01.adit-jv.com
State Accepted
Commit 4a18364595bb511f20c5476324af9e5f4b4f3abd
Delegated to: Nobuhiko Tanibata
Headers show

Not browsing as part of any series.

Commit Message

Ucan, Emre (ADITG/ESB) Aug. 28, 2015, 12:59 p.m.
This internal API is redundant, because a surface is allowed to be only on one layer.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
---
 ivi-shell/ivi-layout.c |   23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 47c044a..49e789e 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -233,25 +233,6 @@  ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf)
 }
 
 /**
- * Internal API to check ivi_layer/ivi_surface already added in ivi_layer/ivi_screen.
- * Called by ivi_layout_layer_add_surface/ivi_layout_screenAddLayer
- */
-static int
-is_surface_in_layer(struct ivi_layout_surface *ivisurf,
-		    struct ivi_layout_layer *ivilayer)
-{
-	struct ivi_layout_surface *surf = NULL;
-
-	wl_list_for_each(surf, &ivilayer->pending.surface_list, pending.link) {
-		if (surf->id_surface == ivisurf->id_surface) {
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
-/**
  * Internal API to initialize ivi_screens found from output_list of weston_compositor.
  * Called by ivi_layout_init_with_compositor.
  */
@@ -2386,15 +2367,13 @@  ivi_layout_layer_add_surface(struct ivi_layout_layer *ivilayer,
 	struct ivi_layout *layout = get_instance();
 	struct ivi_layout_surface *ivisurf = NULL;
 	struct ivi_layout_surface *next = NULL;
-	int is_surf_in_layer = 0;
 
 	if (ivilayer == NULL || addsurf == NULL) {
 		weston_log("ivi_layout_layer_add_surface: invalid argument\n");
 		return IVI_FAILED;
 	}
 
-	is_surf_in_layer = is_surface_in_layer(addsurf, ivilayer);
-	if (is_surf_in_layer == 1) {
+	if (addsurf->on_layer == ivilayer) {
 		weston_log("ivi_layout_layer_add_surface: addsurf is already available\n");
 		return IVI_SUCCEEDED;
 	}

Comments

Hi,

Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

BR,
Nobuhiko Tanibata

2015-08-28 21:59 に Ucan, Emre (ADITG/SW1) さんは書きました:
> This internal API is redundant, because a surface is allowed to be
> only on one layer.
> 
> Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
> ---
>  ivi-shell/ivi-layout.c |   23 +----------------------
>  1 file changed, 1 insertion(+), 22 deletions(-)
> 
> diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
> index 47c044a..49e789e 100644
> --- a/ivi-shell/ivi-layout.c
> +++ b/ivi-shell/ivi-layout.c
> @@ -233,25 +233,6 @@ ivi_layout_surface_destroy(struct
> ivi_layout_surface *ivisurf)
>  }
> 
>  /**
> - * Internal API to check ivi_layer/ivi_surface already added in
> ivi_layer/ivi_screen.
> - * Called by ivi_layout_layer_add_surface/ivi_layout_screenAddLayer
> - */
> -static int
> -is_surface_in_layer(struct ivi_layout_surface *ivisurf,
> -		    struct ivi_layout_layer *ivilayer)
> -{
> -	struct ivi_layout_surface *surf = NULL;
> -
> -	wl_list_for_each(surf, &ivilayer->pending.surface_list, pending.link) 
> {
> -		if (surf->id_surface == ivisurf->id_surface) {
> -			return 1;
> -		}
> -	}
> -
> -	return 0;
> -}
> -
> -/**
>   * Internal API to initialize ivi_screens found from output_list of
> weston_compositor.
>   * Called by ivi_layout_init_with_compositor.
>   */
> @@ -2386,15 +2367,13 @@ ivi_layout_layer_add_surface(struct
> ivi_layout_layer *ivilayer,
>  	struct ivi_layout *layout = get_instance();
>  	struct ivi_layout_surface *ivisurf = NULL;
>  	struct ivi_layout_surface *next = NULL;
> -	int is_surf_in_layer = 0;
> 
>  	if (ivilayer == NULL || addsurf == NULL) {
>  		weston_log("ivi_layout_layer_add_surface: invalid argument\n");
>  		return IVI_FAILED;
>  	}
> 
> -	is_surf_in_layer = is_surface_in_layer(addsurf, ivilayer);
> -	if (is_surf_in_layer == 1) {
> +	if (addsurf->on_layer == ivilayer) {
>  		weston_log("ivi_layout_layer_add_surface: addsurf is already 
> available\n");
>  		return IVI_SUCCEEDED;
>  	}