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

Submitted by Marek Chalupa on Dec. 5, 2014, 1:36 p.m.

Details

Message ID 1417786610-2440-6-git-send-email-mchqwerty@gmail.com
State Changes Requested
Headers show

Not browsing as part of any series.

Commit Message

Marek Chalupa Dec. 5, 2014, 1:36 p.m.
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@gmail.com>
---
 clients/window.c | 24 ++++++++++++++++++++++++
 clients/window.h | 12 ++++++++++++
 2 files changed, 36 insertions(+)

Patch hide | download patch | download mbox

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);
+}
+
 struct wl_compositor *
 display_get_compositor(struct display *display)
 {
diff --git a/clients/window.h b/clients/window.h
index 5247f19..20d3fa0 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -93,6 +93,9 @@  display_get_compositor(struct display *display);
 struct output *
 display_get_output(struct display *display);
 
+struct input *
+display_get_input(struct display *display);
+
 uint32_t
 display_get_serial(struct display *display);
 
@@ -613,6 +616,15 @@  output_get_allocation(struct output *output, struct rectangle *allocation);
 struct wl_output *
 output_get_wl_output(struct output *output);
 
+struct wl_pointer *
+input_get_wl_pointer(struct input *input);
+
+struct wl_keyboard *
+input_get_wl_keyboard(struct input *input);
+
+struct wl_touch *
+input_get_wl_touch(struct input *input);
+
 enum wl_output_transform
 output_get_transform(struct output *output);
 

Comments

On 05/12/14 07:36 AM, Marek Chalupa 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()

Is there any reason we'd want these to be unavailable to toytoolkit apps?

> Signed-off-by: Marek Chalupa <mchqwerty@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);
> +}
> +
>  struct wl_compositor *
>  display_get_compositor(struct display *display)
>  {
> diff --git a/clients/window.h b/clients/window.h
> index 5247f19..20d3fa0 100644
> --- a/clients/window.h
> +++ b/clients/window.h
> @@ -93,6 +93,9 @@ display_get_compositor(struct display *display);
>  struct output *
>  display_get_output(struct display *display);
>  
> +struct input *
> +display_get_input(struct display *display);
> +
>  uint32_t
>  display_get_serial(struct display *display);
>  
> @@ -613,6 +616,15 @@ output_get_allocation(struct output *output, struct rectangle *allocation);
>  struct wl_output *
>  output_get_wl_output(struct output *output);
>  
> +struct wl_pointer *
> +input_get_wl_pointer(struct input *input);
> +
> +struct wl_keyboard *
> +input_get_wl_keyboard(struct input *input);
> +
> +struct wl_touch *
> +input_get_wl_touch(struct input *input);
> +
>  enum wl_output_transform
>  output_get_transform(struct output *output);
>  
>
On 9 December 2014 at 21:33, Derek Foreman <derekf@osg.samsung.com> wrote:

> On 05/12/14 07:36 AM, Marek Chalupa 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()
>
> Is there any reason we'd want these to be unavailable to toytoolkit apps?
>

Since toytoolkit is weston-private, I don't think the is any.


>
> > Signed-off-by: Marek Chalupa <mchqwerty@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);
> > +}
> > +
> >  struct wl_compositor *
> >  display_get_compositor(struct display *display)
> >  {
> > diff --git a/clients/window.h b/clients/window.h
> > index 5247f19..20d3fa0 100644
> > --- a/clients/window.h
> > +++ b/clients/window.h
> > @@ -93,6 +93,9 @@ display_get_compositor(struct display *display);
> >  struct output *
> >  display_get_output(struct display *display);
> >
> > +struct input *
> > +display_get_input(struct display *display);
> > +
> >  uint32_t
> >  display_get_serial(struct display *display);
> >
> > @@ -613,6 +616,15 @@ output_get_allocation(struct output *output, struct
> rectangle *allocation);
> >  struct wl_output *
> >  output_get_wl_output(struct output *output);
> >
> > +struct wl_pointer *
> > +input_get_wl_pointer(struct input *input);
> > +
> > +struct wl_keyboard *
> > +input_get_wl_keyboard(struct input *input);
> > +
> > +struct wl_touch *
> > +input_get_wl_touch(struct input *input);
> > +
> >  enum wl_output_transform
> >  output_get_transform(struct output *output);
> >
> >
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>

Regards,
Marek
On Fri,  5 Dec 2014 14:36:38 +0100
Marek Chalupa <mchqwerty@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@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