From 0319ee1d3316393c4cb0d551445529bfee415a1a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 15 Dec 2015 08:39:56 +1000 Subject: [PATCH] tablet: split sanitize_tablet_axes up into two helpers Signed-off-by: Peter Hutterer --- src/evdev-tablet.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 3834e56d..7804c91c 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -957,7 +957,7 @@ tablet_notify_buttons(struct tablet_dispatch *tablet, } static void -sanitize_tablet_axes(struct tablet_dispatch *tablet) +sanitize_pressure_distance(struct tablet_dispatch *tablet) { bool tool_in_contact; const struct input_absinfo *distance, @@ -995,7 +995,11 @@ sanitize_tablet_axes(struct tablet_dispatch *tablet) else tablet->axes[LIBINPUT_TABLET_TOOL_AXIS_PRESSURE] = 0; } +} +static inline void +sanitize_mouse_lens_rotation(struct tablet_dispatch *tablet) +{ /* If we have a mouse/lens cursor and the tilt changed, the rotation changed. Mark this, calculate the angle later */ if ((tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE || @@ -1011,6 +1015,13 @@ axis_range_percentage(const struct input_absinfo *a, int percent) return (a->maximum - a->minimum) * percent/100 + a->minimum; } +static void +sanitize_tablet_axes(struct tablet_dispatch *tablet) +{ + sanitize_pressure_distance(tablet); + sanitize_mouse_lens_rotation(tablet); +} + static void detect_pressure_offset(struct tablet_dispatch *tablet, struct evdev_device *device,