diff options
author | Sergei Dolgov <dolgovs@gmail.com> | 2019-06-17 11:38:41 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-07-05 18:41:56 +0300 |
commit | 01ec18e80228739bbc099ccb35356d198729ab42 (patch) | |
tree | a5a0a701e3ce2168f1278f91984a5ac1c9c555be /sway/input/input-manager.c | |
parent | f5d1c27226a74a234664af9b35ab226a67386e8e (diff) |
Add calibration_matrix config option
Can be used to change the orientation of a touchscreen.
Example usage with swaymsg:
# identity
swaymsg input type:touch calibration_matrix '"1 0 0 0 1 0"'
# 90 degree clockwise
swaymsg input type:touch calibration_matrix '"0 -1 1 1 0 0"'
# 180 degree clockwise
swaymsg input type:touch calibration_matrix '"-1 0 1 0 -1 1"'
# 270 degree clockwise
swaymsg input type:touch calibration_matrix '"0 1 0 -1 0 1"'
Documentation:
https://wayland.freedesktop.org/libinput/doc/latest/absolute-axes.html#calibration-of-absolute-devices
Diffstat (limited to 'sway/input/input-manager.c')
-rw-r--r-- | sway/input/input-manager.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index a2a1e274..195acc6f 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -281,6 +281,13 @@ static void input_manager_libinput_config_touch( log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, ic->send_events)); } + float *m = ic->calibration_matrix.matrix; + if (ic->calibration_matrix.configured) { + sway_log(SWAY_DEBUG, "libinput_config_touch(%s) calibration_set_matrix(%f %f %f %f %f %f)", + ic->identifier, m[0], m[1], m[2], m[3], m[4], m[5]); + log_libinput_config_status(libinput_device_config_calibration_set_matrix( + libinput_device, ic->calibration_matrix.matrix)); + } } static void input_manager_libinput_reset_touch( @@ -300,6 +307,12 @@ static void input_manager_libinput_reset_touch( input_device->identifier, send_events); log_libinput_config_status(libinput_device_config_send_events_set_mode( libinput_device, send_events)); + float m[6]; + libinput_device_config_calibration_get_default_matrix(libinput_device, m); + sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) calibration_set_matrix(%f %f %f %f %f %f)", + input_device->identifier, m[0], m[1], m[2], m[3], m[4], m[5]); + log_libinput_config_status(libinput_device_config_calibration_set_matrix( + libinput_device, m)); } static void input_manager_libinput_config_pointer( |