touchpad: new option dwtp (disable-while-trackpointing)
authorpudiva chip líquida <pudiva@skylittlesystem.org>
Tue, 8 Mar 2022 01:33:40 +0000 (01:33 +0000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 8 Mar 2022 01:33:40 +0000 (01:33 +0000)
Add option to control whether the touchpad should be disabled while the
trackpoint is in use.

Fix #731

Signed-off-by: pudiva chip líquida <pudiva@skylittlesystem.org>
17 files changed:
completion/zsh/_libinput
doc/user/configuration.rst
doc/user/palm-detection.rst
src/evdev-mt-touchpad.c
src/evdev-mt-touchpad.h
src/libinput-private.h
src/libinput.c
src/libinput.h
src/libinput.sym
test/test-touchpad.c
test/test-trackpoint.c
tools/libinput-debug-events.c
tools/libinput-debug-events.man
tools/libinput-list-devices.c
tools/shared.c
tools/shared.h
tools/test_tool_option_parsing.py

index 3eb32f2e4e63faf178d2a249f456eb5bc0f74632..a07fd72bca1575c547fa900fc611bd21a8cb4696 100644 (file)
@@ -79,6 +79,9 @@ __all_seats()
                + '(dwt)' \
                '--enable-dwt[Enable disable-while-typing]' \
                '--disable-dwt[Disable disable-while-typing]'
+               + '(dwtp)' \
+               '--enable-dwtp[Enable disable-while-trackpointing]' \
+               '--disable-dwtp[Disable disable-while-trackpointing]'
 }
 
 (( $+functions[_libinput_debug-gui] )) || _libinput_debug-gui()
index 17543d40706bc551af56b45c42c9e3363f259c3c..a95c566ed782fa3b61d98fbbb4d44db7e4b70663 100644 (file)
@@ -142,6 +142,18 @@ info.
 Disable-while-typing can be enabled or disabled, it is enabled by default on
 most touchpads.
 
+------------------------------------------------------------------------------
+Disable while trackpointing
+------------------------------------------------------------------------------
+
+DWTP is a form of palm detecion for devices that have a trackpoint (like
+Thinkpads). While the user is using the trackpoint, the touchpad is disabled,
+being enabled again after a timeout. See :ref:`disable-while-trackpointing` for
+more info.
+
+Disable-while-trackpointing can be enabled or disabled, it is enabled by
+default.
+
 ------------------------------------------------------------------------------
 Calibration
 ------------------------------------------------------------------------------
index 3cd263d92e3a3d6fe761f6d0ce200c30fdc53f56..f9e047b164c6a8fc7be373371142805cc37d1143 100644 (file)
@@ -27,6 +27,7 @@ hardware-specific capabilities.
 - :ref:`palm_exclusion_zones`
 - :ref:`trackpoint-disabling`
 - :ref:`disable-while-typing`
+- :ref:`disable-while-trackpointing`
 - :ref:`stylus-touch-arbitration`
 
 Palm detection is always enabled, with the exception of
@@ -166,6 +167,20 @@ Notable behaviors of libinput's disable-while-typing feature:
 Disable-while-typing can be enabled and disabled by calling
 **libinput_device_config_dwt_set_enabled()**.
 
+.. _disable-while-trackpointing:
+
+------------------------------------------------------------------------------
+Disable-while-trackpointing
+------------------------------------------------------------------------------
+
+libinput automatically disables the touchpad for a timeout after the trackpoint
+is moved, a feature referred to as "disable while trackpointing". libinput does
+not require an external command and the feature is currently enabled for all
+touchpads.
+
+Disable-while-trackpointing can be enabled and disabled by calling
+**libinput_device_config_dwtp_set_enabled()**.
+
 .. _stylus-touch-arbitration:
 
 ------------------------------------------------------------------------------
