]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: support <tapAndDrag> and <dragLock>
authortokyo4j <hrak1529@gmail.com>
Sat, 2 Sep 2023 08:32:48 +0000 (17:32 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 7 Sep 2023 21:55:50 +0000 (22:55 +0100)
docs/labwc-config.5.scd
docs/rc.xml.all
include/config/libinput.h
src/config/libinput.c
src/config/rcxml.c
src/seat.c

index 14485dc266c196b3befdfd3142b469bf1d811360..ca301883fc8f69116e3bfb717a8b995f181cb32f 100644 (file)
@@ -407,6 +407,14 @@ Therefore, where multiple objects of the same kind are required (for example
        left button, right button, and middle button, respectively (lrm) (the
        default), or to left button, middle button, and right button (lmr).
 
+*<libinput><device category=""><tapAndDrag>* [yes|no]
+       Enable or disable tap-and-drag for this category. Tap-and-drag processes
+       a tap immediately followed by a finger down as the start of a drag.
+
+*<libinput><device category=""><dragLock>* [yes|no]
+       Enable or disable drag lock for this category. Drag lock ignores a
+       momentary release of a finger during tap-and-dragging.
+
 *<libinput><device category=""><middleEmulation>* [yes|no]
        Enable or disable middle button emulation for this category. Middle
        emulation processes a simultaneous left and right click as a press of
index ea7bb0ba3f41e919ceaba09bffb1d4823d2f4b26..c0665ee67b33231427efe4c5182c87c15026249e 100644 (file)
       <accelProfile></accelProfile>
       <tap>yes</tap>
       <tapButtonMap></tapButtonMap>
+      <tapAndDrag></tapAndDrag>
+      <dragLock></dragLock>
       <middleEmulation></middleEmulation>
       <disableWhileTyping></disableWhileTyping>
     </device>
index d944195d1ac53723eb6be9f71fe1f6e4f9dcf2fc..46451f26c019a700e299a0699212cfef19425dd1 100644 (file)
@@ -21,6 +21,8 @@ struct libinput_category {
        int left_handed;
        enum libinput_config_tap_state tap;
        enum libinput_config_tap_button_map tap_button_map;
+       enum libinput_config_drag_state tap_and_drag;
+       enum libinput_config_drag_lock_state drag_lock;
        enum libinput_config_accel_profile accel_profile;
        enum libinput_config_middle_emulation_state middle_emu;
        enum libinput_config_dwt_state dwt;
index ee3ca1e6bcfcf7e90fbb868e7a1fd46c6e0a6e72..e66060a0aef38eb7e39a3b5f99e66da588d560c3 100644 (file)
@@ -16,6 +16,8 @@ libinput_category_init(struct libinput_category *l)
        l->left_handed = -1;
        l->tap = LIBINPUT_CONFIG_TAP_ENABLED;
        l->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
+       l->tap_and_drag = -1;
+       l->drag_lock = -1;
        l->accel_profile = -1;
        l->middle_emu = -1;
        l->dwt = -1;
index b33edf8dace013d7574d6acc6e20af6c756bdae7..5e6a456a39508df3d1719b90ac329c5ac98e1f15 100644 (file)
@@ -408,6 +408,22 @@ fill_libinput_category(char *nodename, char *content)
                } else {
                        wlr_log(WLR_ERROR, "invalid tapButtonMap");
                }
+       } else if (!strcasecmp(nodename, "tapAndDrag")) {
+               int ret = parse_bool(content, -1);
+               if (ret < 0) {
+                       return;
+               }
+               current_libinput_category->tap_and_drag = ret
+                       ? LIBINPUT_CONFIG_DRAG_ENABLED
+                       : LIBINPUT_CONFIG_DRAG_DISABLED;
+       } else if (!strcasecmp(nodename, "dragLock")) {
+               int ret = parse_bool(content, -1);
+               if (ret < 0) {
+                       return;
+               }
+               current_libinput_category->drag_lock = ret
+                       ? LIBINPUT_CONFIG_DRAG_LOCK_ENABLED
+                       : LIBINPUT_CONFIG_DRAG_LOCK_DISABLED;
        } else if (!strcasecmp(nodename, "accelProfile")) {
                current_libinput_category->accel_profile =
                        get_accel_profile(content);
index a565fc7883d36f2f00e07a09b46abc22676d6163..a38858a80c08612869b15076caff296f844efc06 100644 (file)
@@ -95,6 +95,24 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
                        dc->tap_button_map);
        }
 
+       if (libinput_device_config_tap_get_finger_count(libinput_dev) <= 0
+                       || dc->tap_and_drag < 0) {
+               wlr_log(WLR_INFO, "tap-and-drag not configured");
+       } else {
+               wlr_log(WLR_INFO, "tap-and-drag configured");
+               libinput_device_config_tap_set_drag_enabled(
+                       libinput_dev, dc->tap_and_drag);
+       }
+
+       if (libinput_device_config_tap_get_finger_count(libinput_dev) <= 0
+                       || dc->drag_lock < 0) {
+               wlr_log(WLR_INFO, "drag lock not configured");
+       } else {
+               wlr_log(WLR_INFO, "drag lock configured");
+               libinput_device_config_tap_set_drag_lock_enabled(
+                       libinput_dev, dc->drag_lock);
+       }
+
        if (libinput_device_config_scroll_has_natural_scroll(libinput_dev) <= 0
                        || dc->natural_scroll < 0) {
                wlr_log(WLR_INFO, "natural scroll not configured");