summaryrefslogtreecommitdiff
path: root/src/evdev-tablet.h
diff options
context:
space:
mode:
authorStephen Chandler Paul <thatslyude@gmail.com>2014-06-06 20:31:38 -0400
committerStephen Chandler Paul <thatslyude@gmail.com>2014-06-17 17:17:14 -0400
commit8f572b6fd191108d2950dbdb3798f22b3bcc805e (patch)
tree0f089df14970d85291d077bc9d1613d6a58d7936 /src/evdev-tablet.h
parentb2629dc8a10509890de3cc78b5dff04bf94901f7 (diff)
tablet: Report and normalize distance, pressure, and tilt axes
Report the values for the distance, pressure, and tilt axes. Pressure is normalized to a range of 0 to 1, and tilt is normalized to a range of -1 to 1. Based off the patch originally written by Carlos Garnacho Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src/evdev-tablet.h')
-rw-r--r--src/evdev-tablet.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h
index 4498425..679050b 100644
--- a/src/evdev-tablet.h
+++ b/src/evdev-tablet.h
@@ -33,7 +33,8 @@ enum tablet_status {
TABLET_TOOL_UPDATED = 1 << 1,
TABLET_TOOL_LEAVING_PROXIMITY = 1 << 2,
TABLET_BUTTONS_PRESSED = 1 << 3,
- TABLET_BUTTONS_RELEASED = 1 << 4
+ TABLET_BUTTONS_RELEASED = 1 << 4,
+ TABLET_STYLUS_IN_CONTACT = 1 << 5
};
struct button_state {
@@ -67,6 +68,18 @@ evcode_to_axis(const uint32_t evcode)
case ABS_Y:
axis = LIBINPUT_TABLET_AXIS_Y;
break;
+ case ABS_DISTANCE:
+ axis = LIBINPUT_TABLET_AXIS_DISTANCE;
+ break;
+ case ABS_PRESSURE:
+ axis = LIBINPUT_TABLET_AXIS_PRESSURE;
+ break;
+ case ABS_TILT_X:
+ axis = LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL;
+ break;
+ case ABS_TILT_Y:
+ axis = LIBINPUT_TABLET_AXIS_TILT_VERTICAL;
+ break;
default:
axis = LIBINPUT_TABLET_AXIS_NONE;
break;
@@ -87,6 +100,18 @@ axis_to_evcode(const enum libinput_tablet_axis axis)
case LIBINPUT_TABLET_AXIS_Y:
evcode = ABS_Y;
break;
+ case LIBINPUT_TABLET_AXIS_DISTANCE:
+ evcode = ABS_DISTANCE;
+ break;
+ case LIBINPUT_TABLET_AXIS_PRESSURE:
+ evcode = ABS_PRESSURE;
+ break;
+ case LIBINPUT_TABLET_AXIS_TILT_VERTICAL:
+ evcode = ABS_TILT_X;
+ break;
+ case LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL:
+ evcode = ABS_TILT_Y;
+ break;
default:
abort();
}