touchpad: Only break out of tap FSM for clickpad button presses
[platform/upstream/libinput.git] / src / libinput.h
index ead3064..5af0dde 100644 (file)
@@ -427,6 +427,9 @@ libinput_event_pointer_get_time(struct libinput_event_pointer *event);
  * events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function
  * returns 0.
  *
+ * If a device employs pointer acceleration, the delta returned by this
+ * function is the accelerated delta.
+ *
  * @note It is an application bug to call this function for events other than
  * LIBINPUT_EVENT_POINTER_MOTION.
  *
@@ -442,6 +445,9 @@ libinput_event_pointer_get_dx(struct libinput_event_pointer *event);
  * events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function
  * returns 0.
  *
+ * If a device employs pointer acceleration, the delta returned by this
+ * function is the accelerated delta.
+ *
  * @note It is an application bug to call this function for events other than
  * LIBINPUT_EVENT_POINTER_MOTION.
  *
@@ -1353,24 +1359,18 @@ libinput_device_led_update(struct libinput_device *device,
  */
 int
 libinput_device_get_keys(struct libinput_device *device,
-                        char *keys, size_t size);
+                        char *keys, size_t size)
+       LIBINPUT_ATTRIBUTE_DEPRECATED;
 
 /**
  * @ingroup device
  *
- * Apply the 3x3 transformation matrix to absolute device coordinates. This
- * matrix has no effect on relative events.
- *
- * Given a 6-element array [a, b, c, d, e, f], the matrix is applied as
- * @code
- * [ a  b  c ]   [ x ]
- * [ d  e  f ] * [ y ]
- * [ 0  0  1 ]   [ 1 ]
- * @endcode
+ * @deprecated Use libinput_device_config_calibration_set_matrix() instead.
  */
 void
 libinput_device_calibrate(struct libinput_device *device,
-                         float calibration[6]);
+                         float calibration[6])
+       LIBINPUT_ATTRIBUTE_DEPRECATED;
 
 /**
  * @ingroup device
@@ -1417,6 +1417,11 @@ libinput_device_get_size(struct libinput_device *device,
  * in the right order.
  */
 
