[mutter] backends/native: Implement set_click_method configuration option



commit ad13fa3bb3ae9796229d5d7e12dea5a060256096
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Mar 16 15:28:04 2015 +0100

    backends/native: Implement set_click_method configuration option
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746290

 src/backends/native/meta-input-settings-native.c |   47 ++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/native/meta-input-settings-native.c 
b/src/backends/native/meta-input-settings-native.c
index 4f436e9..e08667c 100644
--- a/src/backends/native/meta-input-settings-native.c
+++ b/src/backends/native/meta-input-settings-native.c
@@ -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,
@@ -185,6 +199,38 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings  *settings,
 }
 
 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,
                                                 guint              delay,
@@ -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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]