aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/input-manager.c
diff options
context:
space:
mode:
authorLibravatar Sergei Dolgov <dolgovs@gmail.com>2019-06-17 11:38:41 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2019-07-05 18:41:56 +0300
commit01ec18e80228739bbc099ccb35356d198729ab42 (patch)
treea5a0a701e3ce2168f1278f91984a5ac1c9c555be /sway/input/input-manager.c
parentswaybar-protocol.7: fix block border descriptions (diff)
downloadsway-01ec18e80228739bbc099ccb35356d198729ab42.tar.gz
sway-01ec18e80228739bbc099ccb35356d198729ab42.tar.zst
sway-01ec18e80228739bbc099ccb35356d198729ab42.zip
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.c13
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(
281 log_libinput_config_status(libinput_device_config_send_events_set_mode( 281 log_libinput_config_status(libinput_device_config_send_events_set_mode(
282 libinput_device, ic->send_events)); 282 libinput_device, ic->send_events));
283 } 283 }
284 float *m = ic->calibration_matrix.matrix;
285 if (ic->calibration_matrix.configured) {
286 sway_log(SWAY_DEBUG, "libinput_config_touch(%s) calibration_set_matrix(%f %f %f %f %f %f)",
287 ic->identifier, m[0], m[1], m[2], m[3], m[4], m[5]);
288 log_libinput_config_status(libinput_device_config_calibration_set_matrix(
289 libinput_device, ic->calibration_matrix.matrix));
290 }
284} 291}
285 292
286static void input_manager_libinput_reset_touch( 293static void input_manager_libinput_reset_touch(
@@ -300,6 +307,12 @@ static void input_manager_libinput_reset_touch(
300 input_device->identifier, send_events); 307 input_device->identifier, send_events);
301 log_libinput_config_status(libinput_device_config_send_events_set_mode( 308 log_libinput_config_status(libinput_device_config_send_events_set_mode(
302 libinput_device, send_events)); 309 libinput_device, send_events));
310 float m[6];
311 libinput_device_config_calibration_get_default_matrix(libinput_device, m);
312 sway_log(SWAY_DEBUG, "libinput_reset_touch(%s) calibration_set_matrix(%f %f %f %f %f %f)",
313 input_device->identifier, m[0], m[1], m[2], m[3], m[4], m[5]);
314 log_libinput_config_status(libinput_device_config_calibration_set_matrix(
315 libinput_device, m));
303} 316}
304 317
305static void input_manager_libinput_config_pointer( 318static void input_manager_libinput_config_pointer(