Re: [PATCH v5 weston 2/2] Support axis source, axis discrete, frame and axis stop events

2016-01-18 Thread Jonas Ådahl
This one is now also pushed, with a couple of fixes (resource version
checks before sending wl_pointer.frame when changing pointer focus).


Jonas


On Mon, Jan 18, 2016 at 04:38:22PM +1000, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer 
> ---
> Changes to v2:
> - don't send frames after focus events, notify_pointer_focus() takes
>   care of that
> - add frame events to screen-share
> 
>  clients/eventdemo.c   |  57 -
>  clients/window.c  |  97 -
>  clients/window.h  |  31 +
>  desktop-shell/exposay.c   |  12 
>  desktop-shell/shell.c |  33 ++
>  ivi-shell/hmi-controller.c|  15 +
>  src/compositor-rdp.c  |  20 --
>  src/compositor-wayland.c  |  84 -
>  src/compositor-x11.c  |  10 +++
>  src/compositor.h  |  16 +
>  src/data-device.c |  12 
>  src/input.c   |  93 ---
>  src/libinput-device.c | 128 
> --
>  src/screen-share.c|   4 ++
>  tests/weston-test-client-helper.c |  32 ++
>  15 files changed, 596 insertions(+), 48 deletions(-)
> 
> diff --git a/clients/eventdemo.c b/clients/eventdemo.c
> index bdad6fd..e323aa5 100644
> --- a/clients/eventdemo.c
> +++ b/clients/eventdemo.c
> @@ -259,6 +259,54 @@ axis_handler(struct widget *widget, struct input *input, 
> uint32_t time,
>  wl_fixed_to_double(value));
>  }
>  
> +static void
> +pointer_frame_handler(struct widget *widget, struct input *input, void *data)
> +{
> + printf("pointer frame\n");
> +}
> +
> +static void
> +axis_source_handler(struct widget *widget, struct input *input,
> + uint32_t source, void *data)
> +{
> + const char *axis_source;
> +
> + switch (source) {
> + case WL_POINTER_AXIS_SOURCE_WHEEL:
> + axis_source = "wheel";
> + break;
> + case WL_POINTER_AXIS_SOURCE_FINGER:
> + axis_source = "finger";
> + break;
> + case WL_POINTER_AXIS_SOURCE_CONTINUOUS:
> + axis_source = "continuous";
> + break;
> + default:
> + axis_source = "";
> + break;
> + }
> +
> + printf("axis source: %s\n", axis_source);
> +}
> +
> +static void
> +axis_stop_handler(struct widget *widget, struct input *input,
> +   uint32_t time, uint32_t axis,
> +   void *data)
> +{
> + printf("axis stop time: %d, axis: %s\n",
> +time,
> +axis == WL_POINTER_AXIS_VERTICAL_SCROLL ? "vertical" :
> +  "horizontal");
> +}
> +
> +static void
> +axis_discrete_handler(struct widget *widget, struct input *input,
> +   uint32_t axis, int32_t discrete, void *data)
> +{
> + printf("axis discrete axis: %d value: %d\n", axis, discrete);
> +}
> +
>  /**
>   * \brief CALLBACK function, Waylands informs about pointer motion
>   * \param widget widget
> @@ -347,8 +395,15 @@ eventdemo_create(struct display *d)
>   /* Set the callback motion handler for the window */
>   widget_set_motion_handler(e->widget, motion_handler);
>  
> + /* Set the callback pointer frame handler for the window */
> + widget_set_pointer_frame_handler(e->widget, pointer_frame_handler);
> +
>   /* Set the callback axis handler for the window */
> - widget_set_axis_handler(e->widget, axis_handler);
> + widget_set_axis_handlers(e->widget,
> +  axis_handler,
> +  axis_source_handler,
> +  axis_stop_handler,
> +  axis_discrete_handler);
>  
>   /* Initial drawing of the window */
>   window_schedule_resize(e->window, width, height);
> diff --git a/clients/window.c b/clients/window.c
> index 5d69116..7d45acd 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -282,6 +282,10 @@ struct widget {
>   widget_touch_frame_handler_t touch_frame_handler;
>   widget_touch_cancel_handler_t touch_cancel_handler;
>   widget_axis_handler_t axis_handler;
> + widget_pointer_frame_handler_t pointer_frame_handler;
> + widget_axis_source_handler_t axis_source_handler;
> + widget_axis_stop_handler_t axis_stop_handler;
> + widget_axis_discrete_handler_t axis_discrete_handler;
>   void *user_data;
>   int opaque;
>   int tooltip_count;
> @@ -1930,6 +1934,26 @@ widget_set_axis_handler(struct widget *widget,
>   widget->axis_handler = handler;
>  }
>  
> +void
> +widget_set_pointer_frame_handler(struct widget *widget,
> +  widget_pointer_frame_handler_t handler)
> +{
> + widget->pointer_frame_handler = handler;
> +}
> +
> +void
> +widget_set_axis_handlers(struct widget *widget,
> +   

Re: [PATCH v5 weston 2/2] Support axis source, axis discrete, frame and axis stop events

2016-01-17 Thread Jonas Ådahl
On Mon, Jan 18, 2016 at 04:38:22PM +1000, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer 

Re-adding my RB to this and v4 of 1/2. Eventually I think it'd be good
to introduce a weston_pointer_event that doesn't make it necessary to
emit the unnecessary (though harmless) wl_pointer.frame events that we
now emit for example when a notify_motion ended up being constrained and
not result in a motion event. Though I think this is good enough for
now.


Jonas

> ---
> Changes to v2:
> - don't send frames after focus events, notify_pointer_focus() takes
>   care of that
> - add frame events to screen-share
> 
>  clients/eventdemo.c   |  57 -
>  clients/window.c  |  97 -
>  clients/window.h  |  31 +
>  desktop-shell/exposay.c   |  12 
>  desktop-shell/shell.c |  33 ++
>  ivi-shell/hmi-controller.c|  15 +
>  src/compositor-rdp.c  |  20 --
>  src/compositor-wayland.c  |  84 -
>  src/compositor-x11.c  |  10 +++
>  src/compositor.h  |  16 +
>  src/data-device.c |  12 
>  src/input.c   |  93 ---
>  src/libinput-device.c | 128 
> --
>  src/screen-share.c|   4 ++
>  tests/weston-test-client-helper.c |  32 ++
>  15 files changed, 596 insertions(+), 48 deletions(-)
> 
> diff --git a/clients/eventdemo.c b/clients/eventdemo.c
> index bdad6fd..e323aa5 100644
> --- a/clients/eventdemo.c
> +++ b/clients/eventdemo.c
> @@ -259,6 +259,54 @@ axis_handler(struct widget *widget, struct input *input, 
> uint32_t time,
>  wl_fixed_to_double(value));
>  }
>  
> +static void
> +pointer_frame_handler(struct widget *widget, struct input *input, void *data)
> +{
> + printf("pointer frame\n");
> +}
> +
> +static void
> +axis_source_handler(struct widget *widget, struct input *input,
> + uint32_t source, void *data)
> +{
> + const char *axis_source;
> +
> + switch (source) {
> + case WL_POINTER_AXIS_SOURCE_WHEEL:
> + axis_source = "wheel";
> + break;
> + case WL_POINTER_AXIS_SOURCE_FINGER:
> + axis_source = "finger";
> + break;
> + case WL_POINTER_AXIS_SOURCE_CONTINUOUS:
> + axis_source = "continuous";
> + break;
> + default:
> + axis_source = "";
> + break;
> + }
> +
> + printf("axis source: %s\n", axis_source);
> +}
> +
> +static void
> +axis_stop_handler(struct widget *widget, struct input *input,
> +   uint32_t time, uint32_t axis,
> +   void *data)
> +{
> + printf("axis stop time: %d, axis: %s\n",
> +time,
> +axis == WL_POINTER_AXIS_VERTICAL_SCROLL ? "vertical" :
> +  "horizontal");
> +}
> +
> +static void
> +axis_discrete_handler(struct widget *widget, struct input *input,
> +   uint32_t axis, int32_t discrete, void *data)
> +{
> + printf("axis discrete axis: %d value: %d\n", axis, discrete);
> +}
> +
>  /**
>   * \brief CALLBACK function, Waylands informs about pointer motion
>   * \param widget widget
> @@ -347,8 +395,15 @@ eventdemo_create(struct display *d)
>   /* Set the callback motion handler for the window */
>   widget_set_motion_handler(e->widget, motion_handler);
>  
> + /* Set the callback pointer frame handler for the window */
> + widget_set_pointer_frame_handler(e->widget, pointer_frame_handler);
> +
>   /* Set the callback axis handler for the window */
> - widget_set_axis_handler(e->widget, axis_handler);
> + widget_set_axis_handlers(e->widget,
> +  axis_handler,
> +  axis_source_handler,
> +  axis_stop_handler,
> +  axis_discrete_handler);
>  
>   /* Initial drawing of the window */
>   window_schedule_resize(e->window, width, height);
> diff --git a/clients/window.c b/clients/window.c
> index 5d69116..7d45acd 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -282,6 +282,10 @@ struct widget {
>   widget_touch_frame_handler_t touch_frame_handler;
>   widget_touch_cancel_handler_t touch_cancel_handler;
>   widget_axis_handler_t axis_handler;
> + widget_pointer_frame_handler_t pointer_frame_handler;
> + widget_axis_source_handler_t axis_source_handler;
> + widget_axis_stop_handler_t axis_stop_handler;
> + widget_axis_discrete_handler_t axis_discrete_handler;
>   void *user_data;
>   int opaque;
>   int tooltip_count;
> @@ -1930,6 +1934,26 @@ widget_set_axis_handler(struct widget *widget,
>   widget->axis_handler = handler;
>  }
>  
> +void
> +widget_set_pointer_frame_handler(struct widge

[PATCH v5 weston 2/2] Support axis source, axis discrete, frame and axis stop events

2016-01-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
Changes to v2:
- don't send frames after focus events, notify_pointer_focus() takes
  care of that
- add frame events to screen-share

 clients/eventdemo.c   |  57 -
 clients/window.c  |  97 -
 clients/window.h  |  31 +
 desktop-shell/exposay.c   |  12 
 desktop-shell/shell.c |  33 ++
 ivi-shell/hmi-controller.c|  15 +
 src/compositor-rdp.c  |  20 --
 src/compositor-wayland.c  |  84 -
 src/compositor-x11.c  |  10 +++
 src/compositor.h  |  16 +
 src/data-device.c |  12 
 src/input.c   |  93 ---
 src/libinput-device.c | 128 --
 src/screen-share.c|   4 ++
 tests/weston-test-client-helper.c |  32 ++
 15 files changed, 596 insertions(+), 48 deletions(-)

diff --git a/clients/eventdemo.c b/clients/eventdemo.c
index bdad6fd..e323aa5 100644
--- a/clients/eventdemo.c
+++ b/clients/eventdemo.c
@@ -259,6 +259,54 @@ axis_handler(struct widget *widget, struct input *input, 
uint32_t time,
   wl_fixed_to_double(value));
 }
 
+static void
+pointer_frame_handler(struct widget *widget, struct input *input, void *data)
+{
+   printf("pointer frame\n");
+}
+
+static void
+axis_source_handler(struct widget *widget, struct input *input,
+   uint32_t source, void *data)
+{
+   const char *axis_source;
+
+   switch (source) {
+   case WL_POINTER_AXIS_SOURCE_WHEEL:
+   axis_source = "wheel";
+   break;
+   case WL_POINTER_AXIS_SOURCE_FINGER:
+   axis_source = "finger";
+   break;
+   case WL_POINTER_AXIS_SOURCE_CONTINUOUS:
+   axis_source = "continuous";
+   break;
+   default:
+   axis_source = "";
+   break;
+   }
+
+   printf("axis source: %s\n", axis_source);
+}
+
+static void
+axis_stop_handler(struct widget *widget, struct input *input,
+ uint32_t time, uint32_t axis,
+ void *data)
+{
+   printf("axis stop time: %d, axis: %s\n",
+  time,
+  axis == WL_POINTER_AXIS_VERTICAL_SCROLL ? "vertical" :
+"horizontal");
+}
+
+static void
+axis_discrete_handler(struct widget *widget, struct input *input,
+ uint32_t axis, int32_t discrete, void *data)
+{
+   printf("axis discrete axis: %d value: %d\n", axis, discrete);
+}
+
 /**
  * \brief CALLBACK function, Waylands informs about pointer motion
  * \param widget widget
@@ -347,8 +395,15 @@ eventdemo_create(struct display *d)
/* Set the callback motion handler for the window */
widget_set_motion_handler(e->widget, motion_handler);
 
+   /* Set the callback pointer frame handler for the window */
+   widget_set_pointer_frame_handler(e->widget, pointer_frame_handler);
+
/* Set the callback axis handler for the window */
-   widget_set_axis_handler(e->widget, axis_handler);
+   widget_set_axis_handlers(e->widget,
+axis_handler,
+axis_source_handler,
+axis_stop_handler,
+axis_discrete_handler);
 
/* Initial drawing of the window */
window_schedule_resize(e->window, width, height);
diff --git a/clients/window.c b/clients/window.c
index 5d69116..7d45acd 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -282,6 +282,10 @@ struct widget {
widget_touch_frame_handler_t touch_frame_handler;
widget_touch_cancel_handler_t touch_cancel_handler;
widget_axis_handler_t axis_handler;
+   widget_pointer_frame_handler_t pointer_frame_handler;
+   widget_axis_source_handler_t axis_source_handler;
+   widget_axis_stop_handler_t axis_stop_handler;
+   widget_axis_discrete_handler_t axis_discrete_handler;
void *user_data;
int opaque;
int tooltip_count;
@@ -1930,6 +1934,26 @@ widget_set_axis_handler(struct widget *widget,
widget->axis_handler = handler;
 }
 
+void
+widget_set_pointer_frame_handler(struct widget *widget,
+widget_pointer_frame_handler_t handler)
+{
+   widget->pointer_frame_handler = handler;
+}
+
+void
+widget_set_axis_handlers(struct widget *widget,
+   widget_axis_handler_t axis_handler,
+   widget_axis_source_handler_t axis_source_handler,
+   widget_axis_stop_handler_t axis_stop_handler,
+   widget_axis_discrete_handler_t axis_discrete_handler)
+{
+   widget->axis_handler = axis_handler;
+   widget->axis_source_handler = axis_source_ha