mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 09:00:42 -05:00
Implements disable-while-typing in mutter.
Disable-while-typing disables the touchpad while the user is typing. This patch introduces the necessary backend code to implement the org.gnome.desktop.peripherals.touchpad.disable-while-typing setting of gsettings-desktop-schemas which was implemented in commit 4c5b1c1df399d6afaaccb237e299ccd1d5d29ddd and released as part of 3.24. This is known as dwt in libinput. This patch has been tested on X11 and Wayland. https://bugzilla.gnome.org/show_bug.cgi?id=764852
This commit is contained in:
parent
a8ceceed1a
commit
28b2added7
@ -65,6 +65,9 @@ struct _MetaInputSettingsClass
|
|||||||
void (* set_tap_enabled) (MetaInputSettings *settings,
|
void (* set_tap_enabled) (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
gboolean enabled);
|
gboolean enabled);
|
||||||
|
void (* set_disable_while_typing) (MetaInputSettings *settings,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
gboolean enabled);
|
||||||
void (* set_invert_scroll) (MetaInputSettings *settings,
|
void (* set_invert_scroll) (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *device,
|
||||||
gboolean inverted);
|
gboolean inverted);
|
||||||
@ -117,7 +120,6 @@ struct _MetaInputSettingsClass
|
|||||||
ClutterInputDeviceTool *tool,
|
ClutterInputDeviceTool *tool,
|
||||||
GDesktopStylusButtonAction primary,
|
GDesktopStylusButtonAction primary,
|
||||||
GDesktopStylusButtonAction secondary);
|
GDesktopStylusButtonAction secondary);
|
||||||
|
|
||||||
gboolean (* has_two_finger_scroll) (MetaInputSettings *settings,
|
gboolean (* has_two_finger_scroll) (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device);
|
ClutterInputDevice *device);
|
||||||
};
|
};
|
||||||
|
@ -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
|
static void
|
||||||
update_touchpad_tap_enabled (MetaInputSettings *input_settings,
|
update_touchpad_tap_enabled (MetaInputSettings *input_settings,
|
||||||
ClutterInputDevice *device)
|
ClutterInputDevice *device)
|
||||||
@ -989,6 +1027,8 @@ meta_input_settings_changed_cb (GSettings *settings,
|
|||||||
update_device_natural_scroll (input_settings, NULL);
|
update_device_natural_scroll (input_settings, NULL);
|
||||||
else if (strcmp (key, "tap-to-click") == 0)
|
else if (strcmp (key, "tap-to-click") == 0)
|
||||||
update_touchpad_tap_enabled (input_settings, NULL);
|
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)
|
else if (strcmp (key, "send-events") == 0)
|
||||||
update_touchpad_send_events (input_settings, NULL);
|
update_touchpad_send_events (input_settings, NULL);
|
||||||
else if (strcmp (key, "edge-scrolling-enabled") == 0)
|
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_left_handed (input_settings, device);
|
||||||
update_touchpad_tap_enabled (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_send_events (input_settings, device);
|
||||||
update_touchpad_two_finger_scroll (input_settings, device);
|
update_touchpad_two_finger_scroll (input_settings, device);
|
||||||
update_touchpad_edge_scroll (input_settings, device);
|
update_touchpad_edge_scroll (input_settings, device);
|
||||||
|
@ -121,6 +121,25 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings,
|
|||||||
LIBINPUT_CONFIG_TAP_DISABLED);
|
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
|
static void
|
||||||
meta_input_settings_native_set_invert_scroll (MetaInputSettings *settings,
|
meta_input_settings_native_set_invert_scroll (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
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_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_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_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_mapping = meta_input_settings_native_set_tablet_mapping;
|
||||||
input_settings_class->set_tablet_keep_aspect = meta_input_settings_native_set_tablet_keep_aspect;
|
input_settings_class->set_tablet_keep_aspect = meta_input_settings_native_set_tablet_keep_aspect;
|
||||||
|
@ -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
|
static void
|
||||||
meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
|
meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
|
||||||
ClutterInputDevice *device,
|
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_speed = meta_input_settings_x11_set_speed;
|
||||||
input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed;
|
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_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_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_edge_scroll = meta_input_settings_x11_set_edge_scroll;
|
||||||
input_settings_class->set_two_finger_scroll = meta_input_settings_x11_set_two_finger_scroll;
|
input_settings_class->set_two_finger_scroll = meta_input_settings_x11_set_two_finger_scroll;
|
||||||
|
Loading…
Reference in New Issue
Block a user