[PATCH weston 6/8] ivi-shell: implement get_screen_from_output

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 18 11:15:43 UTC 2016


On Thu, 17 Mar 2016 15:30:46 +0000
"Ucan, Emre (ADITG/SW1)" <eucan at de.adit-jv.com> wrote:

> It is an internal API, which returns ivi_layout_screen
> for a pregiven weston_output.
> 
> Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
> ---
>  ivi-shell/ivi-layout.c |   20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
> index b058c28..798049a 100644
> --- a/ivi-shell/ivi-layout.c
> +++ b/ivi-shell/ivi-layout.c
> @@ -167,6 +167,20 @@ get_weston_view(struct ivi_layout_surface *ivisurf)
>  	return view;
>  }
>  
> +static struct ivi_layout_screen *
> +get_screen_from_output(struct weston_output *output)
> +{
> +	struct ivi_layout *layout = get_instance();
> +	struct ivi_layout_screen *iviscrn = NULL;
> +
> +	wl_list_for_each(iviscrn, &layout->screen_list, link) {
> +		if (iviscrn->output == output)
> +			return iviscrn;
> +	}

Hi,

this could also be written with a container_of(wl_signal_get(...)) on
weston_output::destroy_signal if you had a destroy_signal handler. You
will need the handler to handle hot-unplug eventually.

But, for now this is perfectly fine.


Thanks,
pq

> +
> +	return NULL;
> +}
> +
>  static void
>  remove_all_notification(struct wl_list *listener_list)
>  {
> @@ -1489,7 +1503,7 @@ ivi_layout_get_layers_on_screen(struct weston_output *output,
>  		return IVI_FAILED;
>  	}
>  
> -	iviscrn = ivi_layout_get_screen_from_id(output->id);
> +	iviscrn = get_screen_from_output(output);
>  	length = wl_list_length(&iviscrn->order.layer_list);
>  
>  	if (length != 0) {
> @@ -1961,7 +1975,7 @@ ivi_layout_screen_add_layer(struct weston_output *output,
>  		return IVI_FAILED;
>  	}
>  
> -	iviscrn = ivi_layout_get_screen_from_id(output->id);
> +	iviscrn = get_screen_from_output(output);
>  
>  	if (addlayer->on_screen == iviscrn) {
>  		weston_log("ivi_layout_screen_add_layer: addlayer is already available\n");
> @@ -1991,7 +2005,7 @@ ivi_layout_screen_set_render_order(struct weston_output *output,
>  		return IVI_FAILED;
>  	}
>  
> -	iviscrn = ivi_layout_get_screen_from_id(output->id);
> +	iviscrn = get_screen_from_output(output);
>  
>  	wl_list_for_each_safe(ivilayer, next,
>  			      &iviscrn->pending.layer_list, pending.link) {

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160318/c09fc4ca/attachment.sig>


More information about the wayland-devel mailing list