[PATCH weston 2/4] input: Add a weston_pointer_output_center

Pekka Paalanen ppaalanen at gmail.com
Tue Jun 11 05:08:23 PDT 2013


On Mon, 10 Jun 2013 15:17:29 +0100
Rob Bradford <robert.bradford at intel.com> wrote:

> From: Rob Bradford <rob at linux.intel.com>
> 
> Centre the pointer on a the provided output. This function provides the
> basis of ensuring that the pointer starts on the output when we start to
> constrain a seat to a given output.
> ---
>  src/compositor.h | 3 +++
>  src/input.c      | 8 ++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/src/compositor.h b/src/compositor.h
> index 22700b7..d2ca844 100644
> --- a/src/compositor.h
> +++ b/src/compositor.h
> @@ -333,6 +333,9 @@ weston_pointer_start_grab(struct weston_pointer *pointer,
>  			  struct weston_pointer_grab *grab);
>  void
>  weston_pointer_end_grab(struct weston_pointer *pointer);
> +void
> +weston_pointer_output_center(struct weston_pointer *pointer,
> +			     struct weston_output *output);
>  
>  struct weston_keyboard *
>  weston_keyboard_create(void);
> diff --git a/src/input.c b/src/input.c
> index d299d98..7c7aa95 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -473,6 +473,14 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
>  }
>  
>  WL_EXPORT void
> +weston_pointer_output_center(struct weston_pointer *pointer,
> +			     struct weston_output *output)
> +{
> +	pointer->x = wl_fixed_from_int(output->x + output->width / 2);
> +	pointer->y = wl_fixed_from_int(output->y + output->height / 2);

What about all the processing that happens in input.c notify_motion()
and move_pointer(), is that really not needed here?

> +}
> +
> +WL_EXPORT void
>  weston_keyboard_set_focus(struct weston_keyboard *keyboard,
>  			  struct weston_surface *surface)
>  {

More questions on the next patch,
pq


More information about the wayland-devel mailing list