[PATCH weston v1 05/17] clients: add missing getters for input objects

Pekka Paalanen ppaalanen at gmail.com
Fri Dec 12 06:19:24 PST 2014


On Fri,  5 Dec 2014 14:36:38 +0100
Marek Chalupa <mchqwerty at gmail.com> wrote:

> We need get wayland objects from toytoolkit display
> (there already are display_get_output, input_get_seat, ...),
> so that we can use them in the tests. This patch adds:
> 
>   display_get_input()
>   input_get_wl_pointer()
>   input_get_wl_keyboard()
>   input_get_wl_touch()
> 
> Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> ---
>  clients/window.c | 24 ++++++++++++++++++++++++
>  clients/window.h | 12 ++++++++++++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/clients/window.c b/clients/window.c
> index cc1e272..8dbf878 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -5211,6 +5211,24 @@ input_destroy(struct input *input)
>  	free(input);
>  }
>  
> +struct wl_pointer *
> +input_get_wl_pointer(struct input *input)
> +{
> +	return input->pointer;
> +}
> +
> +struct wl_keyboard *
> +input_get_wl_keyboard(struct input *input)
> +{
> +	return input->keyboard;
> +}
> +
> +struct wl_touch *
> +input_get_wl_touch(struct input *input)
> +{
> +	return input->touch;
> +}
> +
>  static void
>  init_workspace_manager(struct display *d, uint32_t id)
>  {
> @@ -5664,6 +5682,12 @@ display_get_output(struct display *display)
>  	return container_of(display->output_list.next, struct output, link);
>  }
>  
> +struct input *
> +display_get_input(struct display *display)
> +{
> +	return container_of(display->input_list.next, struct input, link);

This looks kind of odd. But now I see that display_get_output() is the
same: just returns whatever the first one is.

Ok. And it's not like library ABI or anything.

Acked-by: me.

I suppose you could cut one level of indirection and do
display_get_wl_pointer(). It's as correct as any of this. ;-)


Thanks,
pq


More information about the wayland-devel mailing list