[mutter/wip/tablet-protocol-v2: 36/48] clutter: Add clutter_input_device_get_device_node()



commit 8fec6dfe7c27c9e6bd8ec04c6b8c82a844a951fc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri May 13 13:17:00 2016 +0200

    clutter: Add clutter_input_device_get_device_node()
    
    This function is meant to return the device node path (eg. /dev/input/...),
    which will be useful to wire up a few things.

 clutter/clutter/clutter-device-manager-private.h |    1 +
 clutter/clutter/clutter-input-device.c           |   24 ++++++++++++++++++++++
 clutter/clutter/clutter-input-device.h           |    3 ++
 3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter/clutter-device-manager-private.h 
b/clutter/clutter/clutter-device-manager-private.h
index 965154a..4d0bf21 100644
--- a/clutter/clutter/clutter-device-manager-private.h
+++ b/clutter/clutter/clutter-device-manager-private.h
@@ -131,6 +131,7 @@ struct _ClutterInputDevice
 
   gchar *vendor_id;
   gchar *product_id;
+  gchar *node_path;
 
   GPtrArray *tools;
 
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index bda5adb..a46cc67 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -72,6 +72,7 @@ enum
 
   PROP_N_STRIPS,
   PROP_N_RINGS,
+  PROP_DEVICE_NODE,
 
   PROP_LAST
 };
@@ -206,6 +207,10 @@ clutter_input_device_set_property (GObject      *gobject,
       self->n_strips = g_value_get_int (value);
       break;
 
+    case PROP_DEVICE_NODE:
+      self->node_path = g_value_dup_string (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
       break;
@@ -274,6 +279,10 @@ clutter_input_device_get_property (GObject    *gobject,
       g_value_set_int (value, self->n_strips);
       break;
 
+    case PROP_DEVICE_NODE:
+      g_value_set_string (value, self->node_path);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
       break;
@@ -465,6 +474,13 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
                       0, G_MAXINT, 0,
                       CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
+  obj_props[PROP_DEVICE_NODE] =
+    g_param_spec_string ("device-node",
+                         P_("Device node path"),
+                         P_("Device node path"),
+                         NULL,
+                         CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+
   gobject_class->dispose = clutter_input_device_dispose;
   gobject_class->set_property = clutter_input_device_set_property;
   gobject_class->get_property = clutter_input_device_get_property;
@@ -2115,3 +2131,11 @@ clutter_input_device_get_n_strips (ClutterInputDevice *device)
 
   return device->n_strips;
 }
+
+const gchar *
+clutter_input_device_get_device_node (ClutterInputDevice *device)
+{
+  g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
+
+  return device->node_path;
+}
diff --git a/clutter/clutter/clutter-input-device.h b/clutter/clutter/clutter-input-device.h
index 1e2a81f..f56c484 100644
--- a/clutter/clutter/clutter-input-device.h
+++ b/clutter/clutter/clutter-input-device.h
@@ -145,6 +145,9 @@ gint                    clutter_input_device_get_n_rings        (ClutterInputDev
 CLUTTER_AVAILABLE_IN_ALL
 gint                    clutter_input_device_get_n_strips       (ClutterInputDevice *device);
 
+CLUTTER_AVAILABLE_IN_ALL
+const gchar *           clutter_input_device_get_device_node    (ClutterInputDevice *device);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_INPUT_DEVICE_H__ */


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