diff options
author | pudiva chip lĂquida <pudiva@skylittlesystem.org> | 2022-08-24 00:13:12 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-10-30 10:56:34 +0100 |
commit | 7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc (patch) | |
tree | faacab010de2a3ffdd76dcf3bab015bb708f42dc /sway/input | |
parent | a61815d3859e4cc92d3f8a0701a5675d97b81cdc (diff) | |
download | sway-7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc.tar.xz |
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.c | 15 |
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) { return true; } +static bool set_dwtp(struct libinput_device *device, bool dwtp) { + if (!libinput_device_config_dwtp_is_available(device) || + libinput_device_config_dwtp_get_enabled(device) == dwtp) { + return false; + } + sway_log(SWAY_DEBUG, "dwtp_set_enabled(%d)", dwtp); + log_status(libinput_device_config_dwtp_set_enabled(device, dwtp)); + return true; +} + static bool set_calibration_matrix(struct libinput_device *dev, float mat[6]) { if (!libinput_device_config_calibration_has_matrix(dev)) { return false; @@ -255,6 +265,9 @@ bool sway_input_configure_libinput_device(struct sway_input_device *input_device if (ic->dwt != INT_MIN) { changed |= set_dwt(device, ic->dwt); } + if (ic->dwtp != INT_MIN) { + changed |= set_dwtp(device, ic->dwtp); + } if (ic->calibration_matrix.configured) { changed |= set_calibration_matrix(device, ic->calibration_matrix.matrix); } @@ -302,6 +315,8 @@ void sway_input_reset_libinput_device(struct sway_input_device *input_device) { libinput_device_config_scroll_get_default_button(device)); changed |= set_dwt(device, libinput_device_config_dwt_get_default_enabled(device)); + changed |= set_dwtp(device, + libinput_device_config_dwtp_get_default_enabled(device)); float matrix[6]; libinput_device_config_calibration_get_default_matrix(device, matrix); |