diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h index 53a7b80fe..1a9ab5f2a 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_disable_while_typing) (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled); void (* set_invert_scroll) (MetaInputSettings *settings, ClutterInputDevice *device, gboolean inverted); @@ -106,7 +109,6 @@ struct _MetaInputSettingsClass ClutterInputDeviceTool *tool, GDesktopStylusButtonAction primary, GDesktopStylusButtonAction secondary); - gboolean (* has_two_finger_scroll) (MetaInputSettings *settings, ClutterInputDevice *device); }; diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index 0566e0d96..7881dbffe 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -442,6 +442,44 @@ update_device_natural_scroll (MetaInputSettings *input_settings, } } +static void +update_touchpad_disable_while_typing (MetaInputSettings *input_settings, + ClutterInputDevice *device) +{ + GSettings *settings; + MetaInputSettingsClass *input_settings_class; + MetaInputSettingsPrivate *priv; + gboolean enabled; + const gchar *key = "disable-while-typing"; + + 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, key); + + if (device) + { + settings = get_settings_for_device_type (input_settings, + clutter_input_device_get_device_type (device)); + + if (!settings) + return; + + settings_device_set_bool_setting (input_settings, device, + input_settings_class->set_disable_while_typing, + enabled); + } + else + { + settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, + input_settings_class->set_disable_while_typing, + enabled); + } +} + static void update_touchpad_tap_enabled (MetaInputSettings *input_settings, ClutterInputDevice *device) @@ -983,6 +1021,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, "disable-while-typing") == 0) + update_touchpad_disable_while_typing (input_settings, NULL); else if (strcmp (key, "send-events") == 0) update_touchpad_send_events (input_settings, NULL); else if (strcmp (key, "edge-scrolling-enabled") == 0) @@ -1228,6 +1268,7 @@ apply_device_settings (MetaInputSettings *input_settings, update_touchpad_left_handed (input_settings, device); update_touchpad_tap_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); update_touchpad_edge_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 69e760812..952625e28 100644 --- a/src/backends/native/meta-input-settings-native.c +++ b/src/backends/native/meta-input-settings-native.c @@ -121,6 +121,25 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings, LIBINPUT_CONFIG_TAP_DISABLED); } +static void +meta_input_settings_native_set_disable_while_typing (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_dwt_is_available (libinput_device)) + libinput_device_config_dwt_set_enabled (libinput_device, + enabled ? + LIBINPUT_CONFIG_DWT_ENABLED : + LIBINPUT_CONFIG_DWT_DISABLED); +} + static void meta_input_settings_native_set_invert_scroll (MetaInputSettings *settings, ClutterInputDevice *device, @@ -507,6 +526,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass) input_settings_class->set_scroll_button = meta_input_settings_native_set_scroll_button; input_settings_class->set_click_method = meta_input_settings_native_set_click_method; input_settings_class->set_keyboard_repeat = meta_input_settings_native_set_keyboard_repeat; + input_settings_class->set_disable_while_typing = meta_input_settings_native_set_disable_while_typing; input_settings_class->set_tablet_mapping = meta_input_settings_native_set_tablet_mapping; input_settings_class->set_tablet_keep_aspect = meta_input_settings_native_set_tablet_keep_aspect; diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c index 012cb62f5..174fd3287 100644 --- a/src/backends/x11/meta-input-settings-x11.c +++ b/src/backends/x11/meta-input-settings-x11.c @@ -205,6 +205,17 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings, } } +static void +meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled) +{ + guchar value = (enabled) ? 1 : 0; + + change_property (device, "libinput Disable While Typing Enabled", + XA_INTEGER, 8, &value, 1); +} + static void meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings, ClutterInputDevice *device, @@ -744,6 +755,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_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; input_settings_class->set_two_finger_scroll = meta_input_settings_x11_set_two_finger_scroll;