index cbd74df0d7aff8240c18e476cac6d0997f294e45..4386bdad5f335a580b551dbae41d6fb3513b1bed 100644 (file)
@@ -2202,6 +2202,9 @@ tp_trackpoint_event(uint64_t time, struct libinput_event *event, void *data)
 {
        struct tp_dispatch *tp = data;
 
+       if (!tp->palm.dwtp_enabled)
+               return;
+
        /* Buttons do not count as trackpad activity, as people may use
           the trackpoint buttons in combination with the touchpad. */
        if (event->type == LIBINPUT_EVENT_POINTER_BUTTON)
@@ -3200,6 +3203,60 @@ tp_dwt_config_get_default(struct libinput_device *device)
                LIBINPUT_CONFIG_DWT_DISABLED;
 }
 
+static int
+tp_dwtp_config_is_available(struct libinput_device *device)
+{
+       return 1;
+}
+
+static enum libinput_config_status
+tp_dwtp_config_set(struct libinput_device *device,
+          enum libinput_config_dwtp_state enable)
+{
+       struct evdev_device *evdev = evdev_device(device);
+       struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
+
+       switch(enable) {
+       case LIBINPUT_CONFIG_DWTP_ENABLED:
+       case LIBINPUT_CONFIG_DWTP_DISABLED:
+               break;
+       default:
+               return LIBINPUT_CONFIG_STATUS_INVALID;
+       }
+
+       tp->palm.dwtp_enabled = (enable == LIBINPUT_CONFIG_DWTP_ENABLED);
+
+       return LIBINPUT_CONFIG_STATUS_SUCCESS;
+}
+
+static enum libinput_config_dwtp_state
+tp_dwtp_config_get(struct libinput_device *device)
+{
+       struct evdev_device *evdev = evdev_device(device);
+       struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
+
+       return tp->palm.dwtp_enabled ?
+               LIBINPUT_CONFIG_DWTP_ENABLED :
+               LIBINPUT_CONFIG_DWTP_DISABLED;
+}
+
+static bool
+tp_dwtp_default_enabled(struct tp_dispatch *tp)
+{
+       return true;
+}
+
+static enum libinput_config_dwtp_state
+tp_dwtp_config_get_default(struct libinput_device *device)
+{
+       struct evdev_device *evdev = evdev_device(device);
+       struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
+
+       return tp_dwtp_default_enabled(tp) ?
+               LIBINPUT_CONFIG_DWTP_ENABLED :
+               LIBINPUT_CONFIG_DWTP_DISABLED;
+}
+
 static inline bool
 tp_is_tpkb_combo_below(struct evdev_device *device)
 {
@@ -3246,6 +3303,22 @@ tp_init_dwt(struct tp_dispatch *tp,
        device->base.config.dwt = &tp->dwt.config;
 }
 
+static void
+tp_init_dwtp(struct tp_dispatch *tp,
+           struct evdev_device *device)
+{
+       tp->palm.dwtp_enabled = tp_dwtp_default_enabled(tp);
+
+       if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD)
+               return;
+
+       tp->palm.config.is_available = tp_dwtp_config_is_available;
+       tp->palm.config.set_enabled = tp_dwtp_config_set;
+       tp->palm.config.get_enabled = tp_dwtp_config_get;
+       tp->palm.config.get_default_enabled = tp_dwtp_config_get_default;
+       device->base.config.dwtp = &tp->palm.config;
+}
+
 static inline void
 tp_init_palmdetect_edge(struct tp_dispatch *tp,
                        struct evdev_device *device)
