diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h index 7a661e8fe..605690eb6 100644 --- a/src/backends/meta-input-settings-private.h +++ b/src/backends/meta-input-settings-private.h @@ -54,6 +54,9 @@ struct _MetaInputSettingsClass void (* set_tap_enabled) (MetaInputSettings *settings, ClutterInputDevice *device, gboolean enabled); + void (* set_tap_and_drag_enabled) (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled); void (* set_disable_while_typing) (MetaInputSettings *settings, ClutterInputDevice *device, gboolean enabled); diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index 2bbc8c1d3..83c06ad01 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -528,6 +528,36 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings, } } +static void +update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings, + ClutterInputDevice *device) +{ + MetaInputSettingsClass *input_settings_class; + MetaInputSettingsPrivate *priv; + gboolean enabled; + + if (device && + clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE) + return; + + priv = meta_input_settings_get_instance_private (input_settings); + input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); + enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag"); + + if (device) + { + settings_device_set_bool_setting (input_settings, device, + input_settings_class->set_tap_and_drag_enabled, + enabled); + } + else + { + settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, + input_settings_class->set_tap_and_drag_enabled, + enabled); + } +} + static void update_touchpad_edge_scroll (MetaInputSettings *input_settings, ClutterInputDevice *device) @@ -1039,6 +1069,8 @@ meta_input_settings_changed_cb (GSettings *settings, update_device_natural_scroll (input_settings, NULL); else if (strcmp (key, "tap-to-click") == 0) update_touchpad_tap_enabled (input_settings, NULL); + else if (strcmp (key, "tap-and_drag") == 0) + update_touchpad_tap_and_drag_enabled (input_settings, NULL); else if (strcmp(key, "disable-while-typing") == 0) update_touchpad_disable_while_typing (input_settings, NULL); else if (strcmp (key, "send-events") == 0) @@ -1338,6 +1370,7 @@ apply_device_settings (MetaInputSettings *input_settings, update_touchpad_left_handed (input_settings, device); update_touchpad_tap_enabled (input_settings, device); + update_touchpad_tap_and_drag_enabled (input_settings, device); update_touchpad_disable_while_typing (input_settings, device); update_touchpad_send_events (input_settings, device); update_touchpad_two_finger_scroll (input_settings, device); diff --git a/src/backends/native/meta-input-settings-native.c b/src/backends/native/meta-input-settings-native.c index f0d7057fb..8a62bb3fe 100644 --- a/src/backends/native/meta-input-settings-native.c +++ b/src/backends/native/meta-input-settings-native.c @@ -121,6 +121,24 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings, LIBINPUT_CONFIG_TAP_DISABLED); } +static void +meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled) +{ + struct libinput_device *libinput_device; + + libinput_device = clutter_evdev_input_device_get_libinput_device (device); + if (!libinput_device) + return; + + if (libinput_device_config_tap_get_finger_count (libinput_device) > 0) + libinput_device_config_tap_set_drag_enabled (libinput_device, + enabled ? + LIBINPUT_CONFIG_DRAG_ENABLED : + LIBINPUT_CONFIG_DRAG_DISABLED); +} + static void meta_input_settings_native_set_disable_while_typing (MetaInputSettings *settings, ClutterInputDevice *device, @@ -530,6 +548,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass) input_settings_class->set_speed = meta_input_settings_native_set_speed; input_settings_class->set_left_handed = meta_input_settings_native_set_left_handed; input_settings_class->set_tap_enabled = meta_input_settings_native_set_tap_enabled; + input_settings_class->set_tap_and_drag_enabled = meta_input_settings_native_set_tap_and_drag_enabled; input_settings_class->set_invert_scroll = meta_input_settings_native_set_invert_scroll; input_settings_class->set_edge_scroll = meta_input_settings_native_set_edge_scroll; input_settings_class->set_two_finger_scroll = meta_input_settings_native_set_two_finger_scroll; diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c index 636f98a7a..c833296a6 100644 --- a/src/backends/x11/meta-input-settings-x11.c +++ b/src/backends/x11/meta-input-settings-x11.c @@ -232,6 +232,17 @@ meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings, XA_INTEGER, 8, &value, 1); } +static void +meta_input_settings_x11_set_tap_and_drag_enabled (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled) +{ + guchar value = (enabled) ? 1 : 0; + + change_property (device, "libinput TappingDrag Enabled", + XA_INTEGER, 8, &value, 1); +} + static void meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings, ClutterInputDevice *device, @@ -779,6 +790,7 @@ meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass) input_settings_class->set_speed = meta_input_settings_x11_set_speed; input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed; input_settings_class->set_tap_enabled = meta_input_settings_x11_set_tap_enabled; + input_settings_class->set_tap_and_drag_enabled = meta_input_settings_x11_set_tap_and_drag_enabled; input_settings_class->set_disable_while_typing = meta_input_settings_x11_set_disable_while_typing; input_settings_class->set_invert_scroll = meta_input_settings_x11_set_invert_scroll; input_settings_class->set_edge_scroll = meta_input_settings_x11_set_edge_scroll;