[PATCH libinput 6/9] tablet: store the wheel delta in the normal axes

Peter Hutterer peter.hutterer at who-t.net
Sun Dec 20 21:57:02 PST 2015


Now that we don't provide an API anymore to access the absolute value of the
wheel and the axes are handled separately, we can safely store the wheel delta
in the normal axis array.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-tablet.c     | 9 ++++-----
 src/libinput-private.h | 1 -
 src/libinput.c         | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 56ade1c..e175779 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -293,7 +293,6 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
 	struct libinput_device *base = &device->base;
 	int a;
 	double axes[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1] = {0};
-	double wheel_delta = 0;
 	int wheel_discrete = 0;
 	struct device_coords point, old_point;
 	const struct input_absinfo *absinfo;
@@ -390,9 +389,10 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
 	a = LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL;
 	if (bit_is_set(tablet->changed_axes, a)) {
 		wheel_discrete = tablet->deltas[a];
-		wheel_delta = normalize_wheel(tablet,
-					      tablet->deltas[a]);
-		axes[a] = 0;
+		tablet->axes[a] = normalize_wheel(tablet,
+						  tablet->deltas[a]);
+	} else {
+		tablet->axes[a] = 0;
 	}
 	axes[a] = tablet->axes[a];
 
@@ -426,7 +426,6 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
 					   tip_state,
 					   tablet->changed_axes,
 					   axes,
-					   wheel_delta,
 					   wheel_discrete);
 		}
 	}
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 1f4dab6..4e0f7f4 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -481,7 +481,6 @@ tablet_notify_axis(struct libinput_device *device,
 		   enum libinput_tablet_tool_tip_state tip_state,
 		   unsigned char *changed_axes,
 		   double *axes,
-		   double wheel_delta,
 		   int wheel_discrete);
 
 void
diff --git a/src/libinput.c b/src/libinput.c
index aff8dd2..093f318 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1147,7 +1147,8 @@ libinput_event_tablet_tool_get_wheel_delta(struct libinput_event_tablet_tool *ev
 			   LIBINPUT_EVENT_TABLET_TOOL_TIP,
 			   LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
 
-	return event->wheel_delta;
+	return  libinput_event_tablet_tool_get_axis_value(event,
+				LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL);
 }
 
 LIBINPUT_EXPORT int
@@ -2152,7 +2153,6 @@ tablet_notify_axis(struct libinput_device *device,
 		   enum libinput_tablet_tool_tip_state tip_state,
 		   unsigned char *changed_axes,
 		   double *axes,
-		   double wheel_delta,
 		   int wheel_discrete)
 {
 	struct libinput_event_tablet_tool *axis_event;
@@ -2167,7 +2167,6 @@ tablet_notify_axis(struct libinput_device *device,
 		.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
 		.tip_state = tip_state,
 		.wheel_discrete = wheel_discrete,
-		.wheel_delta = wheel_delta,
 	};
 
 	memcpy(axis_event->changed_axes,
-- 
2.5.0



More information about the wayland-devel mailing list