Signed-off-by: Peter Hutterer <[email protected]>
---
See patch 08/11, not sure we really want that configuration back-channel.

 src/evdev.c     | 19 ++++++++++++-------
 src/evdev.h     |  4 ++++
 src/udev-seat.c |  2 +-
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 0059444..e24e268 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -612,15 +612,11 @@ static int
 evdev_calibration_get_default_matrix(struct libinput_device *libinput_device,
                                     float matrix[6])
 {
-       struct matrix m;
+       struct evdev_device *device = (struct evdev_device*)libinput_device;
 
-       /* Always return the identity matrix for now. In the future, this
-          should return the WL_CALIBRATION matrix defined as default
-          matrix for this device */
-       matrix_init_identity(&m);
-       matrix_to_farray6(&m, matrix);
+       matrix_to_farray6(&device->abs.default_calibration, matrix);
 
-       return !matrix_is_identity(&m);
+       return !matrix_is_identity(&device->abs.default_calibration);
 }
 
 struct evdev_dispatch_interface fallback_interface = {
@@ -956,6 +952,7 @@ evdev_device_create(struct libinput_seat *seat,
 
        matrix_init_identity(&device->abs.calibration);
        matrix_init_identity(&device->abs.usermatrix);
+       matrix_init_identity(&device->abs.default_calibration);
 
        if (evdev_configure_device(device) == -1)
                goto err;
@@ -1027,6 +1024,14 @@ evdev_device_get_id_vendor(struct evdev_device *device)
 }
 
 void
+evdev_device_set_default_calibration(struct evdev_device *device,
+                                    const float calibration[6])
+{
+       matrix_from_farray6(&device->abs.default_calibration, calibration);
+       evdev_device_calibrate(device, calibration);
+}
+
+void
 evdev_device_calibrate(struct evdev_device *device,
                       const float calibration[6])
 {
diff --git a/src/evdev.h b/src/evdev.h
index 110ea74..50ca713 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -74,6 +74,7 @@ struct evdev_device {
 
                int apply_calibration;
                struct matrix calibration;
+               struct matrix default_calibration; /* from 
LIBINPUT_CALIBRATION_MATRIX */
                struct matrix usermatrix; /* as supplied by the caller */
        } abs;
 
@@ -161,6 +162,9 @@ unsigned int
 evdev_device_get_id_vendor(struct evdev_device *device);
 
 void
+evdev_device_set_default_calibration(struct evdev_device *device,
+                                    const float calibration[6]);
+void
 evdev_device_calibrate(struct evdev_device *device,
                       const float calibration[6]);
 
diff --git a/src/udev-seat.c b/src/udev-seat.c
index d0324dd..ccff35c 100644
--- a/src/udev-seat.c
+++ b/src/udev-seat.c
@@ -100,7 +100,7 @@ device_added(struct udev_device *udev_device, struct 
udev_input *input)
                                         &calibration[3],
                                         &calibration[4],
                                         &calibration[5]) == 6) {
-               evdev_device_calibrate(device, calibration);
+               evdev_device_set_default_calibration(device, calibration);
                log_info(&input->base,
                         "Applying calibration: %f %f %f %f %f %f\n",
                         calibration[0],
-- 
1.9.3

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to