[PATCH weston 1/6] ivi-shell: register ivi_layout_interface

Pekka Paalanen ppaalanen at gmail.com
Mon Jan 22 12:28:04 UTC 2018


On Wed, 3 Jan 2018 16:09:16 +0100
Emre Ucan <eucan at de.adit-jv.com> wrote:

> controller modules can be loaded from the main function of weston.
> They will get the ivi_layout_interface via weston plugin registry.
> 
> Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
> ---
>  ivi-shell/ivi-layout-export.h | 13 +++++++++++++
>  ivi-shell/ivi-layout.c        |  6 ++++++
>  ivi-shell/ivi-shell.c         |  2 --
>  3 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
> index 277ac59..c15c7f8 100644
> --- a/ivi-shell/ivi-layout-export.h
> +++ b/ivi-shell/ivi-layout-export.h
> @@ -59,6 +59,7 @@ extern "C" {
>  
>  #include "stdbool.h"
>  #include "compositor.h"
> +#include "plugin-registry.h"
>  
>  #define IVI_SUCCEEDED (0)
>  #define IVI_FAILED (-1)
> @@ -140,6 +141,8 @@ enum ivi_layout_transition_type{
>  	IVI_LAYOUT_TRANSITION_MAX,
>  };
>  
> +#define IVI_LAYOUT_API_NAME "ivi_layout_api_v1"
> +
>  struct ivi_layout_interface {
>  
>  	/**
> @@ -572,6 +575,16 @@ struct ivi_layout_interface {
>  				       struct ivi_layout_layer *removelayer);
>  };
>  
> +static inline const struct ivi_layout_interface *
> +ivi_layout_get_api(struct weston_compositor *compositor)
> +{
> +	const void *api;
> +	api = weston_plugin_api_get(compositor, IVI_LAYOUT_API_NAME,
> +				    sizeof(struct ivi_layout_interface));
> +
> +	return (const struct ivi_layout_interface *)api;
> +}
> +
>  #ifdef __cplusplus
>  }
>  #endif /* __cplusplus */
> diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
> index 394179b..a11b658 100644
> --- a/ivi-shell/ivi-layout.c
> +++ b/ivi-shell/ivi-layout.c
> @@ -1906,6 +1906,8 @@ ivi_layout_surface_create(struct weston_surface *wl_surface,
>  	return ivisurf;
>  }
>  
> +static struct ivi_layout_interface ivi_layout_interface;
> +
>  void
>  ivi_layout_init_with_compositor(struct weston_compositor *ec)
>  {
> @@ -1934,6 +1936,10 @@ ivi_layout_init_with_compositor(struct weston_compositor *ec)
>  
>  	layout->transitions = ivi_layout_transition_set_create(ec);
>  	wl_list_init(&layout->pending_transition_list);
> +
> +	weston_plugin_api_register(ec, IVI_LAYOUT_API_NAME,
> +				   &ivi_layout_interface,
> +				   sizeof(struct ivi_layout_interface));
>  }
>  
>  static struct ivi_layout_interface ivi_layout_interface = {
> diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
> index 766a1fd..c096954 100644
> --- a/ivi-shell/ivi-shell.c
> +++ b/ivi-shell/ivi-shell.c
> @@ -425,8 +425,6 @@ ivi_shell_setting_create(struct ivi_shell_setting *dest,
>  	if (!dest->ivi_module &&
>  	    weston_config_section_get_string(section, "ivi-module",
>  					     &dest->ivi_module, NULL) < 0) {
> -		weston_log("Error: ivi-shell: No ivi-module set\n");
> -		result = -1;

I see a later patch removes this if-statement completely, but here the
resulting code looks really strange, like some mistake in patch
handling.

I wonder if this change even belongs in this patch, otherwise it's a
nice single logical step.

Acked-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

>  	}
>  
>  	weston_config_section_get_bool(section, "developermode",

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


More information about the wayland-devel mailing list