aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar pudiva chip lĂ­quida <pudiva@skylittlesystem.org>2022-08-24 00:13:12 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2022-10-30 10:56:34 +0100
commit7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc (patch)
treefaacab010de2a3ffdd76dcf3bab015bb708f42dc /sway/input
parentcontainer_floating_set_default_size: Store workspace size box on the stack (diff)
downloadsway-7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc.tar.gz
sway-7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc.tar.zst
sway-7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc.zip
Support libinput's 1.21 new dwtp option
Support the new dwtp (disable while trackpointing) option introduced in libinput 1.21, allowing users to control whether the trackpoint (like those in Thinkpads, but not only) should be disabled while using the keyboard/touchpad. See: https://gitlab.freedesktop.org/libinput/libinput/-/issues/731
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/libinput.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/input/libinput.c b/sway/input/libinput.c
index 1bac72c9..53019301 100644
--- a/sway/input/libinput.c
+++ b/sway/input/libinput.c
@@ -166,6 +166,16 @@ static bool set_dwt(struct libinput_device *device, bool dwt) {
166 return true; 166 return true;
167} 167}
168 168
169static bool set_dwtp(struct libinput_device *device, bool dwtp) {
170 if (!libinput_device_config_dwtp_is_available(device) ||
171 libinput_device_config_dwtp_get_enabled(device) == dwtp) {
172 return false;
173 }
174 sway_log(SWAY_DEBUG, "dwtp_set_enabled(%d)", dwtp);
175 log_status(libinput_device_config_dwtp_set_enabled(device, dwtp));
176 return true;
177}
178
169static bool set_calibration_matrix(struct libinput_device *dev, float mat[6]) { 179static bool set_calibration_matrix(struct libinput_device *dev, float mat[6]) {
170 if (!libinput_device_config_calibration_has_matrix(dev)) { 180 if (!libinput_device_config_calibration_has_matrix(dev)) {
171 return false; 181 return false;
@@ -255,6 +265,9 @@ bool sway_input_configure_libinput_device(struct sway_input_device *input_device
255 if (ic->dwt != INT_MIN) { 265 if (ic->dwt != INT_MIN) {
256 changed |= set_dwt(device, ic->dwt); 266 changed |= set_dwt(device, ic->dwt);
257 } 267 }
268 if (ic->dwtp != INT_MIN) {
269 changed |= set_dwtp(device, ic->dwtp);
270 }
258 if (ic->calibration_matrix.configured) { 271 if (ic->calibration_matrix.configured) {
259 changed |= set_calibration_matrix(device, ic->calibration_matrix.matrix); 272 changed |= set_calibration_matrix(device, ic->calibration_matrix.matrix);
260 } 273 }
@@ -302,6 +315,8 @@ void sway_input_reset_libinput_device(struct sway_input_device *input_device) {
302 libinput_device_config_scroll_get_default_button(device)); 315 libinput_device_config_scroll_get_default_button(device));
303 changed |= set_dwt(device, 316 changed |= set_dwt(device,
304 libinput_device_config_dwt_get_default_enabled(device)); 317 libinput_device_config_dwt_get_default_enabled(device));
318 changed |= set_dwtp(device,
319 libinput_device_config_dwtp_get_default_enabled(device));
305 320
306 float matrix[6]; 321 float matrix[6];
307 libinput_device_config_calibration_get_default_matrix(device, matrix); 322 libinput_device_config_calibration_get_default_matrix(device, matrix);