@@ -3675,6 +3748,7 @@ tp_init(struct tp_dispatch *tp,
        tp_init_tap(tp);
        tp_init_buttons(tp, device);
        tp_init_dwt(tp, device);
+       tp_init_dwtp(tp, device);
        tp_init_palmdetect(tp, device);
        tp_init_sendevents(tp, device);
        tp_init_scroll(tp, device);
index ad80cded30a3cfe4ea56a59a9543ba19e7090bed..a95bdd4c286ac33962e6b11a66cf9d9e6c92196d 100644 (file)
@@ -438,6 +438,9 @@ struct tp_dispatch {
        } tap;
 
        struct {
+               struct libinput_device_config_dwtp config;
+               bool dwtp_enabled;
+
                int32_t right_edge;             /* in device coordinates */
                int32_t left_edge;              /* in device coordinates */
                int32_t upper_edge;             /* in device coordinates */
index 6ff81a3393b66be2dadb141dd072aba0a946ad5a..7abb384f5b5969b8889c70282a5f6b5f767bc7f5 100644 (file)
@@ -306,6 +306,17 @@ struct libinput_device_config_dwt {
                         struct libinput_device *device);
 };
 
+struct libinput_device_config_dwtp {
+       int (*is_available)(struct libinput_device *device);
+       enum libinput_config_status (*set_enabled)(
+                        struct libinput_device *device,
+                        enum libinput_config_dwtp_state enable);
+       enum libinput_config_dwtp_state (*get_enabled)(
+                        struct libinput_device *device);
+       enum libinput_config_dwtp_state (*get_default_enabled)(
+                        struct libinput_device *device);
+};
+
 struct libinput_device_config_rotation {
        int (*is_available)(struct libinput_device *device);
        enum libinput_config_status (*set_angle)(
@@ -333,6 +344,7 @@ struct libinput_device_config {
        struct libinput_device_config_click_method *click_method;
        struct libinput_device_config_middle_emulation *middle_emulation;
        struct libinput_device_config_dwt *dwt;
+       struct libinput_device_config_dwtp *dwtp;
        struct libinput_device_config_rotation *rotation;
        struct libinput_device_config_gesture *gesture;
 };
index 4bb0bf28decb496e28103242ab8f6a2705625c42..56f5138723bbb3cfd7215accfd2126e9e89137e9 100644 (file)
@@ -75,6 +75,7 @@ ASSERT_INT_SIZE(enum libinput_config_click_method);
 ASSERT_INT_SIZE(enum libinput_config_middle_emulation_state);
 ASSERT_INT_SIZE(enum libinput_config_scroll_method);
 ASSERT_INT_SIZE(enum libinput_config_dwt_state);
+ASSERT_INT_SIZE(enum libinput_config_dwtp_state);
 
 static inline const char *
 event_type_to_str(enum libinput_event_type type)
@@ -4516,6 +4517,48 @@ libinput_device_config_dwt_get_default_enabled(struct libinput_device *device)
        return device->config.dwt->get_default_enabled(device);
 }
 
+LIBINPUT_EXPORT int
+libinput_device_config_dwtp_is_available(struct libinput_device *device)
+{
+       if (!device->config.dwtp)
+               return 0;
+
+       return device->config.dwtp->is_available(device);
+}
+
+LIBINPUT_EXPORT enum libinput_config_status
+libinput_device_config_dwtp_set_enabled(struct libinput_device *device,
+                                      enum libinput_config_dwtp_state enable)
+{
+       if (enable != LIBINPUT_CONFIG_DWTP_ENABLED &&
+           enable != LIBINPUT_CONFIG_DWTP_DISABLED)
+               return LIBINPUT_CONFIG_STATUS_INVALID;
+
+       if (!libinput_device_config_dwtp_is_available(device))
+               return enable ? LIBINPUT_CONFIG_STATUS_UNSUPPORTED :
+                               LIBINPUT_CONFIG_STATUS_SUCCESS;
+
+       return device->config.dwtp->set_enabled(device, enable);
+}
+
+LIBINPUT_EXPORT enum libinput_config_dwtp_state
+libinput_device_config_dwtp_get_enabled(struct libinput_device *device)
+{
+       if (!libinput_device_config_dwtp_is_available(device))
+               return LIBINPUT_CONFIG_DWTP_DISABLED;
+
+       return device->config.dwtp->get_enabled(device);
+}
+
+LIBINPUT_EXPORT enum libinput_config_dwtp_state
+libinput_device_config_dwtp_get_default_enabled(struct libinput_device *device)
+{
+       if (!libinput_device_config_dwtp_is_available(device))
+               return LIBINPUT_CONFIG_DWTP_DISABLED;
+
+       return device->config.dwtp->get_default_enabled(device);
+}
+
 LIBINPUT_EXPORT int
 libinput_device_config_rotation_is_available(struct libinput_device *device)
 {
index 3a724b9a2b5df816242a34474925d9ad324ae2f4..02f0b5741705b80d654b9afc4090a6c40b0c0198 100644 (file)
@@ -6033,6 +6033,106 @@ libinput_device_config_dwt_get_enabled(struct libinput_device *device);
 enum libinput_config_dwt_state
 libinput_device_config_dwt_get_default_enabled(struct libinput_device *device);
 
+/**
+ * @ingroup config
+ *
+ * Possible states for the disable-while-trackpointing feature.
+ *
+ * @since 1.21
+ */
+enum libinput_config_dwtp_state {
+       LIBINPUT_CONFIG_DWTP_DISABLED,
+       LIBINPUT_CONFIG_DWTP_ENABLED,
+};
+
+/**
+ * @ingroup config
+ *
+ * Check if this device supports configurable disable-while-trackpointing
+ * feature. This feature is usually available on Thinkpads and disables the
+ * touchpad while using the trackpoint. See the libinput documentation for
+ * details.
+ *
+ * @param device The device to configure
+ * @return 0 if this device does not support disable-while-trackpointing, or 1
+ * otherwise.
+ *
+ * @see libinput_device_config_dwtp_set_enabled
+ * @see libinput_device_config_dwtp_get_enabled
+ * @see libinput_device_config_dwtp_get_default_enabled
+ *
+ * @since 1.21
+ */
+int
+libinput_device_config_dwtp_is_available(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Enable or disable the disable-while-trackpointing feature. When enabled, the
+ * device will be disabled while using the trackpoint and for a short period
+ * after. See the libinput documentation for details.
+ *
+ * @note Enabling or disabling disable-while-trackpointing may not take effect
+ * immediately.
+ *
+ * @param device The device to configure
+ * @param enable @ref LIBINPUT_CONFIG_DWTP_DISABLED to disable
+ * disable-while-trackpointing, @ref LIBINPUT_CONFIG_DWTP_ENABLED to enable
+ *
+ * @return A config status code. Disabling disable-while-trackpointing on a
+ * device that does not support the feature always succeeds.
+ *
+ * @see libinput_device_config_dwtp_is_available
+ * @see libinput_device_config_dwtp_get_enabled
+ * @see libinput_device_config_dwtp_get_default_enabled
+ *
+ * @since 1.21
+ */
+enum libinput_config_status
+libinput_device_config_dwtp_set_enabled(struct libinput_device *device,
+                                      enum libinput_config_dwtp_state enable);
+
+/**
+ * @ingroup config
+ *
+ * Check if the disable-while trackpointing feature is currently enabled on
+ * this device. If the device does not support disable-while-trackpointing,
+ * this function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.
+ *
+ * @param device The device to configure
+ * @return @ref LIBINPUT_CONFIG_DWTP_DISABLED if disabled, @ref
+ * LIBINPUT_CONFIG_DWTP_ENABLED if enabled.
+ *
+ * @see libinput_device_config_dwtp_is_available
+ * @see libinput_device_config_dwtp_set_enabled
+ * @see libinput_device_config_dwtp_get_default_enabled
+ *
+ * @since 1.21
+ */
+enum libinput_config_dwtp_state
+libinput_device_config_dwtp_get_enabled(struct libinput_device *device);
+
+/**
+ * @ingroup config
+ *
+ * Check if the disable-while trackpointing feature is enabled on this device
+ * by default. If the device does not support disable-while-trackpointing, this
+ * function returns @ref LIBINPUT_CONFIG_DWTP_DISABLED.
+ *
+ * @param device The device to configure
+ * @return @ref LIBINPUT_CONFIG_DWTP_DISABLED if disabled, @ref
+ * LIBINPUT_CONFIG_DWTP_ENABLED if enabled.
+ *
+ * @see libinput_device_config_dwtp_is_available
+ * @see libinput_device_config_dwtp_set_enabled
+ * @see libinput_device_config_dwtp_get_enabled
+ *
+ * @since 1.21
+ */
+enum libinput_config_dwtp_state
+libinput_device_config_dwtp_get_default_enabled(struct libinput_device *device);
+
 /**
  * @ingroup config
  *
index 7e6fa06bd77ef7f5008757ffbd78db7ae7567d58..434e9241ef7e87da3513ab9ec73a22faf396617f 100644 (file)
@@ -319,3 +319,10 @@ LIBINPUT_1.19 {
        libinput_event_pointer_get_scroll_value_v120;
        libinput_event_pointer_get_scroll_value;
 } LIBINPUT_1.15;
+
+LIBINPUT_1.21 {
+       libinput_device_config_dwtp_is_available;
+       libinput_device_config_dwtp_set_enabled;
+       libinput_device_config_dwtp_get_enabled;
+       libinput_device_config_dwtp_get_default_enabled;
+} LIBINPUT_1.19;
index 4bd14752e89562236397b793dfbd6967cb86c95b..161cfcaad4f81b479015036f6a8e05355a80b447 100644 (file)
@@ -4650,6 +4650,36 @@ START_TEST(touchpad_dwt_config_default_on)
 }
 END_TEST
 
+START_TEST(touchpad_dwtp_config_default_on)
+{
+       struct litest_device *dev = litest_current_device();
+       struct libinput_device *device = dev->libinput_device;
+       enum libinput_config_status status;
+       enum libinput_config_dwtp_state state;
+
+       if (litest_touchpad_is_external(dev)) {
+               ck_assert(!libinput_device_config_dwtp_is_available(device));
+               return;
+       }
+
+       ck_assert(libinput_device_config_dwtp_is_available(device));
+       state = libinput_device_config_dwtp_get_enabled(device);
+       ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED);
+       state = libinput_device_config_dwtp_get_default_enabled(device);
+       ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED);
+
+       status = libinput_device_config_dwtp_set_enabled(device,
+                                       LIBINPUT_CONFIG_DWTP_ENABLED);
+       ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
+       status = libinput_device_config_dwtp_set_enabled(device,
+                                       LIBINPUT_CONFIG_DWTP_DISABLED);
+       ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
+
+       status = libinput_device_config_dwtp_set_enabled(device, 3);
+       ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
+}
+END_TEST
+
 START_TEST(touchpad_dwt_config_default_off)
 {
        struct litest_device *dev = litest_current_device();
@@ -4675,6 +4705,31 @@ START_TEST(touchpad_dwt_config_default_off)
 }
 END_TEST
 
+START_TEST(touchpad_dwtp_config_default_off)
+{
+       struct litest_device *dev = litest_current_device();
+       struct libinput_device *device = dev->libinput_device;
+       enum libinput_config_status status;
+       enum libinput_config_dwtp_state state;
+
+       ck_assert(!libinput_device_config_dwtp_is_available(device));
+       state = libinput_device_config_dwtp_get_enabled(device);
+       ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED);
+       state = libinput_device_config_dwtp_get_default_enabled(device);
+       ck_assert_int_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED);
+
+       status = libinput_device_config_dwtp_set_enabled(device,
+                                       LIBINPUT_CONFIG_DWTP_ENABLED);
+       ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
+       status = libinput_device_config_dwtp_set_enabled(device,
+                                       LIBINPUT_CONFIG_DWTP_DISABLED);
+       ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
+
+       status = libinput_device_config_dwtp_set_enabled(device, 3);
+       ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID);
+}
+END_TEST
+
 static inline void
 disable_dwt(struct litest_device *dev)
 {
@@ -7304,6 +7359,8 @@ TEST_COLLECTION(touchpad)
        litest_add(touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY);
        litest_add(touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY);
        litest_add(touchpad_dwt_remove_kbd_while_active, LITEST_TOUCHPAD, LITEST_ANY);
+       litest_add(touchpad_dwtp_config_default_on, LITEST_TOUCHPAD, LITEST_ANY);
+       litest_add(touchpad_dwtp_config_default_off, LITEST_ANY, LITEST_TOUCHPAD);
        litest_add_for_device(touchpad_dwt_apple, LITEST_BCM5974);
        litest_add_for_device(touchpad_dwt_acer_hawaii, LITEST_ACER_HAWAII_TOUCHPAD);
        litest_add_for_device(touchpad_dwt_multiple_keyboards, LITEST_SYNAPTICS_I2C);
index 86f70296891cb37d69dd7d28622e7abd2f4919ed..12bfc40911bc5cd8f93097172f9079707b0b76cb 100644 (file)
 #include "libinput-util.h"
 #include "litest.h"
 
+static inline bool
+has_disable_while_trackpointing(struct litest_device *device)
+{
+       return libinput_device_config_dwtp_is_available(device->libinput_device);
+}
+
 START_TEST(trackpoint_middlebutton)
 {
        struct litest_device *dev = litest_current_device();
@@ -303,6 +309,27 @@ START_TEST(trackpoint_topsoftbuttons_left_handed_both)
 }
 END_TEST
 
+static inline void
+enable_dwtp(struct litest_device *dev)
+{
+       enum libinput_config_status status,
+                                   expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
+       status = libinput_device_config_dwtp_set_enabled(dev->libinput_device,
+                                               LIBINPUT_CONFIG_DWTP_ENABLED);
+       litest_assert_int_eq(status, expected);
+}
+
+static inline void
+disable_dwtp(struct litest_device *dev)
+{
+       enum libinput_config_status status,
+                                   expected = LIBINPUT_CONFIG_STATUS_SUCCESS;
+       status = libinput_device_config_dwtp_set_enabled(dev->libinput_device,
+                                               LIBINPUT_CONFIG_DWTP_DISABLED);
+       litest_assert_int_eq(status, expected);
+}
+
+
 START_TEST(trackpoint_palmdetect)
 {
        struct litest_device *trackpoint = litest_current_device();
@@ -311,6 +338,9 @@ START_TEST(trackpoint_palmdetect)
        int i;
 
        touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
+       if (has_disable_while_trackpointing(touchpad))
+               enable_dwtp(touchpad);
+
        litest_disable_hold_gestures(touchpad->libinput_device);
        litest_drain_events(li);
 
@@ -339,6 +369,37 @@ START_TEST(trackpoint_palmdetect)
 }
 END_TEST
 
+START_TEST(trackpoint_palmdetect_dwtp_disabled)
+{
+       struct litest_device *trackpoint = litest_current_device();
+       struct litest_device *touchpad;
+       struct libinput *li = trackpoint->libinput;
+       int i;
+
+       touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
+       if (has_disable_while_trackpointing(touchpad))
+               disable_dwtp(touchpad);
+
+       litest_disable_hold_gestures(touchpad->libinput_device);
+       litest_drain_events(li);
+
+       for (i = 0; i < 10; i++) {
+               litest_event(trackpoint, EV_REL, REL_X, 1);
+               litest_event(trackpoint, EV_REL, REL_Y, 1);
+               litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
+               libinput_dispatch(li);
+       }
+       litest_drain_events(li);
+
+       litest_touch_down(touchpad, 0, 30, 30);
+       litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10);
+       litest_touch_up(touchpad, 0);
+       litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
+
+       litest_delete_device(touchpad);
+}
+END_TEST
+
 START_TEST(trackpoint_palmdetect_resume_touch)
 {
        struct litest_device *trackpoint = litest_current_device();
@@ -347,6 +408,10 @@ START_TEST(trackpoint_palmdetect_resume_touch)
        int i;
 
        touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
+
+       if (has_disable_while_trackpointing(touchpad))
+               enable_dwtp(touchpad);
+
        litest_disable_hold_gestures(touchpad->libinput_device);
        litest_drain_events(li);
 
@@ -381,6 +446,10 @@ START_TEST(trackpoint_palmdetect_require_min_events)
        struct libinput *li = trackpoint->libinput;
 
        touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
+
+       if (has_disable_while_trackpointing(touchpad))
+               enable_dwtp(touchpad);
+
        litest_disable_hold_gestures(touchpad->libinput_device);
        litest_drain_events(li);
 
@@ -407,6 +476,10 @@ START_TEST(trackpoint_palmdetect_require_min_events_timeout)
        struct libinput *li = trackpoint->libinput;
 
        touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
+
+       if (has_disable_while_trackpointing(touchpad))
+               enable_dwtp(touchpad);
+
        litest_disable_hold_gestures(touchpad->libinput_device);
        litest_drain_events(li);
 
@@ -441,6 +514,7 @@ TEST_COLLECTION(trackpoint)
        litest_add(trackpoint_topsoftbuttons_left_handed_both, LITEST_TOPBUTTONPAD, LITEST_ANY);
 
        litest_add(trackpoint_palmdetect, LITEST_POINTINGSTICK, LITEST_ANY);
+       litest_add(trackpoint_palmdetect_dwtp_disabled, LITEST_POINTINGSTICK, LITEST_ANY);
        litest_add(trackpoint_palmdetect_resume_touch, LITEST_POINTINGSTICK, LITEST_ANY);
        litest_add(trackpoint_palmdetect_require_min_events, LITEST_POINTINGSTICK, LITEST_ANY);
        litest_add(trackpoint_palmdetect_require_min_events_timeout, LITEST_POINTINGSTICK, LITEST_ANY);
index 1fed8cb8776d950c5431208c4d26a9fe78b8dbef..8b8da6f15acc16e82e2f3102a79f8a0a6611a3f2 100644 (file)
@@ -226,6 +226,14 @@ print_device_options(struct libinput_device *dev)
                        printq(" dwt-off)");
        }
 
+       if (libinput_device_config_dwtp_is_available(dev)) {
+               if (libinput_device_config_dwtp_get_enabled(dev) ==
+                   LIBINPUT_CONFIG_DWTP_ENABLED)
+                       printq(" dwtp-on");
+               else
+                       printq(" dwtp-off)");
+       }
+
        if (libinput_device_has_capability(dev,
                                           LIBINPUT_DEVICE_CAP_TABLET_PAD)) {
                int nbuttons, nstrips, nrings, ngroups;
index 8edd228b8bbfe6d92cb18399a70909501a1d2dff..7b0c3860990c6cb30b83ab59f0fdaa0e6f4e7fae 100644 (file)
@@ -79,6 +79,9 @@ Enable or disable middle button emulation
 .B \-\-enable\-dwt|\-\-disable\-dwt
 Enable or disable disable-while-typing
 .TP 8
+.B \-\-enable\-dwtp|\-\-disable\-dwtp
+Enable or disable disable-while-trackpointing
+.TP 8
 .B \-\-enable\-scroll-button-lock|\-\-disable\-scroll-button-lock
 Enable or disable the scroll button lock
 .TP 8
index a0e5d33412c13d9ae8ceb139a969c1cdf710dae0..afed64649427d6eeb3d16c1eaa911a66878739aa 100644 (file)
@@ -226,6 +226,18 @@ dwt_default(struct libinput_device *device)
        return "disabled";
 }
 
+static const char *
+dwtp_default(struct libinput_device *device)
+{
+       if (!libinput_device_config_dwtp_is_available(device))
+               return "n/a";
+
+       if (libinput_device_config_dwtp_get_default_enabled(device))
+               return "enabled";
+
+       return "disabled";
+}
+
 static char *
 rotation_default(struct libinput_device *device)
 {
@@ -344,6 +356,7 @@ print_device_notify(struct libinput_event *ev)
        free(str);
 
        printf("Disable-w-typing: %s\n", dwt_default(dev));
+       printf("Disable-w-trackpointing: %s\n", dwtp_default(dev));
 
        str = accel_profiles(dev);
        printf("Accel profiles:   %s\n", str);
index 49760e3ccc62fd8f8aab051a8be0c90ceb291833..28d6af3085b40021deb9280b82123c1fa2ca7bc5 100644 (file)
@@ -107,6 +107,7 @@ tools_init_options(struct tools_options *options)
        options->left_handed = -1;
        options->middlebutton = -1;
        options->dwt = -1;
+       options->dwtp = -1;
        options->click_method = -1;
        options->scroll_method = -1;
        options->scroll_button = -1;
@@ -175,6 +176,12 @@ tools_parse_option(int option,
        case OPT_DWT_DISABLE:
                options->dwt = LIBINPUT_CONFIG_DWT_DISABLED;
                break;
+       case OPT_DWTP_ENABLE:
+               options->dwtp = LIBINPUT_CONFIG_DWTP_ENABLED;
+               break;
+       case OPT_DWTP_DISABLE:
+               options->dwtp = LIBINPUT_CONFIG_DWTP_DISABLED;
+               break;
        case OPT_CLICK_METHOD:
                if (!optarg)
                        return 1;
index 471c39956c0db8cc3cf4a1697529eb2751b693b7..fc59ae00f406e10197a277b5d59393f5a3ad1002 100644 (file)
@@ -48,6 +48,8 @@ enum configuration_options {
        OPT_MIDDLEBUTTON_DISABLE,
        OPT_DWT_ENABLE,
        OPT_DWT_DISABLE,
+       OPT_DWTP_ENABLE,
+       OPT_DWTP_DISABLE,
        OPT_CLICK_METHOD,
        OPT_SCROLL_METHOD,
        OPT_SCROLL_BUTTON,
@@ -75,6 +77,8 @@ enum configuration_options {
        { "disable-middlebutton",      no_argument,       0, OPT_MIDDLEBUTTON_DISABLE }, \
        { "enable-dwt",                no_argument,       0, OPT_DWT_ENABLE }, \
        { "disable-dwt",               no_argument,       0, OPT_DWT_DISABLE }, \
+       { "enable-dwtp",               no_argument,       0, OPT_DWTP_ENABLE }, \
+       { "disable-dwtp",              no_argument,       0, OPT_DWTP_DISABLE }, \
        { "enable-scroll-button-lock", no_argument,       0, OPT_SCROLL_BUTTON_LOCK_ENABLE }, \
        { "disable-scroll-button-lock",no_argument,       0, OPT_SCROLL_BUTTON_LOCK_DISABLE }, \
        { "set-click-method",          required_argument, 0, OPT_CLICK_METHOD }, \
@@ -107,6 +111,7 @@ struct tools_options {
        int scroll_button_lock;
        double speed;
        int dwt;
+       int dwtp;
        enum libinput_config_accel_profile profile;
        char disable_pattern[64];
 };
index f1241ddb8dd1dd4487282b9bbed453c1abc96462..5c33db6d9bb54ce8df9ba977b68b85fd3573225a 100755 (executable)
@@ -210,6 +210,7 @@ options = {
         "natural-scrolling",
         "left-handed",
         "dwt",
+        "dwtp",
     ],
     # options with distinct values
     "enums": {