diff options
author | Sergei Dolgov <[email protected]> | 2019-06-22 14:32:39 +0200 |
---|---|---|
committer | Simon Ser <[email protected]> | 2019-07-05 18:41:56 +0300 |
commit | a5c6816095158ff01ace12403bc527fec8c8af84 (patch) | |
tree | 08610261dada277f8bfd7ad978a0b730c1a6c442 /sway/ipc-json.c | |
parent | bcceb61b43c917247800d104d1fa064f51ab56a1 (diff) |
calibration_matrix: add the current matrix to the IPC description for libinput devices
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r-- | sway/ipc-json.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 7a65be07..87aef47b 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -798,6 +798,18 @@ static json_object *describe_libinput_device(struct libinput_device *device) { json_object_object_add(object, "dwt", json_object_new_string(dwt)); } + if (libinput_device_config_calibration_has_matrix(device)) { + float matrix[6]; + libinput_device_config_calibration_get_matrix(device, matrix); + struct json_object* array = json_object_new_array(); + struct json_object* x; + for (int i = 0; i < 6; i++) { + x = json_object_new_double(matrix[i]); + json_object_array_add(array, x); + } + json_object_object_add(object, "calibration_matrix", array); + } + return object; } |