On Fri, Jul 31, 2015 at 03:59:54PM +0200, Carlos Garnacho wrote: > Just print the output, as with the other events. > > Signed-off-by: Carlos Garnacho <[email protected]> > Reviewed-by: Jonas Ã…dahl <[email protected]>
One minor comment, but otherwise LGTM: Reviewed-by: Bryce Harrington <[email protected]> > --- > clients/eventdemo.c | 108 > +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 107 insertions(+), 1 deletion(-) > > diff --git a/clients/eventdemo.c b/clients/eventdemo.c > index dc69fd6..126d02d 100644 > --- a/clients/eventdemo.c > +++ b/clients/eventdemo.c > @@ -80,6 +80,12 @@ static int log_axis = 0; > /** set to log motion events */ > static int log_motion = 0; > > +/** set to log swipe gesture events */ > +static int log_swipe_gesture = 0; > + > +/** set to log pinch gesture events */ > +static int log_pinch_gesture = 0; > + > /** > * \struct eventdemo > * \brief Holds all data the program needs per window > @@ -289,6 +295,89 @@ motion_handler(struct widget *widget, struct input > *input, uint32_t time, > return CURSOR_LEFT_PTR; > } > > +static void > +gesture_swipe_begin_handler(struct widget *widget, > + struct input *input, > + uint32_t time, > + uint32_t n_fingers, > + void *data) > +{ > + if (log_swipe_gesture) { > + printf("swipe gesture begin time: %d, fingers: %d\n", > + time, n_fingers); > + } > +} > + > +static void > +gesture_swipe_update_handler(struct widget *widget, > + struct input *input, > + uint32_t time, > + float dx, > + float dy, > + void *data) > +{ > + if (log_swipe_gesture) { > + printf("swipe gesture update time: %d, dx: %f, dy: %f\n", > + time, dx, dy); > + } > +} > + > +static void > +gesture_swipe_end_handler(struct widget *widget, > + struct input *input, > + uint32_t time, > + int32_t cancelled, > + void *data) > +{ > + if (log_swipe_gesture) { > + printf("swipe gesture end time: %d, cancelled: %d\n", > + time, cancelled); > + } > +} > + > +static void > +gesture_pinch_begin_handler(struct widget *widget, > + struct input *input, > + uint32_t time, > + uint32_t n_fingers, > + void *data) > +{ > + if (log_pinch_gesture) { > + printf("pinch gesture begin time: %d, fingers: %d\n", > + time, n_fingers); > + } > +} > + > +static void > +gesture_pinch_update_handler(struct widget *widget, > + struct input *input, > + uint32_t time, > + float dx, > + float dy, > + float scale, > + float rotation_delta, > + void *data) > +{ > + if (log_pinch_gesture) { > + printf("pinch gesture update time: %d, dx: %f, dy: %f, " > + "scale: %f, rotation delta: %f\n", > + time, dx, dy, scale, rotation_delta); > + } > +} > + > +static void > +gesture_pinch_end_handler(struct widget *widget, > + struct input *input, > + uint32_t time, > + int32_t cancelled, > + void *data) > +{ > + if (log_pinch_gesture) { > + printf("pinch gesture end time: %d, cancelled: %d\n", > + time, cancelled); > + } > +} > + > /** > * \brief Create and initialise a new eventdemo window. > * The returned eventdemo instance should be destroyed using \c > eventdemo_destroy(). > @@ -350,6 +439,20 @@ eventdemo_create(struct display *d) > /* Set the callback axis handler for the window */ > widget_set_axis_handler(e->widget, axis_handler); > > + /* Set gesture handlers for the window */ > + widget_set_pointer_gesture_swipe_begin_handler(e->widget, > + > gesture_swipe_begin_handler); > + widget_set_pointer_gesture_swipe_update_handler(e->widget, > + > gesture_swipe_update_handler); > + widget_set_pointer_gesture_swipe_end_handler(e->widget, > + gesture_swipe_end_handler); > + widget_set_pointer_gesture_pinch_begin_handler(e->widget, > + > gesture_pinch_begin_handler); > + widget_set_pointer_gesture_pinch_update_handler(e->widget, > + > gesture_pinch_update_handler); > + widget_set_pointer_gesture_pinch_end_handler(e->widget, > + gesture_pinch_end_handler); > + > /* Initial drawing of the window */ > window_schedule_resize(e->window, width, height); > > @@ -382,6 +485,8 @@ static const struct weston_option eventdemo_options[] = { > { WESTON_OPTION_BOOLEAN, "log-button", 0, &log_button }, > { WESTON_OPTION_BOOLEAN, "log-axis", 0, &log_axis }, > { WESTON_OPTION_BOOLEAN, "log-motion", 0, &log_motion }, > + { WESTON_OPTION_BOOLEAN, "log-swipe-gesture", 0, &log_swipe_gesture }, > + { WESTON_OPTION_BOOLEAN, "log-pinch-gesture", 0, &log_pinch_gesture }, > }; > > /** > @@ -419,7 +524,8 @@ main(int argc, char *argv[]) > if (!log_redraw && !log_resize && !log_focus && !log_key && > !log_button && !log_axis && !log_motion) > log_redraw = log_resize = log_focus = log_key = > - log_button = log_axis = log_motion = 1; > + log_button = log_axis = log_motion = > + log_swipe_gesture = log_pinch_gesture = 1; This is kind of funky, and the empty equal sign initially looked like a typo. I don't think it buys anything, let's just keep it simple: log_button = log_axis = log_motion = 1; log_swipe_gesture = log_pinch_gesture = 1; > /* Connect to the display and have the arguments parsed */ > d = display_create(&argc, argv); > -- > 2.4.3 > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
