[PATCH libinput 1/5] tablet: always set the pressure offset

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 4 17:21:05 PST 2016


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

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 7804c91..7f6c860 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -882,6 +882,8 @@ tablet_get_tool(struct tablet_dispatch *tablet,
 	/* If we didn't already have the new_tool in our list of tools,
 	 * add it */
 	if (!tool) {
+		const struct input_absinfo *pressure;
+
 		tool = zalloc(sizeof *tool);
 		*tool = (struct libinput_tablet_tool) {
 			.type = type,
@@ -892,6 +894,12 @@ tablet_get_tool(struct tablet_dispatch *tablet,
 
 		tool->pressure_offset = 0;
 		tool->has_pressure_offset = false;
+
+		pressure = libevdev_get_abs_info(tablet->device->evdev,
+						 ABS_PRESSURE);
+		if (pressure)
+			tool->pressure_offset = pressure->minimum;
+
 		tool_set_bits(tablet, tool);
 
 		list_insert(tool_list, &tool->link);
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 246986e..3d714af 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -277,7 +277,7 @@ struct libinput_tablet_tool {
 	int refcount;
 	void *user_data;
 
-	int pressure_offset;
+	int pressure_offset; /* in device coordinates */
 	bool has_pressure_offset;
 };
 
-- 
2.5.0



More information about the wayland-devel mailing list