[PATCH weston v2 01/21] input: Pass axis events through pointer grab interfaces

Derek Foreman derekf at osg.samsung.com
Wed Jun 3 14:57:54 PDT 2015


On 13/05/15 05:26 AM, Jonas Ådahl wrote:
> Don't only send motions and buttons but also axis events through the
> pointer grab interface.
> 
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>

This looks good to me.  The zoom binding still works, and the default
grab handler is called appropriately, scrolling in a weston-terminal
still works.  That's as heavily as I know how to test it..

However...  Since hmi-contoller calls weston_pointer_send_axis(), it
needs to be WL_EXPORT

the ivi-shell-app test fails because of this.

Also, I guess since it needs to be WL_EXPORT it should have doxygen? :/

> ---
>  desktop-shell/exposay.c    |  7 +++++++
>  desktop-shell/shell.c      | 24 ++++++++++++++++++++++++
>  ivi-shell/hmi-controller.c |  9 +++++++++
>  src/compositor.h           |  5 +++++
>  src/data-device.c          |  7 +++++++
>  src/input.c                | 27 +++++++++++++++++++++------
>  6 files changed, 73 insertions(+), 6 deletions(-)
> 
> diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
> index 4b65cbd..dc3fee0 100644
> --- a/desktop-shell/exposay.c
> +++ b/desktop-shell/exposay.c
> @@ -378,6 +378,12 @@ exposay_button(struct weston_pointer_grab *grab, uint32_t time, uint32_t button,
>  }
>  
>  static void
> +exposay_axis(struct weston_pointer_grab *grab,
> +	     uint32_t time, uint32_t axis, wl_fixed_t value)
> +{
> +}
> +
> +static void
>  exposay_pointer_grab_cancel(struct weston_pointer_grab *grab)
>  {
>  	struct desktop_shell *shell =
> @@ -390,6 +396,7 @@ static const struct weston_pointer_grab_interface exposay_ptr_grab = {
>  	exposay_focus,
>  	exposay_motion,
>  	exposay_button,
> +	exposay_axis,
>  	exposay_pointer_grab_cancel,
>  };
>  
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index c05a5c7..aa26b58 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -1658,6 +1658,12 @@ noop_grab_focus(struct weston_pointer_grab *grab)
>  }
>  
>  static void
> +noop_grab_axis(struct weston_pointer_grab *grab,
> +	       uint32_t time, uint32_t axis, wl_fixed_t value)
> +{
> +}
> +
> +static void
>  constrain_position(struct weston_move_grab *move, int *cx, int *cy)
>  {
>  	struct shell_surface *shsurf = move->base.shsurf;
> @@ -1736,6 +1742,7 @@ static const struct weston_pointer_grab_interface move_grab_interface = {
>  	noop_grab_focus,
>  	move_grab_motion,
>  	move_grab_button,
> +	noop_grab_axis,
>  	move_grab_cancel,
>  };
>  
> @@ -1895,6 +1902,7 @@ static const struct weston_pointer_grab_interface resize_grab_interface = {
>  	noop_grab_focus,
>  	resize_grab_motion,
>  	resize_grab_button,
> +	noop_grab_axis,
>  	resize_grab_cancel,
>  };
>  
> @@ -2057,6 +2065,7 @@ static const struct weston_pointer_grab_interface busy_cursor_grab_interface = {
>  	busy_cursor_grab_focus,
>  	busy_cursor_grab_motion,
>  	busy_cursor_grab_button,
> +	noop_grab_axis,
>  	busy_cursor_grab_cancel,
>  };
>  
> @@ -3224,6 +3233,19 @@ popup_grab_button(struct weston_pointer_grab *grab,
>  }
>  
>  static void
> +popup_grab_axis(struct weston_pointer_grab *grab,
> +		uint32_t time, uint32_t axis, wl_fixed_t value)
> +{
> +	struct weston_pointer *pointer = grab->pointer;
> +	struct wl_resource *resource;
> +	struct wl_list *resource_list;
> +
> +	resource_list = &pointer->focus_resource_list;
> +	wl_resource_for_each(resource, resource_list)
> +		wl_pointer_send_axis(resource, time, axis, value);
> +}
> +
> +static void
>  popup_grab_cancel(struct weston_pointer_grab *grab)
>  {
>  	popup_grab_end(grab->pointer);
> @@ -3233,6 +3255,7 @@ static const struct weston_pointer_grab_interface popup_grab_interface = {
>  	popup_grab_focus,
>  	popup_grab_motion,
>  	popup_grab_button,
> +	popup_grab_axis,
>  	popup_grab_cancel,
>  };
>  
> @@ -4960,6 +4983,7 @@ static const struct weston_pointer_grab_interface rotate_grab_interface = {
>  	noop_grab_focus,
>  	rotate_grab_motion,
>  	rotate_grab_button,
> +	noop_grab_axis,
>  	rotate_grab_cancel,
>  };
>  
> diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
> index cd79c38..bad2418 100644
> --- a/ivi-shell/hmi-controller.c
> +++ b/ivi-shell/hmi-controller.c
> @@ -1302,6 +1302,14 @@ pointer_noop_grab_focus(struct weston_pointer_grab *grab)
>  }
>  
>  static void
> +pointer_default_grab_axis(struct weston_pointer_grab *grab,
> +			  uint32_t time, uint32_t axis, wl_fixed_t value)
> +{
> +	weston_pointer_send_axis(grab->pointer, time, axis, value);
> +}
> +
> +
> +static void
>  move_grab_update(struct move_grab *move, wl_fixed_t pointer[2])
>  {
>  	struct timespec timestamp = {0};
> @@ -1445,6 +1453,7 @@ static const struct weston_pointer_grab_interface pointer_move_grab_workspace_in
>  	pointer_noop_grab_focus,
>  	pointer_move_grab_motion,
>  	pointer_move_workspace_grab_button,
> +	pointer_default_grab_axis,
>  	pointer_move_workspace_grab_cancel
>  };
>  
> diff --git a/src/compositor.h b/src/compositor.h
> index 867f8c4..fc80eb0 100644
> --- a/src/compositor.h
> +++ b/src/compositor.h
> @@ -253,6 +253,8 @@ struct weston_pointer_grab_interface {
>  		       wl_fixed_t x, wl_fixed_t y);
>  	void (*button)(struct weston_pointer_grab *grab,
>  		       uint32_t time, uint32_t button, uint32_t state);
> +	void (*axis)(struct weston_pointer_grab *grab,
> +		     uint32_t time, uint32_t axis, wl_fixed_t value);
>  	void (*cancel)(struct weston_pointer_grab *grab);
>  };
>  
> @@ -375,6 +377,9 @@ weston_pointer_create(struct weston_seat *seat);
>  void
>  weston_pointer_destroy(struct weston_pointer *pointer);
>  void
> +weston_pointer_send_axis(struct weston_pointer *pointer,
> +			 uint32_t time, uint32_t axis, wl_fixed_t value);
> +void
>  weston_pointer_set_focus(struct weston_pointer *pointer,
>  			 struct weston_view *view,
>  			 wl_fixed_t sx, wl_fixed_t sy);
> diff --git a/src/data-device.c b/src/data-device.c
> index 3e7baf9..fc93435 100644
> --- a/src/data-device.c
> +++ b/src/data-device.c
> @@ -407,6 +407,12 @@ drag_grab_button(struct weston_pointer_grab *grab,
>  }
>  
>  static void
> +drag_grab_axis(struct weston_pointer_grab *grab,
> +	       uint32_t time, uint32_t axis, wl_fixed_t value)
> +{
> +}
> +
> +static void
>  drag_grab_cancel(struct weston_pointer_grab *grab)
>  {
>  	struct weston_pointer_drag *drag =
> @@ -422,6 +428,7 @@ static const struct weston_pointer_grab_interface pointer_drag_grab_interface =
>  	drag_grab_focus,
>  	drag_grab_motion,
>  	drag_grab_button,
> +	drag_grab_axis,
>  	drag_grab_cancel,
>  };
>  
> diff --git a/src/input.c b/src/input.c
> index 6604c5d..fe1851a 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -217,6 +217,25 @@ default_grab_pointer_button(struct weston_pointer_grab *grab,
>  	}
>  }
>  
> +void
> +weston_pointer_send_axis(struct weston_pointer *pointer,
> +			 uint32_t time, uint32_t axis, wl_fixed_t value)
> +{
> +	struct wl_resource *resource;
> +	struct wl_list *resource_list;
> +
> +	resource_list = &pointer->focus_resource_list;
> +	wl_resource_for_each(resource, resource_list)
> +		wl_pointer_send_axis(resource, time, axis, value);
> +}
> +
> +static void
> +default_grab_pointer_axis(struct weston_pointer_grab *grab,
> +			  uint32_t time, uint32_t axis, wl_fixed_t value)
> +{
> +	weston_pointer_send_axis(grab->pointer, time, axis, value);
> +}
> +
>  static void
>  default_grab_pointer_cancel(struct weston_pointer_grab *grab)
>  {
> @@ -227,6 +246,7 @@ static const struct weston_pointer_grab_interface
>  	default_grab_pointer_focus,
>  	default_grab_pointer_motion,
>  	default_grab_pointer_button,
> +	default_grab_pointer_axis,
>  	default_grab_pointer_cancel,
>  };
>  
> @@ -1046,8 +1066,6 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
>  {
>  	struct weston_compositor *compositor = seat->compositor;
>  	struct weston_pointer *pointer = seat->pointer;
> -	struct wl_resource *resource;
> -	struct wl_list *resource_list;
>  
>  	weston_compositor_wake(compositor);
>  
> @@ -1058,10 +1076,7 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
>  						   time, axis, value))
>  		return;
>  
> -	resource_list = &pointer->focus_resource_list;
> -	wl_resource_for_each(resource, resource_list)
> -		wl_pointer_send_axis(resource, time, axis,
> -				     value);
> +	pointer->grab->interface->axis(pointer->grab, time, axis, value);
>  }
>  
>  WL_EXPORT int
> 



More information about the wayland-devel mailing list