From 521bd2f11211124fea8d8314c70a9fcd86a1f9df Mon Sep 17 00:00:00 2001 From: Stephen Chandler Paul Date: Thu, 26 Jun 2014 21:31:54 -0400 Subject: [PATCH] tablet: Include axes with all events Signed-off-by: Stephen Chandler Paul Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- src/evdev-tablet.c | 11 +++++++++-- src/libinput-private.h | 7 +++++-- src/libinput.c | 14 ++++++++++++-- src/libinput.h | 3 --- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 710e391e..051c3b48 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -315,6 +315,7 @@ tablet_notify_button_mask(struct tablet_dispatch *tablet, tablet_notify_button(base, time, tool, + tablet->axes, num_button + button_base - 1, state); } @@ -391,7 +392,10 @@ 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_notify_proximity_in(&device->base, + time, + tool, + tablet->axes); tablet_unset_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY); } @@ -420,7 +424,10 @@ tablet_flush(struct tablet_dispatch *tablet, } if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) { - tablet_notify_proximity_out(&device->base, time, tool); + tablet_notify_proximity_out(&device->base, + time, + tool, + 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 a396d783..dbdf5e6d 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -221,17 +221,20 @@ tablet_notify_axis(struct libinput_device *device, void tablet_notify_proximity_in(struct libinput_device *device, uint32_t time, - struct libinput_tool *tool); + struct libinput_tool *tool, + double *axes); void tablet_notify_proximity_out(struct libinput_device *device, uint32_t time, - struct libinput_tool *tool); + struct libinput_tool *tool, + double *axes); void tablet_notify_button(struct libinput_device *device, uint32_t time, struct libinput_tool *tool, + double *axes, int32_t button, enum libinput_button_state state); void diff --git a/src/libinput.c b/src/libinput.c index ecbe33fc..5d26bc91 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -1258,7 +1258,8 @@ tablet_notify_axis(struct libinput_device *device, void tablet_notify_proximity_in(struct libinput_device *device, uint32_t time, - struct libinput_tool *tool) + struct libinput_tool *tool, + double *axes) { struct libinput_event_tablet *proximity_in_event; @@ -1270,6 +1271,9 @@ tablet_notify_proximity_in(struct libinput_device *device, .time = time, .tool = tool, }; + memcpy(proximity_in_event->axes, + axes, + sizeof(proximity_in_event->axes)); post_device_event(device, LIBINPUT_EVENT_TABLET_PROXIMITY_IN, @@ -1279,7 +1283,8 @@ tablet_notify_proximity_in(struct libinput_device *device, void tablet_notify_proximity_out(struct libinput_device *device, uint32_t time, - struct libinput_tool *tool) + struct libinput_tool *tool, + double *axes) { struct libinput_event_tablet *proximity_out_update_event; @@ -1291,6 +1296,9 @@ tablet_notify_proximity_out(struct libinput_device *device, .time = time, .tool = tool, }; + memcpy(proximity_out_update_event->axes, + axes, + sizeof(proximity_out_update_event->axes)); post_device_event(device, LIBINPUT_EVENT_TABLET_PROXIMITY_OUT, @@ -1301,6 +1309,7 @@ void tablet_notify_button(struct libinput_device *device, uint32_t time, struct libinput_tool *tool, + double *axes, int32_t button, enum libinput_button_state state) { @@ -1322,6 +1331,7 @@ tablet_notify_button(struct libinput_device *device, .state = state, .seat_button_count = seat_button_count, }; + memcpy(button_event->axes, axes, sizeof(button_event->axes)); post_device_event(device, LIBINPUT_EVENT_TABLET_BUTTON, diff --git a/src/libinput.h b/src/libinput.h index 37edac53..fa87094f 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -876,9 +876,6 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event, * that indicates the tilt vertical or horizontal tilt of the tool * respectively * - * For tablet events that are not of type @ref LIBINPUT_EVENT_TABLET_AXIS, this - * function returns 0. - * * @param event The libinput tablet event * @param axis The axis to retrieve the value of * @return The current value of the the axis