+/**
+ * @ingroup config
+ *
+ * Status codes returned when applying configuration settings.
+ */
 enum libinput_config_status {
        LIBINPUT_CONFIG_STATUS_SUCCESS = 0,     /**< Config applied successfully */
        LIBINPUT_CONFIG_STATUS_UNSUPPORTED,     /**< Configuration not available on
@@ -1425,7 +1430,7 @@ enum libinput_config_status {
 };
 
 /**
- * @ingroup config Device configuration
+ * @ingroup config
  *
  * Return a string describing the error.
  *
@@ -1436,8 +1441,200 @@ enum libinput_config_status {
 const char *
 libinput_config_status_to_str(enum libinput_config_status status);
 
+/**
+ * @ingroup config
+ */
+enum libinput_config_tap_state {
+       LIBINPUT_CONFIG_TAP_DISABLED, /**< Tapping is to be disabled, or is
+                                       currently disabled */
+       LIBINPUT_CONFIG_TAP_ENABLED, /**< Tapping is to be enabled, or is
+                                      currently enabled */
+};
+
+/**
+ * @ingroup config
+ *
+ * Check if the device supports tap-to-click. See
+ * libinput_device_config_tap_set_enabled() for more information.
+ *
+ * @param device The device to configure
+ * @return The number of fingers that can generate a tap event, or 0 if the
+ * device does not support tapping.
+ *
+ * @see libinput_device_config_tap_set_enabled
+ * @see libinput_device_config_tap_get_enabled
+ * @see libinput_device_config_tap_get_default_enabled
+ */
+int
+libinput_device_config_tap_get_finger_count(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Enable or disable tap-to-click on this device, with a default mapping of
+ * 1, 2, 3 finger tap mapping to left, right, middle click, respectively.
+ * Tapping is limited by the number of simultaneous touches
+ * supported by the device, see
+ * libinput_device_config_tap_get_finger_count().
+ *
+ * @param device The device to configure
+ * @param enable @ref LIBINPUT_CONFIG_TAP_ENABLED to enable tapping or @ref
+ * LIBINPUT_CONFIG_TAP_DISABLED to disable tapping
+ *
+ * @return A config status code. Disabling tapping on a device that does not
+ * support tapping always succeeds.
+ *
+ * @see libinput_device_config_tap_get_finger_count
+ * @see libinput_device_config_tap_get_enabled
+ * @see libinput_device_config_tap_get_default_enabled
+ */
+enum libinput_config_status
+libinput_device_config_tap_set_enabled(struct libinput_device *device,
+                                      enum libinput_config_tap_state enable);
+
+/**
+ * @ingroup config
+ *
+ * Check if tap-to-click is enabled on this device. If the device does not
+ * support tapping, this function always returns 0.
+ *
+ * @param device The device to configure
+ *
+ * @return @ref LIBINPUT_CONFIG_TAP_ENABLED if tapping is currently enabled,
+ * or @ref LIBINPUT_CONFIG_TAP_DISABLED is currently disabled
+ *
+ * @see libinput_device_config_tap_get_finger_count
+ * @see libinput_device_config_tap_set_enabled
+ * @see libinput_device_config_tap_get_default_enabled
+ */
+enum libinput_config_tap_state
+libinput_device_config_tap_get_enabled(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Return the default setting for whether tapping is enabled on this device.
+ *
+ * @param device The device to configure
+ * @return @ref LIBINPUT_CONFIG_TAP_ENABLED if tapping is enabled by default,
+ * or @ref LIBINPUT_CONFIG_TAP_DISABLED is disabled by default
+ *
+ * @see libinput_device_config_tap_get_finger_count
+ * @see libinput_device_config_tap_set_enabled
+ * @see libinput_device_config_tap_get_enabled
+ */
+enum libinput_config_tap_state
+libinput_device_config_tap_get_default_enabled(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Check if the device can be calibrated via a calibration matrix.
+ *
+ * @param device The device to check
+ * @return non-zero if the device can be calibrated, zero otherwise.
+ *
+ * @see libinput_device_config_calibration_set_matrix
+ * @see libinput_device_config_calibration_get_matrix
+ * @see libinput_device_config_calibration_get_default_matrix
+ */
+int
+libinput_device_config_calibration_has_matrix(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Apply the 3x3 transformation matrix to absolute device coordinates. This
+ * matrix has no effect on relative events.
+ *
+ * Given a 6-element array [a, b, c, d, e, f], the matrix is applied as
+ * @code
+ * [ a  b  c ]   [ x ]
+ * [ d  e  f ] * [ y ]
+ * [ 0  0  1 ]   [ 1 ]
+ * @endcode
+ *
+ * The translation component (c, f) is expected to be normalized to the
+ * device coordinate range. For example, the matrix
+ * @code
+ * [ 1 0  1 ]
+ * [ 0 1 -1 ]
+ * [ 0 0  1 ]
+ * @endcode
+ * moves all coordinates by 1 device-width to the right and 1 device-height
+ * up.
+ *
+ * The rotation matrix for rotation around the origin is defined as
+ * @code
+ * [ cos(a) -sin(a) 0 ]
+ * [ sin(a)  cos(a) 0 ]
+ * [   0      0     1 ]
+ * @endcode
+ * Note that any rotation requires an additional translation component to
+ * translate the rotated coordinates back into the original device space.
+ * The rotation matrixes for 90, 180 and 270 degrees clockwise are:
+ * @code
+ * 90 deg cw:          180 deg cw:             270 deg cw:
+ * [ 0 -1 1]           [ -1  0 1]              [  0 1 0 ]
+ * [ 1  0 0]           [  0 -1 1]              [ -1 0 1 ]
+ * [ 0  0 1]           [  0  0 1]              [  0 0 1 ]
+ * @endcode
+ *
+ * @param device The device to configure
+ * @param matrix An array representing the first two rows of a 3x3 matrix as
+ * described above.
+ *
+ * @return A config status code.
+ *
+ * @see libinput_device_config_calibration_has_matrix
+ * @see libinput_device_config_calibration_get_matrix
+ * @see libinput_device_config_calibration_get_default_matrix
+ */
+enum libinput_config_status
+libinput_device_config_calibration_set_matrix(struct libinput_device *device,
+                                             const float matrix[6]);
+
+/**
+ * @ingroup config
+ *
+ * Return the current calibration matrix for this device.
+ *
+ * @param device The device to configure
+ * @param matrix Set to the array representing the first two rows of a 3x3 matrix as
+ * described in libinput_device_config_calibration_set_matrix().
+ *
+ * @return 0 if no calibration is set and the returned matrix is the
+ * identity matrix, 1 otherwise
+ *
+ * @see libinput_device_config_calibration_has_matrix
+ * @see libinput_device_config_calibration_set_matrix
+ * @see libinput_device_config_calibration_get_default_matrix
+ */
+int
+libinput_device_config_calibration_get_matrix(struct libinput_device *device,
+                                             float matrix[6]);
+
+/**
+ * @ingroup config
+ *
+ * Return the default calibration matrix for this device.
+ *
+ * @param device The device to configure
+ * @param matrix Set to the array representing the first two rows of a 3x3 matrix as
+ * described in libinput_device_config_calibration_set_matrix().
+ *
+ * @return 0 if no calibration is set and the returned matrix is the
+ * identity matrix, 1 otherwise
+ *
+ * @see libinput_device_config_calibration_has_matrix
+ * @see libinput_device_config_calibration_set_matrix
+ * @see libinput_device_config_calibration_get_default_matrix
+ */
+int
+libinput_device_config_calibration_get_default_matrix(struct libinput_device *device,
+                                                     float matrix[6]);
+
 #ifdef __cplusplus
 }
 #endif
-
 #endif /* LIBINPUT_H */