Add a patch for support extra touch events.
authorJengHyun Kang <jhyuni.kang@samsung.com>
Thu, 7 Jan 2016 08:23:24 +0000 (17:23 +0900)
committerjeon <jhyuni.kang@samsung.com>
Thu, 13 Feb 2020 10:01:16 +0000 (19:01 +0900)
  - libinput commit name: add orientation and size of touch point and pressure to the API

Change-Id: Icfd09c132b51bf15837f11bdd662181e666960b5

packaging/libinput.spec [changed mode: 0755->0644]
src/evdev-fallback.c
src/evdev-fallback.h
src/evdev.c
src/evdev.h
src/libinput-private.h
src/libinput.c
src/libinput.h
src/libinput.sym

old mode 100755 (executable)
new mode 100644 (file)
index b192200..af0dead
@@ -16,6 +16,7 @@ BuildRequires:  pkgconfig(libevdev)
 BuildRequires:  pkgconfig(libevent)
 BuildRequires:  pkgconfig(libudev)
 BuildRequires:  pkgconfig(mtdev)
+BuildRequires:  pkgconfig(wacom)
 
 
 %description
index 651f0111c330feb8c5834ca9af32d9574e619724..fa76ad7c4acfb2bfcfaff2c9657913ed2555911b 100644 (file)
@@ -317,7 +317,7 @@ fallback_flush_mt_down(struct fallback_dispatch *dispatch,
        evdev_transform_absolute(device, &point);
 
        touch_notify_touch_down(base, time, slot_idx, seat_slot,
-                               &point);
+                               &point, &slot->area, slot->pressure);
 
        return true;
 }
@@ -348,7 +348,7 @@ fallback_flush_mt_motion(struct fallback_dispatch *dispatch,
 
        evdev_transform_absolute(device, &point);
        touch_notify_touch_motion(base, time, slot_idx, seat_slot,
-                                 &point);
+                                 &point, &slot->area, slot->pressure);
 
        return true;
 }
