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



commit b6ed891395f323ec4235474249df0aa8755b2f33
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 |   14 +++++++++++++-
 2 files changed, 14 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..16d115c 100644
--- a/clutter/clutter/evdev/clutter-input-device-evdev.c
+++ b/clutter/clutter/evdev/clutter-input-device-evdev.c
@@ -141,13 +141,21 @@ _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;
 
   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);
+    }
+
   device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_EVDEV,
                          "id", device_id,
                          "name", libinput_device_get_name (libinput_device),
@@ -157,6 +165,8 @@ _clutter_input_device_evdev_new (ClutterDeviceManager *manager,
                          "enabled", TRUE,
                          "vendor-id", vendor,
                          "product-id", product,
+                         "n-rings", n_rings,
+                         "n-strips", n_strips,
                          NULL);
 
   device->seat = seat;
@@ -243,6 +253,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]