From 7cc8ab6d6c4e7ebbfee832b3d8d8fd86623d89fc Mon Sep 17 00:00:00 2001 From: pudiva chip lĂ­quida Date: Wed, 24 Aug 2022 00:13:12 +0100 Subject: 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 --- sway/input/libinput.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sway/input') 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); -- cgit v1.2.3