@@ -418,6 +418,11 @@ fallback_flush_st_down(struct fallback_dispatch *dispatch,
        struct libinput_seat *seat = base->seat;
        struct device_coords point;
        int seat_slot;
+       struct ellipse default_touch = {
+               .major = DEFAULT_TOUCH_MAJOR,
+               .minor = DEFAULT_TOUCH_MINOR,
+               .orientation = DEFAULT_TOUCH_ORIENTATION
+       };
 
        if (!(device->seat_caps & EVDEV_DEVICE_TOUCH))
                return false;
@@ -439,7 +444,7 @@ fallback_flush_st_down(struct fallback_dispatch *dispatch,
        point = dispatch->abs.point;
        evdev_transform_absolute(device, &point);
 
-       touch_notify_touch_down(base, time, -1, seat_slot, &point);
+       touch_notify_touch_down(base, time, -1, seat_slot, &point, &default_touch, DEFAULT_TOUCH_PRESSURE);
 
        return true;
 }
@@ -452,6 +457,11 @@ fallback_flush_st_motion(struct fallback_dispatch *dispatch,
        struct libinput_device *base = &device->base;
        struct device_coords point;
        int seat_slot;
+       struct ellipse default_touch = {
+               .major = DEFAULT_TOUCH_MAJOR,
+               .minor = DEFAULT_TOUCH_MINOR,
+               .orientation = DEFAULT_TOUCH_ORIENTATION
+       };
 
        point = dispatch->abs.point;
        evdev_transform_absolute(device, &point);
@@ -461,7 +471,7 @@ fallback_flush_st_motion(struct fallback_dispatch *dispatch,
        if (seat_slot == -1)
                return false;
 
-       touch_notify_touch_motion(base, time, -1, seat_slot, &point);
+       touch_notify_touch_motion(base, time, -1, seat_slot, &point, &default_touch, DEFAULT_TOUCH_PRESSURE);
 
        return true;
 }
@@ -663,6 +673,23 @@ fallback_process_touch(struct fallback_dispatch *dispatch,
                dispatch->pending_event |= EVDEV_ABSOLUTE_MT;
                slot->dirty = true;
                break;
+       case ABS_MT_TOUCH_MAJOR:
+               dispatch->mt.slots[dispatch->mt.slot].area.major = e->value;
+               if (dispatch->pending_event == EVDEV_NONE)
+                       dispatch->pending_event = EVDEV_ABSOLUTE_MT;
+               break;
+       case ABS_MT_TOUCH_MINOR:
+               dispatch->mt.slots[dispatch->mt.slot].area.minor = e->value;
+               if (dispatch->pending_event == EVDEV_NONE)
+                       dispatch->pending_event = EVDEV_ABSOLUTE_MT;
+               break;
+       case ABS_MT_ORIENTATION:
+               dispatch->mt.slots[dispatch->mt.slot].area.orientation = e->value;
+               if (dispatch->pending_event == EVDEV_NONE)
+                       dispatch->pending_event = EVDEV_ABSOLUTE_MT;
+               break;
+       default:
+               break;
        }
 }
 
@@ -1609,6 +1636,18 @@ fallback_dispatch_init_slots(struct fallback_dispatch *dispatch,
                slots[slot].point.y = libevdev_get_slot_value(evdev,
                                                              slot,
                                                              ABS_MT_POSITION_Y);
+               slots[slot].area.major = libevdev_get_slot_value(evdev,
+                                                             slot,
+                                                             ABS_MT_TOUCH_MAJOR);
+               slots[slot].area.minor = libevdev_get_slot_value(evdev,
+                                                             slot,
+                                                             ABS_MT_TOUCH_MINOR);
+               slots[slot].area.orientation = libevdev_get_slot_value(evdev,
+                                                             slot,
+                                                             ABS_MT_ORIENTATION);
+               slots[slot].pressure = libevdev_get_slot_value(evdev,
+                                                             slot,
+                                                             ABS_MT_PRESSURE);
        }
        dispatch->mt.slots = slots;
        dispatch->mt.slots_len = num_slots;
index 0f75827e9d19912e8634029af7cf2f9eb9349a82..0f25f4400a2879e3d3b3f8d278bae2bc988f2146 100644 (file)
@@ -66,6 +66,8 @@ struct mt_slot {
        struct device_coords point;
        struct device_coords hysteresis_center;
        enum palm_state palm_state;
+       struct ellipse area;
+       int32_t pressure;
 };
 
 struct fallback_dispatch {
index bf85aa24dbd5d6b50dd56b08891296f57cfb041f..27dc633129040d3ba7c6b79342b7be09d3e62e4d 100644 (file)
@@ -44,6 +44,7 @@
 #include "libinput-private.h"
 #include "quirks.h"
 #include "util-input-event.h"
+#include "stdio.h"
 
 #if HAVE_LIBWACOM
 #include <libwacom/libwacom.h>
@@ -374,6 +375,42 @@ evdev_device_transform_y(struct evdev_device *device,
        return scale_axis(device->abs.absinfo_y, y, height);
 }
 
+double
+evdev_device_transform_orientation(struct evdev_device *device,
+                                  int32_t orientation)
+{
+       const struct input_absinfo *orientation_info =
+                                       device->abs.absinfo_orientation;
+
+       double angle = DEFAULT_TOUCH_ORIENTATION;
+
+       /* ABS_MT_ORIENTATION is defined as a clockwise rotation - zero
+        * (instead of minimum) is mapped to the y-axis, and maximum is
+        * mapped to the x-axis. So minimum is likely to be negative but
+        * plays no role in scaling the value to degrees.*/
+       if (orientation_info)
+               angle = (90.0 * orientation) / orientation_info->maximum;
+
+       return fmod(360.0 + angle, 360.0);
+}
+
+double
+evdev_device_transform_pressure(struct evdev_device *device,
+                               int32_t pressure)
+{
+       const struct input_absinfo *pressure_info =
+                                       device->abs.absinfo_pressure;
+
+       if (pressure_info) {
+               double max_pressure = pressure_info->maximum;
+               double min_pressure = pressure_info->minimum;
+               return (pressure - min_pressure) /
+                                       (max_pressure - min_pressure);
+       } else {
+               return DEFAULT_TOUCH_PRESSURE;
+       }
+}
+
 void
 evdev_notify_axis(struct evdev_device *device,
                  uint64_t time,
@@ -1732,6 +1769,11 @@ evdev_extract_abs_axes(struct evdev_device *device,
 
        device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X);
        device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y);
+       device->abs.absinfo_orientation = libevdev_get_abs_info(evdev, ABS_MT_ORIENTATION);
+       device->abs.absinfo_pressure = libevdev_get_abs_info(evdev, ABS_MT_PRESSURE);
+       device->abs.absinfo_major = libevdev_get_abs_info(evdev, ABS_MT_TOUCH_MAJOR);
+       device->abs.absinfo_minor = libevdev_get_abs_info(evdev, ABS_MT_TOUCH_MINOR);
+
        device->abs.dimensions.x = abs(device->abs.absinfo_x->maximum -
                                       device->abs.absinfo_x->minimum);
        device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum -
index e95f7e60f1dedeab919311e0ac80042bd7896bbb..7b91aa86a769c858e71cc3e6aa7e455485fc0ee2 100644 (file)
 /* The fake resolution value for abs devices without resolution */
 #define EVDEV_FAKE_RESOLUTION 1
 
+#define DEFAULT_TOUCH_PRESSURE 1.0
+#define DEFAULT_TOUCH_ORIENTATION 0.0
+#define DEFAULT_TOUCH_MAJOR 0.0
+#define DEFAULT_TOUCH_MINOR 0.0
+
 enum evdev_event_type {
        EVDEV_NONE,
        EVDEV_ABSOLUTE_TOUCH_DOWN       = bit(0),
@@ -184,6 +189,7 @@ struct evdev_device {
 
        struct {
                const struct input_absinfo *absinfo_x, *absinfo_y;
+               const struct input_absinfo *absinfo_major, *absinfo_minor, *absinfo_pressure, *absinfo_orientation;
                bool is_fake_resolution;
 
                int apply_calibration;
@@ -543,6 +549,15 @@ double
 evdev_device_transform_y(struct evdev_device *device,
                         double y,
                         uint32_t height);
+
+double
+evdev_device_transform_orientation(struct evdev_device *device,
+                                  int32_t orientation);
+
+double
+evdev_device_transform_pressure(struct evdev_device *device,
+                               int32_t pressure);
+
 void
 evdev_device_suspend(struct evdev_device *device);
 
index cb3a4017d79575716259893b0dd088b8ae006b8c..24bd454d8407eb2142f1cbeb54736c0c34ae5364 100644 (file)
@@ -116,6 +116,11 @@ struct wheel_tilt_flags {
        bool vertical, horizontal;
 };
 
+/* Ellipse parameters in device coordinates */
+struct ellipse {
+       int major, minor, orientation;
+};
+
 struct libinput_interface_backend {
        int (*resume)(struct libinput *libinput);
        void (*suspend)(struct libinput *libinput);
@@ -573,15 +578,19 @@ touch_notify_touch_down(struct libinput_device *device,
                        uint64_t time,
                        int32_t slot,
                        int32_t seat_slot,
-                       const struct device_coords *point);
+                       const struct device_coords *point,
+                       const struct ellipse *area,
+                       int32_t pressure);
 
 void
 touch_notify_touch_motion(struct libinput_device *device,
                          uint64_t time,
                          int32_t slot,
                          int32_t seat_slot,
-                         const struct device_coords *point);
-
+                         const struct device_coords *point,
+                         const struct ellipse *area,
+                         int32_t pressure);
 void
 touch_notify_touch_up(struct libinput_device *device,
                      uint64_t time,
index e764375bdc4fc65c6b78b4121499a28146fa9a9d..d4bfde6ced995708698de85938f729384494f7eb 100644 (file)
@@ -80,7 +80,7 @@ static inline bool
 check_event_type(struct libinput *libinput,
                 const char *function_name,
                 unsigned int type_in,
-                ...)
+                ...)
 {
        bool rc = false;
        va_list args;
@@ -101,13 +101,13 @@ check_event_type(struct libinput *libinput,
 
        if (!rc)
                log_bug_client(libinput,
-                              "Invalid event type %d passed to %s()\n",
+                              "Invalid event type %d passed to %s()\n",
                               type_in, function_name);
-
        return rc;
 }
 
-static inline const char *
+ static inline const char *
 event_type_to_str(enum libinput_event_type type)
 {
        switch(type) {
@@ -145,7 +145,7 @@ event_type_to_str(enum libinput_event_type type)
        return NULL;
 }
 
-struct libinput_source {
+ struct libinput_source {
        libinput_source_dispatch_t dispatch;
        void *user_data;
        int fd;
@@ -183,8 +183,10 @@ struct libinput_event_touch {
        uint64_t time;
        int32_t slot;
        int32_t seat_slot;
-       struct device_coords point;
-};
+       struct device_coords point;
+       struct ellipse area;
+       int32_t pressure;
+ };
 
 struct libinput_event_gesture {
        struct libinput_event base;
@@ -879,6 +881,150 @@ libinput_event_touch_get_y(struct libinput_event_touch *event)
        return evdev_convert_to_mm(device->abs.absinfo_y, event->point.y);
 }
 
+  LIBINPUT_EXPORT double
+ libinput_event_touch_get_major(struct libinput_event_touch *event)
+ {
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return event->area.major;
+ }
+ LIBINPUT_EXPORT double
+ libinput_event_touch_get_major_transformed(struct libinput_event_touch *event,
+                                               uint32_t width,
+                                               uint32_t height)
+ {
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return event->area.major;
+ }
+ LIBINPUT_EXPORT int
+ libinput_event_touch_has_major(struct libinput_event_touch *event)
+ {
+        struct evdev_device *device =
+                (struct evdev_device *) event->base.device;
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return device->abs.absinfo_major != 0;
+ }
+ LIBINPUT_EXPORT double
+ libinput_event_touch_get_minor(struct libinput_event_touch *event)
+ {
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+
+        return event->area.minor;
+ }
+ LIBINPUT_EXPORT double
+ libinput_event_touch_get_minor_transformed(struct libinput_event_touch *event,
+                                               uint32_t width,
+                                               uint32_t height)
+ {
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return event->area.minor;
+ }
+ LIBINPUT_EXPORT int
+ libinput_event_touch_has_minor(struct libinput_event_touch *event)
+ {
+        struct evdev_device *device =
+                (struct evdev_device *) event->base.device;
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return device->abs.absinfo_minor != 0;
+ }
+ LIBINPUT_EXPORT double
+ libinput_event_touch_get_orientation(struct libinput_event_touch *event)
+ {
+        struct evdev_device *device =
+                (struct evdev_device *) event->base.device;
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return evdev_device_transform_orientation(device,
+                                                  event->area.orientation);
+ }
+ LIBINPUT_EXPORT int
+ libinput_event_touch_has_orientation(struct libinput_event_touch *event)
+ {
+        struct evdev_device *device =
+                (struct evdev_device *) event->base.device;
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return device->abs.absinfo_orientation != 0;
+ }
+ LIBINPUT_EXPORT double
+ libinput_event_touch_get_pressure(struct libinput_event_touch *event)
+ {
+        struct evdev_device *device =
+                (struct evdev_device *) event->base.device;
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return evdev_device_transform_pressure(device,
+                                                       event->pressure);
+ }
+ LIBINPUT_EXPORT int
+ libinput_event_touch_has_pressure(struct libinput_event_touch *event)
+ {
+        struct evdev_device *device =
+                (struct evdev_device *) event->base.device;
+        require_event_type(libinput_event_get_context(&event->base),
+                               event->base.type,
+                               0,
+                               LIBINPUT_EVENT_TOUCH_DOWN,
+                               LIBINPUT_EVENT_TOUCH_MOTION);
+        return device->abs.absinfo_pressure != 0;
+ }
+
 LIBINPUT_EXPORT uint32_t
 libinput_event_gesture_get_time(struct libinput_event_gesture *event)
 {
@@ -2449,7 +2595,9 @@ touch_notify_touch_down(struct libinput_device *device,
                        uint64_t time,
                        int32_t slot,
                        int32_t seat_slot,
-                       const struct device_coords *point)
+                       const struct device_coords *point,
+                       const struct ellipse *area,
+                       int32_t pressure)
 {
        struct libinput_event_touch *touch_event;
 
@@ -2463,6 +2611,8 @@ touch_notify_touch_down(struct libinput_device *device,
                .slot = slot,
                .seat_slot = seat_slot,
                .point = *point,
+               .area = *area,
+               .pressure = pressure,
        };
 
        post_device_event(device, time,
@@ -2475,7 +2625,9 @@ touch_notify_touch_motion(struct libinput_device *device,
                          uint64_t time,
                          int32_t slot,
                          int32_t seat_slot,
-                         const struct device_coords *point)
+                         const struct device_coords *point,
+                         const struct ellipse *area,
+                         int32_t pressure)
 {
        struct libinput_event_touch *touch_event;
 
@@ -2489,6 +2641,8 @@ touch_notify_touch_motion(struct libinput_device *device,
                .slot = slot,
                .seat_slot = seat_slot,
                .point = *point,
+               .area = *area,
+               .pressure = pressure,
        };
 
        post_device_event(device, time,
index 5a19f79d19ac4c30a94d017265327191a9f6d809..8dec4edf4246c3bcd45062cedc16595126cbfc36 100644 (file)
@@ -1674,6 +1674,228 @@ double
 libinput_event_touch_get_y_transformed(struct libinput_event_touch *event,
                                       uint32_t height);
 
+/**
+ * @ingroup event_touch
+ *
+ * Return the diameter of the major axis of the touch ellipse in mm.
+ * This value might not be provided by the device, in that case the value
+ * 0.0 is returned.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return The current major axis diameter
+ */
+double
+libinput_event_touch_get_major(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return the diameter of the major axis of the touch ellipse in screen
+ * space. This value might not be provided by the device, in that case the
+ * value 0.0 is returned.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @param width The current output screen width
+ * @param height The current output screen height
+ * @return The current major axis diameter
+ */
+double
+libinput_event_touch_get_major_transformed(struct libinput_event_touch *event,
+                                          uint32_t width,
+                                          uint32_t height);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return whether the event contains a major axis value of the touch ellipse.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return Non-zero when a major diameter is available
+ */
+int
+libinput_event_touch_has_major(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return the diameter of the minor axis of the touch ellipse in mm.
+ * This value might not be provided by the device, in this case the value
+ * 0.0 is returned.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return The current minor diameter
+ */
+double
+libinput_event_touch_get_minor(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return the diameter of the minor axis of the touch ellipse in screen
+ * space. This value might not be provided by the device, in this case
+ * the value 0.0 is returned.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @param width The current output screen width
+ * @param height The current output screen height
+ * @return The current minor diameter
+ */
+double
+libinput_event_touch_get_minor_transformed(struct libinput_event_touch *event,
+                                          uint32_t width,
+                                          uint32_t height);
+/**
+ * @ingroup event_touch
+ *
+ * Return whether the event contains a minor axis value of the touch ellipse.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return Non-zero when a minor diameter is available
+ */
+int
+libinput_event_touch_has_minor(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return the pressure value applied to the touch contact normalized to the
+ * range [0, 1]. If this value is not available the function returns the maximum
+ * value 1.0.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return The current pressure value
+ */
+double
+libinput_event_touch_get_pressure(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return whether the event contains a pressure value for the touch contact.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return Non-zero when a pressure value is available
+ */
+int
+libinput_event_touch_has_pressure(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return the major axis rotation in degrees, clockwise from the logical north
+ * of the touch screen.
+ *
+ * @note Even when the orientation is measured by the device, it might be only
+ * available in coarse steps (e.g only indicating alignment with either of the
+ * axes).
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return The current orientation value
+ */
+double
+libinput_event_touch_get_orientation(struct libinput_event_touch *event);
+
+/**
+ * @ingroup event_touch
+ *
+ * Return whether the event contains a orientation value for the touch contact.
+ *
+ * A more detailed explanation can be found in @ref touch_event_properties.
+ *
+ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0.
+ *
+ * @note It is an application bug to call this function for events of type
+ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref
+ * LIBINPUT_EVENT_TOUCH_MOTION.
+ *
+ * @param event The libinput touch event
+ * @return Non-zero when an orientation value is available
+ */
+int
+libinput_event_touch_has_orientation(struct libinput_event_touch *event);
+
 /**
  * @ingroup event_touch
  *
index b45838e0b12936543cceb51d9f19c66ae1efa238..1e6a3240cd071f3848dacf1066fbcace5a5f3c23 100644 (file)
@@ -179,6 +179,16 @@ LIBINPUT_1.1 {
        libinput_device_config_accel_get_profiles;
        libinput_device_config_accel_get_default_profile;
        libinput_device_config_accel_set_profile;
+       libinput_event_touch_get_major;
+       libinput_event_touch_get_major_transformed;
+       libinput_event_touch_get_minor;
+       libinput_event_touch_get_minor_transformed;
+       libinput_event_touch_get_orientation;
+       libinput_event_touch_get_pressure;
+       libinput_event_touch_has_major;
+       libinput_event_touch_has_minor;
+       libinput_event_touch_has_orientation;
+       libinput_event_touch_has_pressure;
 } LIBINPUT_0.21.0;
 
 LIBINPUT_1.2 {