tablet: always set the pressure offset

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
This commit is contained in:
Peter Hutterer 2015-12-21 12:53:00 +10:00
parent a28c198e2a
commit d51c8f9420
2 changed files with 9 additions and 1 deletions

View file

@ -881,6 +881,8 @@ tablet_get_tool(struct tablet_dispatch *tablet,
/* If we didn't already have the new_tool in our list of tools, /* If we didn't already have the new_tool in our list of tools,
* add it */ * add it */
if (!tool) { if (!tool) {
const struct input_absinfo *pressure;
tool = zalloc(sizeof *tool); tool = zalloc(sizeof *tool);
*tool = (struct libinput_tablet_tool) { *tool = (struct libinput_tablet_tool) {
.type = type, .type = type,
@ -891,6 +893,12 @@ tablet_get_tool(struct tablet_dispatch *tablet,
tool->pressure_offset = 0; tool->pressure_offset = 0;
tool->has_pressure_offset = false; 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); tool_set_bits(tablet, tool);
list_insert(tool_list, &tool->link); list_insert(tool_list, &tool->link);

View file

@ -277,7 +277,7 @@ struct libinput_tablet_tool {
int refcount; int refcount;
void *user_data; void *user_data;
int pressure_offset; int pressure_offset; /* in device coordinates */
bool has_pressure_offset; bool has_pressure_offset;
}; };