[PATCH libinput 1/9] tablet: dump deltas_discrete, replace with a single wheel_discrete variable

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


Only the wheel has a discrete value, no need to keep arrays for a single
value.

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

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index ffb141c..83cf433 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -337,7 +337,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
 	int a;
 	double axes[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1] = {0};
 	double deltas[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1] = {0};
-	double deltas_discrete[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1] = {0};
+	int wheel_discrete = 0;
 	double oldval;
 	struct device_coords point, old_point;
 	const struct input_absinfo *absinfo;
@@ -400,7 +400,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
 			deltas[a] = get_delta(a, tablet->axes[a], oldval);
 			continue;
 		} else if (a == LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL) {
-			deltas_discrete[a] = tablet->deltas[a];
+			wheel_discrete = tablet->deltas[a];
 			deltas[a] = normalize_wheel(tablet,
 						    tablet->deltas[a]);
 			axes[a] = 0;
@@ -468,7 +468,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
 					   tablet->changed_axes,
 					   axes,
 					   deltas,
-					   deltas_discrete);
+					   wheel_discrete);
 		}
 	}
 
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 1c8d97c..b404b0a 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -482,7 +482,7 @@ tablet_notify_axis(struct libinput_device *device,
 		   unsigned char *changed_axes,
 		   double *axes,
 		   double *deltas,
-		   double *deltas_discrete);
+		   int wheel_discrete);
 
 void
 tablet_notify_proximity(struct libinput_device *device,
diff --git a/src/libinput.c b/src/libinput.c
index b1bced0..e5b2180 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -133,7 +133,7 @@ struct libinput_event_tablet_tool {
 	uint64_t time;
 	double axes[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1];
 	double deltas[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1];
-	double deltas_discrete[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1];
+	int wheel_discrete;
 	unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
 	struct libinput_tablet_tool *tool;
 	enum libinput_tablet_tool_proximity_state proximity_state;
@@ -1161,7 +1161,7 @@ libinput_event_tablet_tool_get_wheel_delta_discrete(
 			   LIBINPUT_EVENT_TABLET_TOOL_TIP,
 			   LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
 
-	return event->deltas_discrete[LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL];
+	return event->wheel_discrete;
 }
 
 LIBINPUT_EXPORT double
@@ -2153,7 +2153,7 @@ tablet_notify_axis(struct libinput_device *device,
 		   unsigned char *changed_axes,
 		   double *axes,
 		   double *deltas,
-		   double *deltas_discrete)
+		   int wheel_discrete)
 {
 	struct libinput_event_tablet_tool *axis_event;
 
@@ -2166,6 +2166,7 @@ tablet_notify_axis(struct libinput_device *device,
 		.tool = tool,
 		.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
 		.tip_state = tip_state,
+		.wheel_discrete = wheel_discrete,
 	};
 
 	memcpy(axis_event->changed_axes,
@@ -2173,9 +2174,6 @@ tablet_notify_axis(struct libinput_device *device,
 	       sizeof(axis_event->changed_axes));
 	memcpy(axis_event->axes, axes, sizeof(axis_event->axes));
 	memcpy(axis_event->deltas, deltas, sizeof(axis_event->deltas));
-	memcpy(axis_event->deltas_discrete,
-	       deltas_discrete,
-	       sizeof(axis_event->deltas_discrete));
 
 	post_device_event(device,
 			  time,
-- 
2.5.0



More information about the wayland-devel mailing list