[PATCH libinput 4/8] tablet: Merge PROXIMITY_IN and PROXIMITY_OUT into a single event

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 17 14:59:52 PST 2015


On Mon, Feb 16, 2015 at 10:48:42PM -0500, Stephen Chandler Paul wrote:
> There isn't much purpose in having proximity in and out as different events,
> combining them into one single event is more consistent with the rest of the
> API, and means less code for clients to have to work with.
> 
> Signed-off-by: Stephen Chandler Paul <thatslyude at gmail.com>

couple of minor changes, nothing major. Merged, thanks.

>  src/evdev-tablet.c     | 18 ++++++------
>  src/libinput-private.h | 15 ++++------
>  src/libinput.c         | 74 ++++++++++++++++++--------------------------------
>  src/libinput.h         | 58 ++++++++++++++++++++++++---------------
>  src/libinput.sym       |  1 +
>  test/litest.c          |  7 ++---
>  test/tablet.c          | 28 +++++++++++--------
>  tools/event-debug.c    | 36 ++++++++++++------------
>  tools/event-gui.c      |  3 +-
>  9 files changed, 115 insertions(+), 125 deletions(-)
> 
> diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
> index a87e2b7..ec4fbfc 100644
> --- a/src/evdev-tablet.c
> +++ b/src/evdev-tablet.c
> @@ -471,10 +471,11 @@ tablet_flush(struct tablet_dispatch *tablet,
>  		tablet->button_state.stylus_buttons = 0;
>  		tablet_set_status(tablet, TABLET_BUTTONS_RELEASED);
>  	} else if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) {
> -		tablet_notify_proximity_in(&device->base,
> -					   time,
> -					   tool,
> -					   tablet->axes);
> +		tablet_notify_proximity(&device->base,
> +					time,
> +					tool,
> +					LIBINPUT_TOOL_PROXIMITY_IN,
> +					tablet->axes);
>  		tablet_unset_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY);
>  	}
>  
> @@ -503,10 +504,11 @@ tablet_flush(struct tablet_dispatch *tablet,
>  	}
>  
>  	if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) {
> -		tablet_notify_proximity_out(&device->base,
> -					    time,
> -					    tool,
> -					    tablet->axes);
> +		tablet_notify_proximity(&device->base,
> +					time,
> +					tool,
> +					LIBINPUT_TOOL_PROXIMITY_OUT,
> +					tablet->axes);
>  		tablet_set_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY);
>  		tablet_unset_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY);
>  
> diff --git a/src/libinput-private.h b/src/libinput-private.h
> index 7b4a0d6..415aac4 100644
> --- a/src/libinput-private.h
> +++ b/src/libinput-private.h
> @@ -350,16 +350,11 @@ tablet_notify_axis(struct libinput_device *device,
>  		   double *axes);
>  
>  void
> -tablet_notify_proximity_in(struct libinput_device *device,
> -			   uint32_t time,
> -			   struct libinput_tool *tool,
> -			   double *axes);
> -
> -void
> -tablet_notify_proximity_out(struct libinput_device *device,
> -			    uint32_t time,
> -			    struct libinput_tool *tool,
> -			    double *axes);
> +tablet_notify_proximity(struct libinput_device *device,
> +			uint32_t time,
> +			struct libinput_tool *tool,
> +			enum libinput_tool_proximity_state state,
> +			double *axes);
>  
>  void
>  tablet_notify_button(struct libinput_device *device,
> diff --git a/src/libinput.c b/src/libinput.c
> index 5e7514b..38c2fd7 100644
> --- a/src/libinput.c
> +++ b/src/libinput.c
> @@ -88,6 +88,7 @@ struct libinput_event_tablet {
>  	double axes[LIBINPUT_TABLET_AXIS_CNT];
>  	unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_AXIS_CNT)];
>  	struct libinput_tool *tool;
> +	enum libinput_tool_proximity_state proximity_state;
>  };
>  
>  static void
> @@ -194,8 +195,7 @@ libinput_event_get_pointer_event(struct libinput_event *event)
>  	case LIBINPUT_EVENT_TOUCH_CANCEL:
>  	case LIBINPUT_EVENT_TOUCH_FRAME:
>  	case LIBINPUT_EVENT_TABLET_AXIS:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> +	case LIBINPUT_EVENT_TABLET_PROXIMITY:
>  	case LIBINPUT_EVENT_TABLET_BUTTON:
>  		break;
>  	}
> @@ -224,8 +224,7 @@ libinput_event_get_keyboard_event(struct libinput_event *event)
>  	case LIBINPUT_EVENT_TOUCH_CANCEL:
>  	case LIBINPUT_EVENT_TOUCH_FRAME:
>  	case LIBINPUT_EVENT_TABLET_AXIS:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> +	case LIBINPUT_EVENT_TABLET_PROXIMITY:
>  	case LIBINPUT_EVENT_TABLET_BUTTON:
>  		break;
>  	}
> @@ -254,8 +253,7 @@ libinput_event_get_touch_event(struct libinput_event *event)
>  	case LIBINPUT_EVENT_TOUCH_FRAME:
>  		return (struct libinput_event_touch *) event;
>  	case LIBINPUT_EVENT_TABLET_AXIS:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> +	case LIBINPUT_EVENT_TABLET_PROXIMITY:
>  	case LIBINPUT_EVENT_TABLET_BUTTON:
>  		break;
>  	}
> @@ -283,8 +281,7 @@ libinput_event_get_tablet_event(struct libinput_event *event)
>  	case LIBINPUT_EVENT_TOUCH_FRAME:
>  		break;
>  	case LIBINPUT_EVENT_TABLET_AXIS:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> +	case LIBINPUT_EVENT_TABLET_PROXIMITY:
>  	case LIBINPUT_EVENT_TABLET_BUTTON:
>  		return (struct libinput_event_tablet *) event;
>  	}
> @@ -312,8 +309,7 @@ libinput_event_get_device_notify_event(struct libinput_event *event)
>  	case LIBINPUT_EVENT_TOUCH_CANCEL:
>  	case LIBINPUT_EVENT_TOUCH_FRAME:
>  	case LIBINPUT_EVENT_TABLET_AXIS:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> +	case LIBINPUT_EVENT_TABLET_PROXIMITY:
>  	case LIBINPUT_EVENT_TABLET_BUTTON:
>  		break;
>  	}
> @@ -629,6 +625,12 @@ libinput_event_tablet_get_tool(struct libinput_event_tablet *event)
>  	return event->tool;
>  }
>  
> +LIBINPUT_EXPORT enum libinput_tool_proximity_state
> +libinput_event_tablet_get_proximity_state(struct libinput_event_tablet *event)
> +{
> +	return event->proximity_state;
> +}
> +
>  LIBINPUT_EXPORT uint32_t
>  libinput_event_tablet_get_time(struct libinput_event_tablet *event)
>  {
> @@ -1403,55 +1405,31 @@ tablet_notify_axis(struct libinput_device *device,
>  }
>  
>  void
> -tablet_notify_proximity_in(struct libinput_device *device,
> -			   uint32_t time,
> -			   struct libinput_tool *tool,
> -			   double *axes)
> -{
> -	struct libinput_event_tablet *proximity_in_event;
> -
> -	proximity_in_event = zalloc(sizeof *proximity_in_event);
> -	if (!proximity_in_event)
> -		return;
> -
> -	*proximity_in_event = (struct libinput_event_tablet) {
> -		.time = time,
> -		.tool = tool,
> -	};
> -	memcpy(proximity_in_event->axes,
> -	       axes,
> -	       sizeof(proximity_in_event->axes));
> -
> -	post_device_event(device,
> -			  time,
> -			  LIBINPUT_EVENT_TABLET_PROXIMITY_IN,
> -			  &proximity_in_event->base);
> -}
> -
> -void
> -tablet_notify_proximity_out(struct libinput_device *device,
> -			    uint32_t time,
> -			    struct libinput_tool *tool,
> -			    double *axes)
> +tablet_notify_proximity(struct libinput_device *device,
> +			uint32_t time,
> +			struct libinput_tool *tool,
> +			enum libinput_tool_proximity_state proximity_state,
> +			double *axes)
>  {
> -	struct libinput_event_tablet *proximity_out_update_event;
> +	struct libinput_event_tablet *proximity_event;
>  
> -	proximity_out_update_event = zalloc(sizeof *proximity_out_update_event);
> -	if (!proximity_out_update_event)
> +	proximity_event = zalloc(sizeof *proximity_event);
> +	if (!proximity_event)
>  		return;
>  
> -	*proximity_out_update_event = (struct libinput_event_tablet) {
> +	*proximity_event = (struct libinput_event_tablet) {
>  		.time = time,
>  		.tool = tool,
> +		.proximity_state = proximity_state,
>  	};
> -	memcpy(proximity_out_update_event->axes,
> +	memcpy(proximity_event->axes,
>  	       axes,
> -	       sizeof(proximity_out_update_event->axes));
> +	       sizeof(proximity_event->axes));
>  
>  	post_device_event(device,
>  			  time,
> -			  LIBINPUT_EVENT_TABLET_PROXIMITY_OUT,
> -			  &proximity_out_update_event->base);
> +			  LIBINPUT_EVENT_TABLET_PROXIMITY,
> +			  &proximity_event->base);
>  }
>  
>  void
> diff --git a/src/libinput.h b/src/libinput.h
> index 8b93bf3..1f5ce20 100644
> --- a/src/libinput.h
> +++ b/src/libinput.h
> @@ -173,6 +173,17 @@ enum libinput_tool_type {
>  };
>  
>  /**
> + * @ingroup device
> + *
> + * The state of proximity for a tool on a device. The device must have the @ref
> + * LIBINPUT_DEVICE_CAP_TABLET capability.
> + */
> +enum libinput_tool_proximity_state {
> +	LIBINPUT_TOOL_PROXIMITY_IN,
> +	LIBINPUT_TOOL_PROXIMITY_OUT
> +};
> +

minor change added to be consistent with the released/press enums:

diff --git a/src/libinput.h b/src/libinput.h
index 1f5ce20..2c9b1c5 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -179,8 +179,8 @@ enum libinput_tool_type {
  * LIBINPUT_DEVICE_CAP_TABLET capability.
  */
 enum libinput_tool_proximity_state {
-       LIBINPUT_TOOL_PROXIMITY_IN,
-       LIBINPUT_TOOL_PROXIMITY_OUT
+       LIBINPUT_TOOL_PROXIMITY_OUT = 0,
+       LIBINPUT_TOOL_PROXIMITY_IN = 1,
 };


> ---
> +/**
>   * @ingroup base
>   *
>   * Event type for events returned by libinput_get_event().
> @@ -220,36 +231,26 @@ enum libinput_event_type {
>  
>  	LIBINPUT_EVENT_TABLET_AXIS = 600,
>  	/**
> -	 * Signals that a tool has come into proximity of a device with the @ref
> -	 * LIBINPUT_DEVICE_CAP_TABLET capability.
> +	 * Signals that a tool has come in or out of proximity of a device with
> +	 * the @ref LIBINPUT_DEVICE_CAP_TABLET capability.
>  	 *
> -	 * Some tools may always be in proximity. For these tools, the @ref
> -	 * LIBINPUT_EVENT_TABLET_PROXIMITY_IN is sent only once after @ref
> -	 * LIBINPUT_EVENT_DEVICE_ADDED, and likewise the @ref
> -	 * LIBINPUT_EVENT_TABLET_PROXIMITY_OUT is sent only once before @ref
> +	 * Some tools may always be in proximity. For these tools, events with
> +	 * state @ref LIBINPUT_TOOL_PROXIMITY_IN are sent only once after @ref
> +	 * LIBINPUT_EVENT_DEVICE_ADDED, and likewise events with state @ref
> +	 * LIBINPUT_TOOL_PROXIMITY_OUT are sent only once before @ref
>  	 * LIBINPUT_EVENT_DEVICE_REMOVED.
>  	 *
>  	 * If the tool that comes into proximity supports x/y coordinates,
>  	 * libinput guarantees that both x and y are set in the proximity
>  	 * event.
> -	 */
> -	LIBINPUT_EVENT_TABLET_PROXIMITY_IN,
> -	/**
> -	 * Signals that a device with the @ref LIBINPUT_DEVICE_CAP_TABLET
> -	 * capability has detected that there is no longer a tool in use. When
> -	 * this happens, the value of every axis should be assumed to have a
> -	 * value of 0 and any buttons that are currently held down on the stylus
> -	 * are marked as released. Button release events for each button that
> -	 * was held down on the stylus are sent before the initial proximity out
> -	 * event.
>  	 *
> -	 * Some tools may always be in proximity. For these tools, the @ref
> -	 * LIBINPUT_EVENT_TABLET_PROXIMITY_IN is sent only once after @ref
> -	 * LIBINPUT_EVENT_DEVICE_ADDED, and likewise the @ref
> -	 * LIBINPUT_EVENT_TABLET_PROXIMITY_OUT is sent only once before @ref
> -	 * LIBINPUT_EVENT_DEVICE_REMOVED.
> +	 * When a tool comes out of proximity, the value of every axis should be

replaced:  comes -> goes

> +	 * assumed to have a value of 0 and any buttons that are currently held

I left this in for now but that's not actually correct: we don't assume that
going out of proximity reset x/y to 0. Some rewording (or just skipping it) would
be good here.

> +	 * down on the stylus are marked as released. Button release events for
> +	 * each button that was held down on the stylus are sent before the
> +	 * initial proximity out event.
>  	 */
> -	LIBINPUT_EVENT_TABLET_PROXIMITY_OUT,
> +	LIBINPUT_EVENT_TABLET_PROXIMITY,
>  	LIBINPUT_EVENT_TABLET_BUTTON
>  };
>  
> @@ -1095,6 +1096,19 @@ libinput_event_tablet_get_tool(struct libinput_event_tablet *event);
>  /**
>   * @ingroup event_tablet
>   *
> + * Returns the new proximity state of a tool from a proximity event.
> + * Used to check whether or not a tool came in or out of proximity during an
> + * event of type @ref LIBINPUT_EVENT_TABLET_PROXIMITY.
> + *
> + * @param event The libinput tablet event
> + * @return The new proximity state of the tool from the event.
> + */
> +enum libinput_tool_proximity_state
> +libinput_event_tablet_get_proximity_state(struct libinput_event_tablet *event);
> +
> +/**
> + * @ingroup event_tablet
> + *
>   * Return the button that triggered this event.
>   * For tablet events that are not of type @ref LIBINPUT_EVENT_TABLET_BUTTON, this
>   * function returns 0.
> diff --git a/src/libinput.sym b/src/libinput.sym
> index d235e18..b377d64 100644
> --- a/src/libinput.sym
> +++ b/src/libinput.sym
> @@ -137,6 +137,7 @@ global:
>  	libinput_event_tablet_get_seat_button_count;
>  	libinput_event_tablet_get_time;
>  	libinput_event_tablet_get_tool;
> +	libinput_event_tablet_get_proximity_state;
>  	libinput_event_tablet_get_x_transformed;
>  	libinput_event_tablet_get_y_transformed;
>  	libinput_tool_get_serial;
> diff --git a/test/litest.c b/test/litest.c
> index 73228b4..199c0a1 100644
> --- a/test/litest.c
> +++ b/test/litest.c
> @@ -1152,11 +1152,8 @@ litest_event_type_str(struct libinput_event *event)
>  	case LIBINPUT_EVENT_TABLET_AXIS:
>  		str = "TABLET AXIS";
>  		break;
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -		str = "TABLET PROX IN";
> -		break;
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> -		str = "TABLET PROX OUT";
> +	case LIBINPUT_EVENT_TABLET_PROXIMITY:
> +		str = "TABLET PROX";
>  		break;
>  	case LIBINPUT_EVENT_TABLET_BUTTON:
>  		str = "TABLET BUTTON";
> diff --git a/test/tablet.c b/test/tablet.c
> index baf36f4..96857a9 100644
> --- a/test/tablet.c
> +++ b/test/tablet.c
> @@ -55,7 +55,7 @@ START_TEST(proximity_in_out)
>  
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  			struct libinput_tool * tool;
>  
>  			have_tool_update++;
> @@ -73,8 +73,14 @@ START_TEST(proximity_in_out)
>  
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_OUT)
> -			have_proximity_out = true;
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
> +			struct libinput_event_tablet *t =
> +				libinput_event_get_tablet_event(event);
> +
> +			if (libinput_event_tablet_get_proximity_state(t) ==
> +			    LIBINPUT_TOOL_PROXIMITY_OUT)
> +				have_proximity_out = true;
> +		}
>  
>  		libinput_event_destroy(event);
>  	}
> @@ -620,7 +626,7 @@ START_TEST(tool_serial)
>  	libinput_dispatch(li);
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  			tablet_event = libinput_event_get_tablet_event(event);
>  			tool = libinput_event_tablet_get_tool(tablet_event);
>  
> @@ -657,7 +663,7 @@ START_TEST(serial_changes_tool)
>  	libinput_dispatch(li);
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  			tablet_event = libinput_event_get_tablet_event(event);
>  			tool = libinput_event_tablet_get_tool(tablet_event);
>  
> @@ -695,7 +701,7 @@ START_TEST(invalid_serials)
>  	libinput_dispatch(li);
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  			tablet_event = libinput_event_get_tablet_event(event);
>  			tool = libinput_event_tablet_get_tool(tablet_event);
>  
> @@ -724,7 +730,7 @@ START_TEST(tool_ref)
>  	libinput_dispatch(li);
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  			break;
>  		}
>  		libinput_event_destroy(event);
> @@ -819,7 +825,7 @@ START_TEST(tools_with_serials)
>  		libinput_dispatch(li);
>  		while ((event = libinput_get_event(li))) {
>  			if (libinput_event_get_type(event) ==
> -			    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +			    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  				struct libinput_event_tablet *t =
>  					libinput_event_get_tablet_event(event);
>  
> @@ -868,7 +874,7 @@ START_TEST(tools_without_serials)
>  		libinput_dispatch(li);
>  		while ((event = libinput_get_event(li))) {
>  			if (libinput_event_get_type(event) ==
> -			    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +			    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  				struct libinput_event_tablet *t =
>  					libinput_event_get_tablet_event(event);
>  
> @@ -916,7 +922,7 @@ START_TEST(tool_capabilities)
>  	libinput_dispatch(li);
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  			struct libinput_event_tablet *t =
>  				libinput_event_get_tablet_event(event);
>  			struct libinput_tool *tool =
> @@ -940,7 +946,7 @@ START_TEST(tool_capabilities)
>  
>  	while ((event = libinput_get_event(li))) {
>  		if (libinput_event_get_type(event) ==
> -		    LIBINPUT_EVENT_TABLET_PROXIMITY_IN) {
> +		    LIBINPUT_EVENT_TABLET_PROXIMITY) {
>  			struct libinput_event_tablet *t =
>  				libinput_event_get_tablet_event(event);
>  			struct libinput_tool *tool =
> diff --git a/tools/event-debug.c b/tools/event-debug.c
> index 1ca53c4..66b378c 100644
> --- a/tools/event-debug.c
> +++ b/tools/event-debug.c
> @@ -109,11 +109,8 @@ print_event_header(struct libinput_event *ev)
>  	case LIBINPUT_EVENT_TABLET_AXIS:
>  		type = "TABLET_AXIS";
>  		break;
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -		type = "TABLET_PROXIMITY_IN";
> -		break;
> -	case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> -		type = "TABLET_PROXIMITY_OUT";
> +	case LIBINPUT_EVENT_TABLET_PROXIMITY:
> +		type = "TABLET_PROXIMITY";
>  		break;
>  	case LIBINPUT_EVENT_TABLET_BUTTON:
>  		type = "TABLET_BUTTON";
> @@ -321,11 +318,13 @@ print_touch_event_without_coords(struct libinput_event *ev)
>  }
>  
>  static void
> -print_proximity_in_event(struct libinput_event *ev)
> +print_proximity_event(struct libinput_event *ev)
>  {
>  	struct libinput_event_tablet *t = libinput_event_get_tablet_event(ev);
>  	struct libinput_tool *tool = libinput_event_tablet_get_tool(t);
> -	const char *tool_str;
> +	enum libinput_tool_proximity_state state;
> +	const char *tool_str,
> +	           *state_str;
>  
>  	switch (libinput_tool_get_type(tool)) {
>  	case LIBINPUT_TOOL_NONE:
> @@ -359,16 +358,18 @@ print_proximity_in_event(struct libinput_event *ev)
>  		abort();
>  	}
>  
> -	print_event_time(libinput_event_tablet_get_time(t));
> -	printf("%s (%#x)", tool_str, libinput_tool_get_serial(tool));
> -	printf("\n");
> -}
> +	state = libinput_event_tablet_get_proximity_state(t);
>  
> -static void
> -print_proximity_out_event(struct libinput_event *ev) {
> -	struct libinput_event_tablet *t = libinput_event_get_tablet_event(ev);
> +	if (state == LIBINPUT_TOOL_PROXIMITY_IN)
> +		state_str = "came into proximity";
> +	else if (state == LIBINPUT_TOOL_PROXIMITY_OUT)
> +		state_str = "left proximity";
> +	else
> +		abort();

changed to "proximity-in" and "proximity-out", easier to grep/look at

Cheers,
  Peter

>  
>  	print_event_time(libinput_event_tablet_get_time(t));
> +	printf("%s (%#x) %s",
> +	       tool_str, libinput_tool_get_serial(tool), state_str);
>  	printf("\n");
>  }
>  
> @@ -442,11 +443,8 @@ handle_and_print_events(struct libinput *li)
>  		case LIBINPUT_EVENT_TABLET_AXIS:
>  			print_tablet_axis_event(ev);
>  			break;
> -		case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -			print_proximity_in_event(ev);
> -			break;
> -		case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> -			print_proximity_out_event(ev);
> +		case LIBINPUT_EVENT_TABLET_PROXIMITY:
> +			print_proximity_event(ev);
>  			break;
>  		case LIBINPUT_EVENT_TABLET_BUTTON:
>  			print_tablet_button_event(ev);
> diff --git a/tools/event-gui.c b/tools/event-gui.c
> index 1857a2e..063624f 100644
> --- a/tools/event-gui.c
> +++ b/tools/event-gui.c
> @@ -471,8 +471,7 @@ handle_event_libinput(GIOChannel *source, GIOCondition condition, gpointer data)
>  			}
>  			break;
>  		case LIBINPUT_EVENT_TABLET_AXIS:
> -		case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
> -		case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
> +		case LIBINPUT_EVENT_TABLET_PROXIMITY:
>  		case LIBINPUT_EVENT_TABLET_BUTTON:
>  			break;
>  		}
> -- 
> 1.9.5
> 


More information about the wayland-devel mailing list