backends/native: Implement set_click_method configuration option

https://bugzilla.gnome.org/show_bug.cgi?id=746290
This commit is contained in:
Carlos Garnacho 2015-03-16 15:28:04 +01:00
parent 9b50119d31
commit ad13fa3bb3

View File

@ -139,6 +139,20 @@ device_set_scroll_method (struct libinput_device *libinput_device,
return (method & supported) != 0;
}
static gboolean
device_set_click_method (struct libinput_device *libinput_device,
enum libinput_config_click_method method)
{
enum libinput_config_click_method supported;
supported = libinput_device_config_click_get_methods (libinput_device);
if (method & supported)
libinput_device_config_click_set_method (libinput_device, method);
return (method & supported) != 0;
}
static void
meta_input_settings_native_set_scroll_method (MetaInputSettings *settings,
ClutterInputDevice *device,
@ -184,6 +198,38 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
libinput_device_config_scroll_set_button (libinput_device, button);
}
static void
meta_input_settings_native_set_click_method (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadClickMethod mode)
{
enum libinput_config_click_method click_method = 0;
struct libinput_device *libinput_device;
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
switch (mode)
{
case G_DESKTOP_TOUCHPAD_CLICK_METHOD_DEFAULT:
click_method = libinput_device_config_click_get_default_method (libinput_device);
break;
case G_DESKTOP_TOUCHPAD_CLICK_METHOD_NONE:
click_method = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
break;
case G_DESKTOP_TOUCHPAD_CLICK_METHOD_AREAS:
click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
break;
case G_DESKTOP_TOUCHPAD_CLICK_METHOD_FINGERS:
click_method = LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
break;
default:
g_assert_not_reached ();
return;
}
device_set_click_method (libinput_device, click_method);
}
static void
meta_input_settings_native_set_keyboard_repeat (MetaInputSettings *settings,
gboolean enabled,
@ -208,6 +254,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass)
input_settings_class->set_invert_scroll = meta_input_settings_native_set_invert_scroll;
input_settings_class->set_scroll_method = meta_input_settings_native_set_scroll_method;
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;
}