[PATCH libinput v2 5/5] tablet: Include axes with all events
Stephen Chandler Paul
thatslyude at gmail.com
Thu Jun 26 15:02:52 PDT 2014
Signed-off-by: Stephen Chandler Paul <thatslyude at gmail.com>
---
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 710e391..051c3b4 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 a396d78..dbdf5e6 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 1bd3d51..9a9aaa3 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1253,7 +1253,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;
@@ -1265,6 +1266,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,
@@ -1274,7 +1278,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;
@@ -1286,6 +1291,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,
@@ -1296,6 +1304,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)
{
@@ -1317,6 +1326,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 7f8e081..7fd1dd2 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
--
1.8.5.5
More information about the wayland-devel
mailing list