diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h index c7788519d..bff574d5e 100644 --- a/src/backends/meta-input-settings-private.h +++ b/src/backends/meta-input-settings-private.h @@ -65,6 +65,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); @@ -117,7 +120,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 32512b4ea..264687d44 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -448,6 +448,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) @@ -989,6 +1027,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) @@ -1234,6 +1274,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;