[mutter/wip/tablet-protocol-v2: 45/70] clutter: Add clutter_input_device_get_device_node()



commit 39dd46a55ded4dd22ef9fe46651dea4036a7846d
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 12d4eff..bafc024 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 f2c20e2..4b0d169 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -73,6 +73,7 @@ enum
   PROP_N_STRIPS,
   PROP_N_RINGS,
   PROP_N_MODE_GROUPS,
+  PROP_DEVICE_NODE,
 
   PROP_LAST
 };
@@ -211,6 +212,10 @@ clutter_input_device_set_property (GObject      *gobject,
       self->n_mode_groups = 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;
@@ -283,6 +288,10 @@ clutter_input_device_get_property (GObject    *gobject,
       g_value_set_int (value, self->n_mode_groups);
       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;
@@ -481,6 +490,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;
@@ -2141,3 +2157,11 @@ clutter_input_device_get_n_mode_groups (ClutterInputDevice *device)
 
   return device->n_mode_groups;
 }
+
+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 959dce0..9b55d35 100644
--- a/clutter/clutter/clutter-input-device.h
+++ b/clutter/clutter/clutter-input-device.h
@@ -147,6 +147,9 @@ gint                    clutter_input_device_get_n_strips       (ClutterInputDev
 CLUTTER_AVAILABLE_IN_ALL
 gint                    clutter_input_device_get_n_mode_groups  (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]