[mutter/wip/tablet-protocol-v2: 25/70] clutter/evdev: Handle management of pad devices



commit ced956c2c2d8f6fcf1b82008a1f7e06ae8957aea
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 10 17:04:18 2016 +0200

    clutter/evdev: Handle management of pad devices

 .../clutter/evdev/clutter-device-manager-evdev.c   |    1 +
 clutter/clutter/evdev/clutter-input-device-evdev.c |   16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c 
b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index 2ffceb9..7d7f577 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -183,6 +183,7 @@ static const char *device_type_str[] = {
   "pen",                /* CLUTTER_PEN_DEVICE */
   "eraser",             /* CLUTTER_ERASER_DEVICE */
   "cursor",             /* CLUTTER_CURSOR_DEVICE */
+  "pad",                /* CLUTTER_PAD_DEVICE */
 };
 #endif /* CLUTTER_ENABLE_DEBUG */
 
diff --git a/clutter/clutter/evdev/clutter-input-device-evdev.c 
b/clutter/clutter/evdev/clutter-input-device-evdev.c
index e4182d1..8a1914f 100644
--- a/clutter/clutter/evdev/clutter-input-device-evdev.c
+++ b/clutter/clutter/evdev/clutter-input-device-evdev.c
@@ -141,13 +141,22 @@ _clutter_input_device_evdev_new (ClutterDeviceManager *manager,
   ClutterInputDeviceType type;
   ClutterDeviceManagerEvdev *manager_evdev;
   gchar *vendor, *product;
-  gint device_id;
+  gint device_id, n_rings = 0, n_strips = 0, n_groups = 1;
 
   type = _clutter_input_device_evdev_determine_type (libinput_device);
   vendor = g_strdup_printf ("%.4x", libinput_device_get_id_vendor (libinput_device));
   product = g_strdup_printf ("%.4x", libinput_device_get_id_product (libinput_device));
   manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (manager);
   device_id = _clutter_device_manager_evdev_acquire_device_id (manager_evdev);
+
+  if (libinput_device_has_capability (libinput_device,
+                                      LIBINPUT_DEVICE_CAP_TABLET_PAD))
+    {
+      n_rings = libinput_device_tablet_pad_get_num_rings (libinput_device);
+      n_strips = libinput_device_tablet_pad_get_num_strips (libinput_device);
+      n_groups = libinput_device_tablet_pad_get_num_mode_groups (libinput_device);
+    }
+
   device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_EVDEV,
                          "id", device_id,
                          "name", libinput_device_get_name (libinput_device),
@@ -157,6 +166,9 @@ _clutter_input_device_evdev_new (ClutterDeviceManager *manager,
                          "enabled", TRUE,
                          "vendor-id", vendor,
                          "product-id", product,
+                         "n-rings", n_rings,
+                         "n-strips", n_strips,
+                         "n-mode-groups", n_groups,
                          NULL);
 
   device->seat = seat;
@@ -243,6 +255,8 @@ _clutter_input_device_evdev_determine_type (struct libinput_device *ldev)
     return CLUTTER_TOUCHPAD_DEVICE;
   else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_TABLET_TOOL))
     return CLUTTER_TABLET_DEVICE;
+  else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_TABLET_PAD))
+    return CLUTTER_PAD_DEVICE;
   else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_POINTER))
     return CLUTTER_POINTER_DEVICE;
   else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_TOUCH))


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