Functions | |
int | libinput_device_config_calibration_has_matrix (struct libinput_device *device) |
Check if the device can be calibrated via a calibration matrix. More... | |
enum libinput_config_status | libinput_device_config_calibration_set_matrix (struct libinput_device *device, const float matrix[6]) |
Apply the 3x3 transformation matrix to absolute device coordinates. More... | |
int | libinput_device_config_calibration_get_matrix (struct libinput_device *device, float matrix[6]) |
Return the current calibration matrix for this device. More... | |
int | libinput_device_config_calibration_get_default_matrix (struct libinput_device *device, float matrix[6]) |
Return the default calibration matrix for this device. More... | |
Detailed Description
Function Documentation
int libinput_device_config_calibration_get_default_matrix | ( | struct libinput_device * | device, |
float | matrix[6] | ||
) |
Return the default calibration matrix for this device.
On most devices, this is the identity matrix. If the udev property LIBINPUT_CALIBRATION_MATRIX is set on the respective udev device, that property's value becomes the default matrix, see Static device configuration via udev.
- Parameters
-
device The device to configure matrix Set to the array representing the first two rows of a 3x3 matrix as described in libinput_device_config_calibration_set_matrix().
- Returns
- 0 if no calibration is set and the returned matrix is the identity matrix, 1 otherwise
int libinput_device_config_calibration_get_matrix | ( | struct libinput_device * | device, |
float | matrix[6] | ||
) |
Return the current calibration matrix for this device.
- Parameters
-
device The device to configure matrix Set to the array representing the first two rows of a 3x3 matrix as described in libinput_device_config_calibration_set_matrix().
- Returns
- 0 if no calibration is set and the returned matrix is the identity matrix, 1 otherwise
int libinput_device_config_calibration_has_matrix | ( | struct libinput_device * | device | ) |
Check if the device can be calibrated via a calibration matrix.
- Parameters
-
device The device to check
- Returns
- Non-zero if the device can be calibrated, zero otherwise.
enum libinput_config_status libinput_device_config_calibration_set_matrix | ( | struct libinput_device * | device, |
const float | matrix[6] | ||
) |
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
The translation component (c, f) is expected to be normalized to the device coordinate range. For example, the matrix
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
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:
- Parameters
-
device The device to configure matrix An array representing the first two rows of a 3x3 matrix as described above.
- Returns
- A config status code.