[3/5] ivi-shell: remove is_layer_in_screen API

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

Details

Message ID AF835182DB40564F805CF05008AAFCA1A0EF85@HI2EXCH01.adit-jv.com
State Accepted
Commit bb4ec0a186f49d3ff146a88b89ed70be008592ab
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 layer is allowed to be only on one screen.

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

Patch hide | download patch | download mbox

diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 2a33b3e..47c044a 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -251,21 +251,6 @@  is_surface_in_layer(struct ivi_layout_surface *ivisurf,
 	return 0;
 }
 
-static int
-is_layer_in_screen(struct ivi_layout_layer *ivilayer,
-		   struct ivi_layout_screen *iviscrn)
-{
-	struct ivi_layout_layer *layer = NULL;
-
-	wl_list_for_each(layer, &iviscrn->pending.layer_list, pending.link) {
-		if (layer->id_layer == ivilayer->id_layer) {
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
 /**
  * Internal API to initialize ivi_screens found from output_list of weston_compositor.
  * Called by ivi_layout_init_with_compositor.
@@ -2244,15 +2229,13 @@  ivi_layout_screen_add_layer(struct ivi_layout_screen *iviscrn,
 	struct ivi_layout *layout = get_instance();
 	struct ivi_layout_layer *ivilayer = NULL;
 	struct ivi_layout_layer *next = NULL;
-	int is_layer_in_scrn = 0;
 
 	if (iviscrn == NULL || addlayer == NULL) {
 		weston_log("ivi_layout_screen_add_layer: invalid argument\n");
 		return IVI_FAILED;
 	}
 
-	is_layer_in_scrn = is_layer_in_screen(addlayer, iviscrn);
-	if (is_layer_in_scrn == 1) {
+	if (addlayer->on_screen == iviscrn) {
 		weston_log("ivi_layout_screen_add_layer: addlayer 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>

Best Regards,
Nobuhiko Tanibata

2015-08-28 21:59 に Ucan, Emre (ADITG/SW1) さんは書きました:
> This internal API is redundant, because a layer is allowed to be only
> on one screen.
> 
> Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
> ---
>  ivi-shell/ivi-layout.c |   19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
> index 2a33b3e..47c044a 100644
> --- a/ivi-shell/ivi-layout.c
> +++ b/ivi-shell/ivi-layout.c
> @@ -251,21 +251,6 @@ is_surface_in_layer(struct ivi_layout_surface 
> *ivisurf,
>  	return 0;
>  }
> 
> -static int
> -is_layer_in_screen(struct ivi_layout_layer *ivilayer,
> -		   struct ivi_layout_screen *iviscrn)
> -{
> -	struct ivi_layout_layer *layer = NULL;
> -
> -	wl_list_for_each(layer, &iviscrn->pending.layer_list, pending.link) {
> -		if (layer->id_layer == ivilayer->id_layer) {
> -			return 1;
> -		}
> -	}
> -
> -	return 0;
> -}
> -
>  /**
>   * Internal API to initialize ivi_screens found from output_list of
> weston_compositor.
>   * Called by ivi_layout_init_with_compositor.
> @@ -2244,15 +2229,13 @@ ivi_layout_screen_add_layer(struct
> ivi_layout_screen *iviscrn,
>  	struct ivi_layout *layout = get_instance();
>  	struct ivi_layout_layer *ivilayer = NULL;
>  	struct ivi_layout_layer *next = NULL;
> -	int is_layer_in_scrn = 0;
> 
>  	if (iviscrn == NULL || addlayer == NULL) {
>  		weston_log("ivi_layout_screen_add_layer: invalid argument\n");
>  		return IVI_FAILED;
>  	}
> 
> -	is_layer_in_scrn = is_layer_in_screen(addlayer, iviscrn);
> -	if (is_layer_in_scrn == 1) {
> +	if (addlayer->on_screen == iviscrn) {
>  		weston_log("ivi_layout_screen_add_layer: addlayer is already 
> available\n");
>  		return IVI_SUCCEEDED;
>  	}